< prev index next >

src/hotspot/share/runtime/mutexLocker.cpp

Print this page
rev 54697 : imported patch 8221734-v2-merge


  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;


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


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




  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;


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

 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);


< prev index next >