< prev index next >

src/hotspot/share/runtime/mutexLocker.cpp

Print this page
rev 50373 : 8195097: Make it possible to process StringTable outside safepoint
Reviewed-by:


  31 
  32 // Mutexes used in the VM (see comment in mutexLocker.hpp):
  33 //
  34 // Note that the following pointers are effectively final -- after having been
  35 // set at JVM startup-time, they should never be subsequently mutated.
  36 // Instead of using pointers to malloc()ed monitors and mutexes we should consider
  37 // eliminating the indirection and using instances instead.
  38 // Consider using GCC's __read_mostly.
  39 
  40 Mutex*   Patching_lock                = NULL;
  41 Monitor* SystemDictionary_lock        = NULL;
  42 Mutex*   SharedDictionary_lock        = NULL;
  43 Mutex*   Module_lock                  = NULL;
  44 Mutex*   CompiledIC_lock              = NULL;
  45 Mutex*   InlineCacheBuffer_lock       = NULL;
  46 Mutex*   VMStatistic_lock             = NULL;
  47 Mutex*   JNIGlobalAlloc_lock          = NULL;
  48 Mutex*   JNIGlobalActive_lock         = NULL;
  49 Mutex*   JNIWeakAlloc_lock            = NULL;
  50 Mutex*   JNIWeakActive_lock           = NULL;


  51 Mutex*   JNIHandleBlockFreeList_lock  = NULL;
  52 Mutex*   VMWeakAlloc_lock             = NULL;
  53 Mutex*   VMWeakActive_lock            = NULL;
  54 Mutex*   ResolvedMethodTable_lock     = NULL;
  55 Mutex*   JmethodIdCreation_lock       = NULL;
  56 Mutex*   JfieldIdCreation_lock        = NULL;
  57 Monitor* JNICritical_lock             = NULL;
  58 Mutex*   JvmtiThreadState_lock        = NULL;
  59 Monitor* Heap_lock                    = NULL;
  60 Mutex*   ExpandHeap_lock              = NULL;
  61 Mutex*   AdapterHandlerLibrary_lock   = NULL;
  62 Mutex*   SignatureHandlerLibrary_lock = NULL;
  63 Mutex*   VtableStubs_lock             = NULL;
  64 Mutex*   SymbolTable_lock             = NULL;
  65 Mutex*   StringTable_lock             = NULL;
  66 Monitor* StringDedupQueue_lock        = NULL;
  67 Mutex*   StringDedupTable_lock        = NULL;
  68 Monitor* CodeCache_lock               = NULL;
  69 Mutex*   MethodData_lock              = NULL;
  70 Mutex*   TouchedMethodLog_lock        = NULL;


 168   if (lock->owned_by_self()) return;
 169   fatal("must own lock %s", lock->name());
 170 }
 171 #endif
 172 
 173 #define def(var, type, pri, vm_block, safepoint_check_allowed ) {      \
 174   var = new type(Mutex::pri, #var, vm_block, safepoint_check_allowed); \
 175   assert(_num_mutex < MAX_NUM_MUTEX, "increase MAX_NUM_MUTEX");        \
 176   _mutex_array[_num_mutex++] = var;                                      \
 177 }
 178 
 179 // Using Padded subclasses to prevent false sharing of these global monitors and mutexes.
 180 void mutex_init() {
 181   def(tty_lock                     , PaddedMutex  , event,       true,  Monitor::_safepoint_check_never);      // allow to lock in VM
 182 
 183   def(CGC_lock                     , PaddedMonitor, special,     true,  Monitor::_safepoint_check_never);      // coordinate between fore- and background GC
 184   def(STS_lock                     , PaddedMonitor, leaf,        true,  Monitor::_safepoint_check_never);
 185 
 186   def(VMWeakAlloc_lock             , PaddedMutex  , vmweak,      true,  Monitor::_safepoint_check_never);
 187   def(VMWeakActive_lock            , PaddedMutex  , vmweak-1,    true,  Monitor::_safepoint_check_never);



 188 
 189   if (UseConcMarkSweepGC || UseG1GC) {
 190     def(FullGCCount_lock           , PaddedMonitor, leaf,        true,  Monitor::_safepoint_check_never);      // in support of ExplicitGCInvokesConcurrent
 191   }
 192   if (UseG1GC) {
 193     def(SATB_Q_FL_lock             , PaddedMutex  , access,      true,  Monitor::_safepoint_check_never);
 194     def(SATB_Q_CBL_mon             , PaddedMonitor, access,      true,  Monitor::_safepoint_check_never);
 195     def(Shared_SATB_Q_lock         , PaddedMutex  , access + 1,  true,  Monitor::_safepoint_check_never);
 196 
 197     def(DirtyCardQ_FL_lock         , PaddedMutex  , access,      true,  Monitor::_safepoint_check_never);
 198     def(DirtyCardQ_CBL_mon         , PaddedMonitor, access,      true,  Monitor::_safepoint_check_never);
 199     def(Shared_DirtyCardQ_lock     , PaddedMutex  , access + 1,  true,  Monitor::_safepoint_check_never);
 200 
 201     def(FreeList_lock              , PaddedMutex  , leaf     ,   true,  Monitor::_safepoint_check_never);
 202     def(OldSets_lock               , PaddedMutex  , leaf     ,   true,  Monitor::_safepoint_check_never);
 203     def(RootRegionScan_lock        , PaddedMonitor, leaf     ,   true,  Monitor::_safepoint_check_never);
 204 
 205     def(StringDedupQueue_lock      , PaddedMonitor, leaf,        true,  Monitor::_safepoint_check_never);
 206     def(StringDedupTable_lock      , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_never);
 207 




  31 
  32 // Mutexes used in the VM (see comment in mutexLocker.hpp):
  33 //
  34 // Note that the following pointers are effectively final -- after having been
  35 // set at JVM startup-time, they should never be subsequently mutated.
  36 // Instead of using pointers to malloc()ed monitors and mutexes we should consider
  37 // eliminating the indirection and using instances instead.
  38 // Consider using GCC's __read_mostly.
  39 
  40 Mutex*   Patching_lock                = NULL;
  41 Monitor* SystemDictionary_lock        = NULL;
  42 Mutex*   SharedDictionary_lock        = NULL;
  43 Mutex*   Module_lock                  = NULL;
  44 Mutex*   CompiledIC_lock              = NULL;
  45 Mutex*   InlineCacheBuffer_lock       = NULL;
  46 Mutex*   VMStatistic_lock             = NULL;
  47 Mutex*   JNIGlobalAlloc_lock          = NULL;
  48 Mutex*   JNIGlobalActive_lock         = NULL;
  49 Mutex*   JNIWeakAlloc_lock            = NULL;
  50 Mutex*   JNIWeakActive_lock           = NULL;
  51 Mutex*   StringTableWeakAlloc_lock    = NULL;
  52 Mutex*   StringTableWeakActive_lock   = NULL;
  53 Mutex*   JNIHandleBlockFreeList_lock  = NULL;
  54 Mutex*   VMWeakAlloc_lock             = NULL;
  55 Mutex*   VMWeakActive_lock            = NULL;
  56 Mutex*   ResolvedMethodTable_lock     = NULL;
  57 Mutex*   JmethodIdCreation_lock       = NULL;
  58 Mutex*   JfieldIdCreation_lock        = NULL;
  59 Monitor* JNICritical_lock             = NULL;
  60 Mutex*   JvmtiThreadState_lock        = NULL;
  61 Monitor* Heap_lock                    = NULL;
  62 Mutex*   ExpandHeap_lock              = NULL;
  63 Mutex*   AdapterHandlerLibrary_lock   = NULL;
  64 Mutex*   SignatureHandlerLibrary_lock = NULL;
  65 Mutex*   VtableStubs_lock             = NULL;
  66 Mutex*   SymbolTable_lock             = NULL;
  67 Mutex*   StringTable_lock             = NULL;
  68 Monitor* StringDedupQueue_lock        = NULL;
  69 Mutex*   StringDedupTable_lock        = NULL;
  70 Monitor* CodeCache_lock               = NULL;
  71 Mutex*   MethodData_lock              = NULL;
  72 Mutex*   TouchedMethodLog_lock        = NULL;


 170   if (lock->owned_by_self()) return;
 171   fatal("must own lock %s", lock->name());
 172 }
 173 #endif
 174 
 175 #define def(var, type, pri, vm_block, safepoint_check_allowed ) {      \
 176   var = new type(Mutex::pri, #var, vm_block, safepoint_check_allowed); \
 177   assert(_num_mutex < MAX_NUM_MUTEX, "increase MAX_NUM_MUTEX");        \
 178   _mutex_array[_num_mutex++] = var;                                      \
 179 }
 180 
 181 // Using Padded subclasses to prevent false sharing of these global monitors and mutexes.
 182 void mutex_init() {
 183   def(tty_lock                     , PaddedMutex  , event,       true,  Monitor::_safepoint_check_never);      // allow to lock in VM
 184 
 185   def(CGC_lock                     , PaddedMonitor, special,     true,  Monitor::_safepoint_check_never);      // coordinate between fore- and background GC
 186   def(STS_lock                     , PaddedMonitor, leaf,        true,  Monitor::_safepoint_check_never);
 187 
 188   def(VMWeakAlloc_lock             , PaddedMutex  , vmweak,      true,  Monitor::_safepoint_check_never);
 189   def(VMWeakActive_lock            , PaddedMutex  , vmweak-1,    true,  Monitor::_safepoint_check_never);
 190 
 191   def(StringTableWeakAlloc_lock    , PaddedMutex  , vmweak,      true,  Monitor::_safepoint_check_never);
 192   def(StringTableWeakActive_lock   , PaddedMutex  , vmweak-1,    true,  Monitor::_safepoint_check_never);
 193 
 194   if (UseConcMarkSweepGC || UseG1GC) {
 195     def(FullGCCount_lock           , PaddedMonitor, leaf,        true,  Monitor::_safepoint_check_never);      // in support of ExplicitGCInvokesConcurrent
 196   }
 197   if (UseG1GC) {
 198     def(SATB_Q_FL_lock             , PaddedMutex  , access,      true,  Monitor::_safepoint_check_never);
 199     def(SATB_Q_CBL_mon             , PaddedMonitor, access,      true,  Monitor::_safepoint_check_never);
 200     def(Shared_SATB_Q_lock         , PaddedMutex  , access + 1,  true,  Monitor::_safepoint_check_never);
 201 
 202     def(DirtyCardQ_FL_lock         , PaddedMutex  , access,      true,  Monitor::_safepoint_check_never);
 203     def(DirtyCardQ_CBL_mon         , PaddedMonitor, access,      true,  Monitor::_safepoint_check_never);
 204     def(Shared_DirtyCardQ_lock     , PaddedMutex  , access + 1,  true,  Monitor::_safepoint_check_never);
 205 
 206     def(FreeList_lock              , PaddedMutex  , leaf     ,   true,  Monitor::_safepoint_check_never);
 207     def(OldSets_lock               , PaddedMutex  , leaf     ,   true,  Monitor::_safepoint_check_never);
 208     def(RootRegionScan_lock        , PaddedMonitor, leaf     ,   true,  Monitor::_safepoint_check_never);
 209 
 210     def(StringDedupQueue_lock      , PaddedMonitor, leaf,        true,  Monitor::_safepoint_check_never);
 211     def(StringDedupTable_lock      , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_never);
 212 


< prev index next >