1
1
/*
2
- * Copyright (c) 1998, 2024 , Oracle and/or its affiliates. All rights reserved.
2
+ * Copyright (c) 1998, 2025 , Oracle and/or its affiliates. All rights reserved.
3
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
4
*
5
5
* This code is free software; you can redistribute it and/or modify it
@@ -84,12 +84,9 @@ class ObjectWaiter : public CHeapObj<mtThread> {
84
84
//
85
85
// ObjectMonitor Layout Overview/Highlights/Restrictions:
86
86
//
87
- // - The _metadata field must be at offset 0 because the displaced header
88
- // from markWord is stored there. We do not want markWord.hpp to include
89
- // ObjectMonitor.hpp to avoid exposing ObjectMonitor everywhere. This
90
- // means that ObjectMonitor cannot inherit from any other class nor can
91
- // it use any virtual member functions. This restriction is critical to
92
- // the proper functioning of the VM.
87
+ // - For performance reasons we ensure the _metadata field is located at offset 0,
88
+ // which in turn means that ObjectMonitor can't inherit from any other class nor use
89
+ // any virtual member functions.
93
90
// - The _metadata and _owner fields should be separated by enough space
94
91
// to avoid false sharing due to parallel access by different threads.
95
92
// This is an advisory recommendation.
@@ -117,11 +114,7 @@ class ObjectWaiter : public CHeapObj<mtThread> {
117
114
//
118
115
// - See TEST_VM(ObjectMonitor, sanity) gtest for how critical restrictions are
119
116
// enforced.
120
- // - Adjacent ObjectMonitors should be separated by enough space to avoid
121
- // false sharing. This is handled by the ObjectMonitor allocation code
122
- // in synchronizer.cpp. Also see TEST_VM(SynchronizerTest, sanity) gtest.
123
117
//
124
- // Futures notes:
125
118
// - Separating _owner from the <remaining_fields> by enough space to
126
119
// avoid false sharing might be profitable. Given that the CAS in
127
120
// monitorenter will invalidate the line underlying _owner. We want
@@ -132,7 +125,7 @@ class ObjectWaiter : public CHeapObj<mtThread> {
132
125
// would make them immune to CAS-based invalidation from the _owner
133
126
// field.
134
127
//
135
- // - The _recursions field should be of type int, or int32_t but not
128
+ // - TODO: The _recursions field should be of type int, or int32_t but not
136
129
// intptr_t. There's no reason to use a 64-bit type for this field
137
130
// in a 64-bit JVM.
138
131
@@ -151,7 +144,7 @@ class ObjectMonitor : public CHeapObj<mtObjectMonitor> {
151
144
// ParkEvent of unblocker thread.
152
145
static ParkEvent* _vthread_unparker_ParkEvent;
153
146
154
- // The sync code expects the metadata field to be at offset zero (0).
147
+ // Because of frequent access, the the metadata field is at offset zero (0).
155
148
// Enforced by the assert() in metadata_addr().
156
149
// * LM_LIGHTWEIGHT with UseObjectMonitorTable:
157
150
// Contains the _object's hashCode.
0 commit comments