22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "memory/universe.hpp"
27 #include "runtime/mutexLocker.hpp"
28 #include "runtime/os.inline.hpp"
29 #include "runtime/safepoint.hpp"
30 #include "runtime/thread.inline.hpp"
31 #include "runtime/vmThread.hpp"
32
33 // Mutexes used in the VM (see comment in mutexLocker.hpp):
34 //
35 // Note that the following pointers are effectively final -- after having been
36 // set at JVM startup-time, they should never be subsequently mutated.
37 // Instead of using pointers to malloc()ed monitors and mutexes we should consider
38 // eliminating the indirection and using instances instead.
39 // Consider using GCC's __read_mostly.
40
41 Mutex* Patching_lock = NULL;
42 Monitor* SystemDictionary_lock = NULL;
43 Mutex* ProtectionDomainSet_lock = NULL;
44 Mutex* SharedDictionary_lock = NULL;
45 Mutex* Module_lock = NULL;
46 Mutex* CompiledIC_lock = NULL;
47 Mutex* InlineCacheBuffer_lock = NULL;
48 Mutex* VMStatistic_lock = NULL;
49 Mutex* JNIGlobalAlloc_lock = NULL;
50 Mutex* JNIGlobalActive_lock = NULL;
51 Mutex* JNIWeakAlloc_lock = NULL;
52 Mutex* JNIWeakActive_lock = NULL;
53 Mutex* StringTableWeakAlloc_lock = NULL;
54 Mutex* StringTableWeakActive_lock = NULL;
55 Mutex* JNIHandleBlockFreeList_lock = NULL;
56 Mutex* VMWeakAlloc_lock = NULL;
57 Mutex* VMWeakActive_lock = NULL;
58 Mutex* ResolvedMethodTableWeakAlloc_lock = NULL;
59 Mutex* ResolvedMethodTableWeakActive_lock = NULL;
60 Mutex* JmethodIdCreation_lock = NULL;
61 Mutex* JfieldIdCreation_lock = NULL;
244 def(MarkStackChunkList_lock , PaddedMutex , leaf , true, Monitor::_safepoint_check_never);
245
246 def(MonitoringSupport_lock , PaddedMutex , native , true, Monitor::_safepoint_check_never); // used for serviceability monitoring support
247 }
248 if (UseShenandoahGC) {
249 def(SATB_Q_CBL_mon , PaddedMonitor, access, true, Monitor::_safepoint_check_never);
250
251 def(StringDedupQueue_lock , PaddedMonitor, leaf, true, Monitor::_safepoint_check_never);
252 def(StringDedupTable_lock , PaddedMutex , leaf, true, Monitor::_safepoint_check_never);
253 }
254 def(ParGCRareEvent_lock , PaddedMutex , leaf , true, Monitor::_safepoint_check_always);
255 def(CGCPhaseManager_lock , PaddedMonitor, leaf, false, Monitor::_safepoint_check_always);
256 def(CodeCache_lock , PaddedMutex , special, true, Monitor::_safepoint_check_never);
257 def(RawMonitor_lock , PaddedMutex , special, true, Monitor::_safepoint_check_never);
258 def(OopMapCacheAlloc_lock , PaddedMutex , leaf, true, Monitor::_safepoint_check_always); // used for oop_map_cache allocation.
259
260 def(MetaspaceExpand_lock , PaddedMutex , leaf-1, true, Monitor::_safepoint_check_never);
261 def(ClassLoaderDataGraph_lock , PaddedMutex , nonleaf, true, Monitor::_safepoint_check_always);
262
263 def(Patching_lock , PaddedMutex , special, true, Monitor::_safepoint_check_never); // used for safepointing and code patching.
264 def(Service_lock , PaddedMonitor, special, true, Monitor::_safepoint_check_never); // used for service thread operations
265 def(JmethodIdCreation_lock , PaddedMutex , leaf, true, Monitor::_safepoint_check_always); // used for creating jmethodIDs.
266
267 def(SystemDictionary_lock , PaddedMonitor, leaf, true, Monitor::_safepoint_check_always);
268 def(ProtectionDomainSet_lock , PaddedMutex , leaf-1, true, Monitor::_safepoint_check_never);
269 def(SharedDictionary_lock , PaddedMutex , leaf, true, Monitor::_safepoint_check_always);
270 def(Module_lock , PaddedMutex , leaf+2, true, Monitor::_safepoint_check_always);
271 def(InlineCacheBuffer_lock , PaddedMutex , leaf, true, Monitor::_safepoint_check_never);
272 def(VMStatistic_lock , PaddedMutex , leaf, false, Monitor::_safepoint_check_always);
273 def(ExpandHeap_lock , PaddedMutex , leaf, true, Monitor::_safepoint_check_always); // Used during compilation by VM thread
274 def(JNIHandleBlockFreeList_lock , PaddedMutex , leaf-1, true, Monitor::_safepoint_check_never); // handles are used by VM thread
275 def(SignatureHandlerLibrary_lock , PaddedMutex , leaf, false, Monitor::_safepoint_check_always);
276 def(SymbolArena_lock , PaddedMutex , leaf+2, true, Monitor::_safepoint_check_never);
277 def(ProfilePrint_lock , PaddedMutex , leaf, false, Monitor::_safepoint_check_always); // serial profile printing
278 def(ExceptionCache_lock , PaddedMutex , leaf, false, Monitor::_safepoint_check_always); // serial profile printing
279 def(OsrList_lock , PaddedMutex , leaf, true, Monitor::_safepoint_check_never);
280 def(Debug1_lock , PaddedMutex , leaf, true, Monitor::_safepoint_check_never);
281 #ifndef PRODUCT
282 def(FullGCALot_lock , PaddedMutex , leaf, false, Monitor::_safepoint_check_always); // a lock to make FullGCALot MT safe
283 #endif
284 def(BeforeExit_lock , PaddedMonitor, leaf, true, Monitor::_safepoint_check_always);
285 def(PerfDataMemAlloc_lock , PaddedMutex , leaf, true, Monitor::_safepoint_check_always); // used for allocating PerfData memory for performance data
286 def(PerfDataManager_lock , PaddedMutex , leaf, true, Monitor::_safepoint_check_always); // used for synchronized access to PerfDataManager resources
287
288 // CMS_modUnionTable_lock leaf
289 // CMS_bitMap_lock leaf 1
290 // CMS_freeList_lock leaf 2
291
292 def(Threads_lock , PaddedMonitor, barrier, true, Monitor::_safepoint_check_sometimes); // Used for safepoint protocol.
293 def(NonJavaThreadsList_lock , PaddedMutex, leaf, true, Monitor::_safepoint_check_never);
294 def(NonJavaThreadsListSync_lock , PaddedMutex, leaf, true, Monitor::_safepoint_check_never);
295
296 def(VMOperationQueue_lock , PaddedMonitor, nonleaf, true, Monitor::_safepoint_check_never); // VM_thread allowed to block on these
297 def(VMOperationRequest_lock , PaddedMonitor, nonleaf, true, Monitor::_safepoint_check_always);
298 def(RetData_lock , PaddedMutex , nonleaf, false, Monitor::_safepoint_check_always);
299 def(Terminator_lock , PaddedMonitor, nonleaf, true, Monitor::_safepoint_check_always);
|
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "memory/universe.hpp"
27 #include "runtime/mutexLocker.hpp"
28 #include "runtime/os.inline.hpp"
29 #include "runtime/safepoint.hpp"
30 #include "runtime/thread.inline.hpp"
31 #include "runtime/vmThread.hpp"
32
33 // Mutexes used in the VM (see comment in mutexLocker.hpp):
34 //
35 // Note that the following pointers are effectively final -- after having been
36 // set at JVM startup-time, they should never be subsequently mutated.
37 // Instead of using pointers to malloc()ed monitors and mutexes we should consider
38 // eliminating the indirection and using instances instead.
39 // Consider using GCC's __read_mostly.
40
41 Mutex* Patching_lock = NULL;
42 Mutex* CompiledMethod_lock = NULL;
43 Monitor* SystemDictionary_lock = NULL;
44 Mutex* ProtectionDomainSet_lock = NULL;
45 Mutex* SharedDictionary_lock = NULL;
46 Mutex* Module_lock = NULL;
47 Mutex* CompiledIC_lock = NULL;
48 Mutex* InlineCacheBuffer_lock = NULL;
49 Mutex* VMStatistic_lock = NULL;
50 Mutex* JNIGlobalAlloc_lock = NULL;
51 Mutex* JNIGlobalActive_lock = NULL;
52 Mutex* JNIWeakAlloc_lock = NULL;
53 Mutex* JNIWeakActive_lock = NULL;
54 Mutex* StringTableWeakAlloc_lock = NULL;
55 Mutex* StringTableWeakActive_lock = NULL;
56 Mutex* JNIHandleBlockFreeList_lock = NULL;
57 Mutex* VMWeakAlloc_lock = NULL;
58 Mutex* VMWeakActive_lock = NULL;
59 Mutex* ResolvedMethodTableWeakAlloc_lock = NULL;
60 Mutex* ResolvedMethodTableWeakActive_lock = NULL;
61 Mutex* JmethodIdCreation_lock = NULL;
62 Mutex* JfieldIdCreation_lock = NULL;
245 def(MarkStackChunkList_lock , PaddedMutex , leaf , true, Monitor::_safepoint_check_never);
246
247 def(MonitoringSupport_lock , PaddedMutex , native , true, Monitor::_safepoint_check_never); // used for serviceability monitoring support
248 }
249 if (UseShenandoahGC) {
250 def(SATB_Q_CBL_mon , PaddedMonitor, access, true, Monitor::_safepoint_check_never);
251
252 def(StringDedupQueue_lock , PaddedMonitor, leaf, true, Monitor::_safepoint_check_never);
253 def(StringDedupTable_lock , PaddedMutex , leaf, true, Monitor::_safepoint_check_never);
254 }
255 def(ParGCRareEvent_lock , PaddedMutex , leaf , true, Monitor::_safepoint_check_always);
256 def(CGCPhaseManager_lock , PaddedMonitor, leaf, false, Monitor::_safepoint_check_always);
257 def(CodeCache_lock , PaddedMutex , special, true, Monitor::_safepoint_check_never);
258 def(RawMonitor_lock , PaddedMutex , special, true, Monitor::_safepoint_check_never);
259 def(OopMapCacheAlloc_lock , PaddedMutex , leaf, true, Monitor::_safepoint_check_always); // used for oop_map_cache allocation.
260
261 def(MetaspaceExpand_lock , PaddedMutex , leaf-1, true, Monitor::_safepoint_check_never);
262 def(ClassLoaderDataGraph_lock , PaddedMutex , nonleaf, true, Monitor::_safepoint_check_always);
263
264 def(Patching_lock , PaddedMutex , special, true, Monitor::_safepoint_check_never); // used for safepointing and code patching.
265 def(OsrList_lock , PaddedMutex , special-1, true, Monitor::_safepoint_check_never);
266 def(CompiledMethod_lock , PaddedMutex , special-1, true, Monitor::_safepoint_check_never);
267 def(Service_lock , PaddedMonitor, special, true, Monitor::_safepoint_check_never); // used for service thread operations
268 def(JmethodIdCreation_lock , PaddedMutex , leaf, true, Monitor::_safepoint_check_always); // used for creating jmethodIDs.
269
270 def(SystemDictionary_lock , PaddedMonitor, leaf, true, Monitor::_safepoint_check_always);
271 def(ProtectionDomainSet_lock , PaddedMutex , leaf-1, true, Monitor::_safepoint_check_never);
272 def(SharedDictionary_lock , PaddedMutex , leaf, true, Monitor::_safepoint_check_always);
273 def(Module_lock , PaddedMutex , leaf+2, true, Monitor::_safepoint_check_always);
274 def(InlineCacheBuffer_lock , PaddedMutex , leaf, true, Monitor::_safepoint_check_never);
275 def(VMStatistic_lock , PaddedMutex , leaf, false, Monitor::_safepoint_check_always);
276 def(ExpandHeap_lock , PaddedMutex , leaf, true, Monitor::_safepoint_check_always); // Used during compilation by VM thread
277 def(JNIHandleBlockFreeList_lock , PaddedMutex , leaf-1, true, Monitor::_safepoint_check_never); // handles are used by VM thread
278 def(SignatureHandlerLibrary_lock , PaddedMutex , leaf, false, Monitor::_safepoint_check_always);
279 def(SymbolArena_lock , PaddedMutex , leaf+2, true, Monitor::_safepoint_check_never);
280 def(ProfilePrint_lock , PaddedMutex , leaf, false, Monitor::_safepoint_check_always); // serial profile printing
281 def(ExceptionCache_lock , PaddedMutex , leaf, false, Monitor::_safepoint_check_always); // serial profile printing
282 def(Debug1_lock , PaddedMutex , leaf, true, Monitor::_safepoint_check_never);
283 #ifndef PRODUCT
284 def(FullGCALot_lock , PaddedMutex , leaf, false, Monitor::_safepoint_check_always); // a lock to make FullGCALot MT safe
285 #endif
286 def(BeforeExit_lock , PaddedMonitor, leaf, true, Monitor::_safepoint_check_always);
287 def(PerfDataMemAlloc_lock , PaddedMutex , leaf, true, Monitor::_safepoint_check_always); // used for allocating PerfData memory for performance data
288 def(PerfDataManager_lock , PaddedMutex , leaf, true, Monitor::_safepoint_check_always); // used for synchronized access to PerfDataManager resources
289
290 // CMS_modUnionTable_lock leaf
291 // CMS_bitMap_lock leaf 1
292 // CMS_freeList_lock leaf 2
293
294 def(Threads_lock , PaddedMonitor, barrier, true, Monitor::_safepoint_check_sometimes); // Used for safepoint protocol.
295 def(NonJavaThreadsList_lock , PaddedMutex, leaf, true, Monitor::_safepoint_check_never);
296 def(NonJavaThreadsListSync_lock , PaddedMutex, leaf, true, Monitor::_safepoint_check_never);
297
298 def(VMOperationQueue_lock , PaddedMonitor, nonleaf, true, Monitor::_safepoint_check_never); // VM_thread allowed to block on these
299 def(VMOperationRequest_lock , PaddedMonitor, nonleaf, true, Monitor::_safepoint_check_always);
300 def(RetData_lock , PaddedMutex , nonleaf, false, Monitor::_safepoint_check_always);
301 def(Terminator_lock , PaddedMonitor, nonleaf, true, Monitor::_safepoint_check_always);
|