110 Mutex* Debug3_lock = NULL;
111
112 Mutex* tty_lock = NULL;
113
114 Mutex* RawMonitor_lock = NULL;
115 Mutex* PerfDataMemAlloc_lock = NULL;
116 Mutex* PerfDataManager_lock = NULL;
117 Mutex* OopMapCacheAlloc_lock = NULL;
118
119 Mutex* FreeList_lock = NULL;
120 Monitor* SecondaryFreeList_lock = NULL;
121 Mutex* OldSets_lock = NULL;
122 Monitor* RootRegionScan_lock = NULL;
123 Mutex* MMUTracker_lock = NULL;
124
125 Monitor* GCTaskManager_lock = NULL;
126
127 Mutex* Management_lock = NULL;
128 Monitor* Service_lock = NULL;
129 Monitor* PeriodicTask_lock = NULL;
130
131 #ifdef INCLUDE_TRACE
132 Mutex* JfrStacktrace_lock = NULL;
133 Monitor* JfrMsg_lock = NULL;
134 Mutex* JfrBuffer_lock = NULL;
135 Mutex* JfrStream_lock = NULL;
136 Mutex* JfrThreadGroups_lock = NULL;
137 #endif
138
139 #ifndef SUPPORTS_NATIVE_CX8
140 Mutex* UnsafeJlong_lock = NULL;
141 #endif
142
143 #define MAX_NUM_MUTEX 128
144 static Monitor * _mutex_array[MAX_NUM_MUTEX];
145 static int _num_mutex;
146
147 #ifdef ASSERT
148 void assert_locked_or_safepoint(const Monitor * lock) {
149 // check if this thread owns the lock (common case)
265 def(CompileStatistics_lock , Mutex , nonleaf+2, false, Monitor::_safepoint_check_always);
266 def(MultiArray_lock , Mutex , nonleaf+2, false, Monitor::_safepoint_check_always); // locks SymbolTable_lock
267
268 def(JvmtiThreadState_lock , Mutex , nonleaf+2, false, Monitor::_safepoint_check_always); // Used by JvmtiThreadState/JvmtiEventController
269 def(JvmtiPendingEvent_lock , Monitor, nonleaf, false, Monitor::_safepoint_check_never); // Used by JvmtiCodeBlobEvents
270 def(Management_lock , Mutex , nonleaf+2, false, Monitor::_safepoint_check_always); // used for JVM management
271
272 def(Compile_lock , Mutex , nonleaf+3, true, Monitor::_safepoint_check_sometimes);
273 def(MethodData_lock , Mutex , nonleaf+3, false, Monitor::_safepoint_check_always);
274 def(TouchedMethodLog_lock , Mutex , nonleaf+3, false, Monitor::_safepoint_check_always);
275
276 def(MethodCompileQueue_lock , Monitor, nonleaf+4, true, Monitor::_safepoint_check_always);
277 def(Debug2_lock , Mutex , nonleaf+4, true, Monitor::_safepoint_check_never);
278 def(Debug3_lock , Mutex , nonleaf+4, true, Monitor::_safepoint_check_never);
279 def(ProfileVM_lock , Monitor, special, false, Monitor::_safepoint_check_never); // used for profiling of the VMThread
280 def(CompileThread_lock , Monitor, nonleaf+5, false, Monitor::_safepoint_check_always);
281 def(PeriodicTask_lock , Monitor, nonleaf+5, true, Monitor::_safepoint_check_sometimes);
282 if (WhiteBoxAPI) {
283 def(Compilation_lock , Monitor, leaf, false, Monitor::_safepoint_check_never);
284 }
285
286 #ifdef INCLUDE_TRACE
287 def(JfrMsg_lock , Monitor, leaf, true, Monitor::_safepoint_check_always);
288 def(JfrBuffer_lock , Mutex, leaf, true, Monitor::_safepoint_check_never);
289 def(JfrThreadGroups_lock , Mutex, leaf, true, Monitor::_safepoint_check_always);
290 def(JfrStream_lock , Mutex, nonleaf, true, Monitor::_safepoint_check_never);
291 def(JfrStacktrace_lock , Mutex, special, true, Monitor::_safepoint_check_sometimes);
292 #endif
293
294 #ifndef SUPPORTS_NATIVE_CX8
295 def(UnsafeJlong_lock , Mutex, special, false, Monitor::_safepoint_check_never);
296 #endif
297 }
298
299 GCMutexLocker::GCMutexLocker(Monitor * mutex) {
300 if (SafepointSynchronize::is_at_safepoint()) {
301 _locked = false;
302 } else {
303 _mutex = mutex;
304 _locked = true;
|
110 Mutex* Debug3_lock = NULL;
111
112 Mutex* tty_lock = NULL;
113
114 Mutex* RawMonitor_lock = NULL;
115 Mutex* PerfDataMemAlloc_lock = NULL;
116 Mutex* PerfDataManager_lock = NULL;
117 Mutex* OopMapCacheAlloc_lock = NULL;
118
119 Mutex* FreeList_lock = NULL;
120 Monitor* SecondaryFreeList_lock = NULL;
121 Mutex* OldSets_lock = NULL;
122 Monitor* RootRegionScan_lock = NULL;
123 Mutex* MMUTracker_lock = NULL;
124
125 Monitor* GCTaskManager_lock = NULL;
126
127 Mutex* Management_lock = NULL;
128 Monitor* Service_lock = NULL;
129 Monitor* PeriodicTask_lock = NULL;
130 Mutex* LogConfiguration_lock = NULL;
131
132 #ifdef INCLUDE_TRACE
133 Mutex* JfrStacktrace_lock = NULL;
134 Monitor* JfrMsg_lock = NULL;
135 Mutex* JfrBuffer_lock = NULL;
136 Mutex* JfrStream_lock = NULL;
137 Mutex* JfrThreadGroups_lock = NULL;
138 #endif
139
140 #ifndef SUPPORTS_NATIVE_CX8
141 Mutex* UnsafeJlong_lock = NULL;
142 #endif
143
144 #define MAX_NUM_MUTEX 128
145 static Monitor * _mutex_array[MAX_NUM_MUTEX];
146 static int _num_mutex;
147
148 #ifdef ASSERT
149 void assert_locked_or_safepoint(const Monitor * lock) {
150 // check if this thread owns the lock (common case)
266 def(CompileStatistics_lock , Mutex , nonleaf+2, false, Monitor::_safepoint_check_always);
267 def(MultiArray_lock , Mutex , nonleaf+2, false, Monitor::_safepoint_check_always); // locks SymbolTable_lock
268
269 def(JvmtiThreadState_lock , Mutex , nonleaf+2, false, Monitor::_safepoint_check_always); // Used by JvmtiThreadState/JvmtiEventController
270 def(JvmtiPendingEvent_lock , Monitor, nonleaf, false, Monitor::_safepoint_check_never); // Used by JvmtiCodeBlobEvents
271 def(Management_lock , Mutex , nonleaf+2, false, Monitor::_safepoint_check_always); // used for JVM management
272
273 def(Compile_lock , Mutex , nonleaf+3, true, Monitor::_safepoint_check_sometimes);
274 def(MethodData_lock , Mutex , nonleaf+3, false, Monitor::_safepoint_check_always);
275 def(TouchedMethodLog_lock , Mutex , nonleaf+3, false, Monitor::_safepoint_check_always);
276
277 def(MethodCompileQueue_lock , Monitor, nonleaf+4, true, Monitor::_safepoint_check_always);
278 def(Debug2_lock , Mutex , nonleaf+4, true, Monitor::_safepoint_check_never);
279 def(Debug3_lock , Mutex , nonleaf+4, true, Monitor::_safepoint_check_never);
280 def(ProfileVM_lock , Monitor, special, false, Monitor::_safepoint_check_never); // used for profiling of the VMThread
281 def(CompileThread_lock , Monitor, nonleaf+5, false, Monitor::_safepoint_check_always);
282 def(PeriodicTask_lock , Monitor, nonleaf+5, true, Monitor::_safepoint_check_sometimes);
283 if (WhiteBoxAPI) {
284 def(Compilation_lock , Monitor, leaf, false, Monitor::_safepoint_check_never);
285 }
286 def(LogConfiguration_lock , Mutex, nonleaf, false, Monitor::_safepoint_check_always);
287
288 #ifdef INCLUDE_TRACE
289 def(JfrMsg_lock , Monitor, leaf, true, Monitor::_safepoint_check_always);
290 def(JfrBuffer_lock , Mutex, leaf, true, Monitor::_safepoint_check_never);
291 def(JfrThreadGroups_lock , Mutex, leaf, true, Monitor::_safepoint_check_always);
292 def(JfrStream_lock , Mutex, nonleaf, true, Monitor::_safepoint_check_never);
293 def(JfrStacktrace_lock , Mutex, special, true, Monitor::_safepoint_check_sometimes);
294 #endif
295
296 #ifndef SUPPORTS_NATIVE_CX8
297 def(UnsafeJlong_lock , Mutex, special, false, Monitor::_safepoint_check_never);
298 #endif
299 }
300
301 GCMutexLocker::GCMutexLocker(Monitor * mutex) {
302 if (SafepointSynchronize::is_at_safepoint()) {
303 _locked = false;
304 } else {
305 _mutex = mutex;
306 _locked = true;
|