src/hotspot/share/runtime/mutexLocker.cpp
changeset 52448 bc5c7f63dbae
parent 52140 3a168f782e80
child 52581 d402a406bbc3
equal deleted inserted replaced
52447:4547f8303f2d 52448:bc5c7f63dbae
   104 Monitor* BeforeExit_lock              = NULL;
   104 Monitor* BeforeExit_lock              = NULL;
   105 Monitor* Notify_lock                  = NULL;
   105 Monitor* Notify_lock                  = NULL;
   106 Mutex*   ProfilePrint_lock            = NULL;
   106 Mutex*   ProfilePrint_lock            = NULL;
   107 Mutex*   ExceptionCache_lock          = NULL;
   107 Mutex*   ExceptionCache_lock          = NULL;
   108 Mutex*   OsrList_lock                 = NULL;
   108 Mutex*   OsrList_lock                 = NULL;
   109 
   109 Mutex*   NMethodSweeperStats_lock     = NULL;
   110 #ifndef PRODUCT
   110 #ifndef PRODUCT
   111 Mutex*   FullGCALot_lock              = NULL;
   111 Mutex*   FullGCALot_lock              = NULL;
   112 #endif
   112 #endif
   113 
   113 
   114 Mutex*   Debug1_lock                  = NULL;
   114 Mutex*   Debug1_lock                  = NULL;
   136 #if INCLUDE_JFR
   136 #if INCLUDE_JFR
   137 Mutex*   JfrStacktrace_lock           = NULL;
   137 Mutex*   JfrStacktrace_lock           = NULL;
   138 Monitor* JfrMsg_lock                  = NULL;
   138 Monitor* JfrMsg_lock                  = NULL;
   139 Mutex*   JfrBuffer_lock               = NULL;
   139 Mutex*   JfrBuffer_lock               = NULL;
   140 Mutex*   JfrStream_lock               = NULL;
   140 Mutex*   JfrStream_lock               = NULL;
       
   141 Monitor* JfrThreadSampler_lock        = NULL;
   141 #endif
   142 #endif
   142 
   143 
   143 #ifndef SUPPORTS_NATIVE_CX8
   144 #ifndef SUPPORTS_NATIVE_CX8
   144 Mutex*   UnsafeJlong_lock             = NULL;
   145 Mutex*   UnsafeJlong_lock             = NULL;
   145 #endif
   146 #endif
   146 Monitor* CodeHeapStateAnalytics_lock  = NULL;
   147 Monitor* CodeHeapStateAnalytics_lock  = NULL;
   147 
   148 
   148 Mutex*   MetaspaceExpand_lock         = NULL;
   149 Mutex*   MetaspaceExpand_lock         = NULL;
   149 Mutex*   ClassLoaderDataGraph_lock    = NULL;
   150 Mutex*   ClassLoaderDataGraph_lock    = NULL;
       
   151 Monitor* ThreadsSMRDelete_lock       = NULL;
       
   152 Mutex*   SharedDecoder_lock           = NULL;
       
   153 Mutex*   DCmdFactory_lock             = NULL;
   150 
   154 
   151 #define MAX_NUM_MUTEX 128
   155 #define MAX_NUM_MUTEX 128
   152 static Monitor * _mutex_array[MAX_NUM_MUTEX];
   156 static Monitor * _mutex_array[MAX_NUM_MUTEX];
   153 static int _num_mutex;
   157 static int _num_mutex;
   154 
   158 
   241   def(Patching_lock                , PaddedMutex  , special,     true,  Monitor::_safepoint_check_never);      // used for safepointing and code patching.
   245   def(Patching_lock                , PaddedMutex  , special,     true,  Monitor::_safepoint_check_never);      // used for safepointing and code patching.
   242   def(Service_lock                 , PaddedMonitor, special,     true,  Monitor::_safepoint_check_never);      // used for service thread operations
   246   def(Service_lock                 , PaddedMonitor, special,     true,  Monitor::_safepoint_check_never);      // used for service thread operations
   243   def(JmethodIdCreation_lock       , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_always);     // used for creating jmethodIDs.
   247   def(JmethodIdCreation_lock       , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_always);     // used for creating jmethodIDs.
   244 
   248 
   245   def(SystemDictionary_lock        , PaddedMonitor, leaf,        true,  Monitor::_safepoint_check_always);     // lookups done by VM thread
   249   def(SystemDictionary_lock        , PaddedMonitor, leaf,        true,  Monitor::_safepoint_check_always);     // lookups done by VM thread
   246   def(SharedDictionary_lock        , PaddedMutex,   leaf,        true,  Monitor::_safepoint_check_always);     // lookups done by VM thread
   250   def(SharedDictionary_lock        , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_always);     // lookups done by VM thread
   247   def(Module_lock                  , PaddedMutex  , leaf+2,      true,  Monitor::_safepoint_check_always);
   251   def(Module_lock                  , PaddedMutex  , leaf+2,      true,  Monitor::_safepoint_check_always);
   248   def(InlineCacheBuffer_lock       , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_always);
   252   def(InlineCacheBuffer_lock       , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_always);
   249   def(VMStatistic_lock             , PaddedMutex  , leaf,        false, Monitor::_safepoint_check_always);
   253   def(VMStatistic_lock             , PaddedMutex  , leaf,        false, Monitor::_safepoint_check_always);
   250   def(ExpandHeap_lock              , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_always);     // Used during compilation by VM thread
   254   def(ExpandHeap_lock              , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_always);     // Used during compilation by VM thread
   251   def(JNIHandleBlockFreeList_lock  , PaddedMutex  , leaf-1,      true,  Monitor::_safepoint_check_never);      // handles are used by VM thread
   255   def(JNIHandleBlockFreeList_lock  , PaddedMutex  , leaf-1,      true,  Monitor::_safepoint_check_never);      // handles are used by VM thread
   316 #if INCLUDE_JFR
   320 #if INCLUDE_JFR
   317   def(JfrMsg_lock                  , PaddedMonitor, leaf,        true,  Monitor::_safepoint_check_always);
   321   def(JfrMsg_lock                  , PaddedMonitor, leaf,        true,  Monitor::_safepoint_check_always);
   318   def(JfrBuffer_lock               , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_never);
   322   def(JfrBuffer_lock               , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_never);
   319   def(JfrStream_lock               , PaddedMutex  , leaf+1,      true,  Monitor::_safepoint_check_never);      // ensure to rank lower than 'safepoint'
   323   def(JfrStream_lock               , PaddedMutex  , leaf+1,      true,  Monitor::_safepoint_check_never);      // ensure to rank lower than 'safepoint'
   320   def(JfrStacktrace_lock           , PaddedMutex  , special,     true,  Monitor::_safepoint_check_sometimes);
   324   def(JfrStacktrace_lock           , PaddedMutex  , special,     true,  Monitor::_safepoint_check_sometimes);
       
   325   def(JfrThreadSampler_lock        , PaddedMonitor, leaf,        true,  Monitor::_safepoint_check_never);
   321 #endif
   326 #endif
   322 
   327 
   323 #ifndef SUPPORTS_NATIVE_CX8
   328 #ifndef SUPPORTS_NATIVE_CX8
   324   def(UnsafeJlong_lock             , PaddedMutex  , special,     false, Monitor::_safepoint_check_never);
   329   def(UnsafeJlong_lock             , PaddedMutex  , special,     false, Monitor::_safepoint_check_never);
   325 #endif
   330 #endif
   326 
   331 
   327   def(CodeHeapStateAnalytics_lock  , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_never);
   332   def(CodeHeapStateAnalytics_lock  , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_never);
       
   333 
       
   334   def(NMethodSweeperStats_lock     , PaddedMutex  , special,     true,  Monitor::_safepoint_check_sometimes);
       
   335   def(ThreadsSMRDelete_lock        , PaddedMonitor, special,     false, Monitor::_safepoint_check_never);
       
   336   def(SharedDecoder_lock           , PaddedMutex  , native,      false, Monitor::_safepoint_check_never);
       
   337   def(DCmdFactory_lock             , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_never);
   328 }
   338 }
   329 
   339 
   330 GCMutexLocker::GCMutexLocker(Monitor * mutex) {
   340 GCMutexLocker::GCMutexLocker(Monitor * mutex) {
   331   if (SafepointSynchronize::is_at_safepoint()) {
   341   if (SafepointSynchronize::is_at_safepoint()) {
   332     _locked = false;
   342     _locked = false;