< prev index next >

src/hotspot/share/runtime/mutexLocker.cpp

Print this page
rev 54621 : imported patch 8221734-v1


  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "runtime/mutexLocker.hpp"
  27 #include "runtime/os.inline.hpp"
  28 #include "runtime/safepoint.hpp"
  29 #include "runtime/thread.inline.hpp"
  30 #include "runtime/vmThread.hpp"
  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*   ProtectionDomainSet_lock     = NULL;
  43 Mutex*   SharedDictionary_lock        = NULL;
  44 Mutex*   Module_lock                  = NULL;
  45 Mutex*   CompiledIC_lock              = NULL;
  46 Mutex*   InlineCacheBuffer_lock       = NULL;
  47 Mutex*   VMStatistic_lock             = NULL;
  48 Mutex*   JNIGlobalAlloc_lock          = NULL;
  49 Mutex*   JNIGlobalActive_lock         = NULL;
  50 Mutex*   JNIWeakAlloc_lock            = NULL;
  51 Mutex*   JNIWeakActive_lock           = NULL;
  52 Mutex*   StringTableWeakAlloc_lock    = NULL;
  53 Mutex*   StringTableWeakActive_lock   = NULL;
  54 Mutex*   JNIHandleBlockFreeList_lock  = NULL;
  55 Mutex*   VMWeakAlloc_lock             = NULL;
  56 Mutex*   VMWeakActive_lock            = NULL;
  57 Mutex*   ResolvedMethodTableWeakAlloc_lock  = NULL;
  58 Mutex*   ResolvedMethodTableWeakActive_lock = NULL;
  59 Mutex*   JmethodIdCreation_lock       = NULL;
  60 Mutex*   JfieldIdCreation_lock        = NULL;


 237 
 238     def(MonitoringSupport_lock     , PaddedMutex  , native   ,   true,  Monitor::_safepoint_check_never);      // used for serviceability monitoring support
 239   }
 240   if (UseShenandoahGC) {
 241     def(SATB_Q_CBL_mon             , PaddedMonitor, access,      true,  Monitor::_safepoint_check_never);
 242 
 243     def(StringDedupQueue_lock      , PaddedMonitor, leaf,        true,  Monitor::_safepoint_check_never);
 244     def(StringDedupTable_lock      , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_never);
 245   }
 246   def(ParGCRareEvent_lock          , PaddedMutex  , leaf     ,   true,  Monitor::_safepoint_check_sometimes);
 247   def(DerivedPointerTableGC_lock   , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_never);
 248   def(CGCPhaseManager_lock         , PaddedMonitor, leaf,        false, Monitor::_safepoint_check_sometimes);
 249   def(CodeCache_lock               , PaddedMutex  , special,     true,  Monitor::_safepoint_check_never);
 250   def(RawMonitor_lock              , PaddedMutex  , special,     true,  Monitor::_safepoint_check_never);
 251   def(OopMapCacheAlloc_lock        , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_always);     // used for oop_map_cache allocation.
 252 
 253   def(MetaspaceExpand_lock         , PaddedMutex  , leaf-1,      true,  Monitor::_safepoint_check_never);
 254   def(ClassLoaderDataGraph_lock    , PaddedMutex  , nonleaf,     true,  Monitor::_safepoint_check_always);
 255 
 256   def(Patching_lock                , PaddedMutex  , special,     true,  Monitor::_safepoint_check_never);      // used for safepointing and code patching.


 257   def(Service_lock                 , PaddedMonitor, special,     true,  Monitor::_safepoint_check_never);      // used for service thread operations
 258   def(JmethodIdCreation_lock       , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_always);     // used for creating jmethodIDs.
 259 
 260   def(SystemDictionary_lock        , PaddedMonitor, leaf,        true,  Monitor::_safepoint_check_always);     // lookups done by VM thread
 261   def(ProtectionDomainSet_lock     , PaddedMutex  , leaf-1,      true,  Monitor::_safepoint_check_never);
 262   def(SharedDictionary_lock        , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_always);     // lookups done by VM thread
 263   def(Module_lock                  , PaddedMutex  , leaf+2,      true,  Monitor::_safepoint_check_always);
 264   def(InlineCacheBuffer_lock       , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_never);
 265   def(VMStatistic_lock             , PaddedMutex  , leaf,        false, Monitor::_safepoint_check_always);
 266   def(ExpandHeap_lock              , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_always);     // Used during compilation by VM thread
 267   def(JNIHandleBlockFreeList_lock  , PaddedMutex  , leaf-1,      true,  Monitor::_safepoint_check_never);      // handles are used by VM thread
 268   def(SignatureHandlerLibrary_lock , PaddedMutex  , leaf,        false, Monitor::_safepoint_check_always);
 269   def(SymbolArena_lock             , PaddedMutex  , leaf+2,      true,  Monitor::_safepoint_check_never);
 270   def(ProfilePrint_lock            , PaddedMutex  , leaf,        false, Monitor::_safepoint_check_always);     // serial profile printing
 271   def(ExceptionCache_lock          , PaddedMutex  , leaf,        false, Monitor::_safepoint_check_always);     // serial profile printing
 272   def(OsrList_lock                 , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_never);
 273   def(Debug1_lock                  , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_never);
 274 #ifndef PRODUCT
 275   def(FullGCALot_lock              , PaddedMutex  , leaf,        false, Monitor::_safepoint_check_always);     // a lock to make FullGCALot MT safe
 276 #endif
 277   def(BeforeExit_lock              , PaddedMonitor, leaf,        true,  Monitor::_safepoint_check_always);
 278   def(PerfDataMemAlloc_lock        , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_always);     // used for allocating PerfData memory for performance data
 279   def(PerfDataManager_lock         , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_always);     // used for synchronized access to PerfDataManager resources
 280 
 281   // CMS_modUnionTable_lock                   leaf
 282   // CMS_bitMap_lock                          leaf 1
 283   // CMS_freeList_lock                        leaf 2
 284 
 285   def(Threads_lock                 , PaddedMonitor, barrier,     true,  Monitor::_safepoint_check_sometimes);
 286   def(NonJavaThreadsList_lock      , PaddedMutex,   leaf,        true,  Monitor::_safepoint_check_never);
 287   def(NonJavaThreadsListSync_lock  , PaddedMutex,   leaf,        true,  Monitor::_safepoint_check_never);
 288 
 289   def(VMOperationQueue_lock        , PaddedMonitor, nonleaf,     true,  Monitor::_safepoint_check_sometimes);  // VM_thread allowed to block on these
 290   def(VMOperationRequest_lock      , PaddedMonitor, nonleaf,     true,  Monitor::_safepoint_check_sometimes);
 291   def(RetData_lock                 , PaddedMutex  , nonleaf,     false, Monitor::_safepoint_check_always);
 292   def(Terminator_lock              , PaddedMonitor, nonleaf,     true,  Monitor::_safepoint_check_sometimes);




  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "runtime/mutexLocker.hpp"
  27 #include "runtime/os.inline.hpp"
  28 #include "runtime/safepoint.hpp"
  29 #include "runtime/thread.inline.hpp"
  30 #include "runtime/vmThread.hpp"
  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 Mutex*   CompiledMethod_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;


 238 
 239     def(MonitoringSupport_lock     , PaddedMutex  , native   ,   true,  Monitor::_safepoint_check_never);      // used for serviceability monitoring support
 240   }
 241   if (UseShenandoahGC) {
 242     def(SATB_Q_CBL_mon             , PaddedMonitor, access,      true,  Monitor::_safepoint_check_never);
 243 
 244     def(StringDedupQueue_lock      , PaddedMonitor, leaf,        true,  Monitor::_safepoint_check_never);
 245     def(StringDedupTable_lock      , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_never);
 246   }
 247   def(ParGCRareEvent_lock          , PaddedMutex  , leaf     ,   true,  Monitor::_safepoint_check_sometimes);
 248   def(DerivedPointerTableGC_lock   , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_never);
 249   def(CGCPhaseManager_lock         , PaddedMonitor, leaf,        false, Monitor::_safepoint_check_sometimes);
 250   def(CodeCache_lock               , PaddedMutex  , special,     true,  Monitor::_safepoint_check_never);
 251   def(RawMonitor_lock              , PaddedMutex  , special,     true,  Monitor::_safepoint_check_never);
 252   def(OopMapCacheAlloc_lock        , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_always);     // used for oop_map_cache allocation.
 253 
 254   def(MetaspaceExpand_lock         , PaddedMutex  , leaf-1,      true,  Monitor::_safepoint_check_never);
 255   def(ClassLoaderDataGraph_lock    , PaddedMutex  , nonleaf,     true,  Monitor::_safepoint_check_always);
 256 
 257   def(Patching_lock                , PaddedMutex  , special,     true,  Monitor::_safepoint_check_never);      // used for safepointing and code patching.
 258   def(OsrList_lock                 , PaddedMutex  , special-1,   true,  Monitor::_safepoint_check_never);
 259   def(CompiledMethod_lock          , PaddedMutex  , special-1,   true,  Monitor::_safepoint_check_never);
 260   def(Service_lock                 , PaddedMonitor, special,     true,  Monitor::_safepoint_check_never);      // used for service thread operations
 261   def(JmethodIdCreation_lock       , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_always);     // used for creating jmethodIDs.
 262 
 263   def(SystemDictionary_lock        , PaddedMonitor, leaf,        true,  Monitor::_safepoint_check_always);     // lookups done by VM thread
 264   def(ProtectionDomainSet_lock     , PaddedMutex  , leaf-1,      true,  Monitor::_safepoint_check_never);
 265   def(SharedDictionary_lock        , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_always);     // lookups done by VM thread
 266   def(Module_lock                  , PaddedMutex  , leaf+2,      true,  Monitor::_safepoint_check_always);
 267   def(InlineCacheBuffer_lock       , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_never);
 268   def(VMStatistic_lock             , PaddedMutex  , leaf,        false, Monitor::_safepoint_check_always);
 269   def(ExpandHeap_lock              , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_always);     // Used during compilation by VM thread
 270   def(JNIHandleBlockFreeList_lock  , PaddedMutex  , leaf-1,      true,  Monitor::_safepoint_check_never);      // handles are used by VM thread
 271   def(SignatureHandlerLibrary_lock , PaddedMutex  , leaf,        false, Monitor::_safepoint_check_always);
 272   def(SymbolArena_lock             , PaddedMutex  , leaf+2,      true,  Monitor::_safepoint_check_never);
 273   def(ProfilePrint_lock            , PaddedMutex  , leaf,        false, Monitor::_safepoint_check_always);     // serial profile printing
 274   def(ExceptionCache_lock          , PaddedMutex  , leaf,        false, Monitor::_safepoint_check_always);     // serial profile printing

 275   def(Debug1_lock                  , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_never);
 276 #ifndef PRODUCT
 277   def(FullGCALot_lock              , PaddedMutex  , leaf,        false, Monitor::_safepoint_check_always);     // a lock to make FullGCALot MT safe
 278 #endif
 279   def(BeforeExit_lock              , PaddedMonitor, leaf,        true,  Monitor::_safepoint_check_always);
 280   def(PerfDataMemAlloc_lock        , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_always);     // used for allocating PerfData memory for performance data
 281   def(PerfDataManager_lock         , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_always);     // used for synchronized access to PerfDataManager resources
 282 
 283   // CMS_modUnionTable_lock                   leaf
 284   // CMS_bitMap_lock                          leaf 1
 285   // CMS_freeList_lock                        leaf 2
 286 
 287   def(Threads_lock                 , PaddedMonitor, barrier,     true,  Monitor::_safepoint_check_sometimes);
 288   def(NonJavaThreadsList_lock      , PaddedMutex,   leaf,        true,  Monitor::_safepoint_check_never);
 289   def(NonJavaThreadsListSync_lock  , PaddedMutex,   leaf,        true,  Monitor::_safepoint_check_never);
 290 
 291   def(VMOperationQueue_lock        , PaddedMonitor, nonleaf,     true,  Monitor::_safepoint_check_sometimes);  // VM_thread allowed to block on these
 292   def(VMOperationRequest_lock      , PaddedMonitor, nonleaf,     true,  Monitor::_safepoint_check_sometimes);
 293   def(RetData_lock                 , PaddedMutex  , nonleaf,     false, Monitor::_safepoint_check_always);
 294   def(Terminator_lock              , PaddedMonitor, nonleaf,     true,  Monitor::_safepoint_check_sometimes);


< prev index next >