< prev index next >

src/hotspot/share/runtime/mutexLocker.cpp

Print this page
rev 56251 : imported patch 8226705-v1
rev 56252 : imported patch 8226705-v2


  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*   JNIHandleBlockFreeList_lock  = NULL;
  50 Mutex*   JmethodIdCreation_lock       = NULL;
  51 Mutex*   JfieldIdCreation_lock        = NULL;
  52 Monitor* JNICritical_lock             = NULL;
  53 Mutex*   JvmtiThreadState_lock        = NULL;
  54 Monitor* Heap_lock                    = NULL;
  55 Mutex*   ExpandHeap_lock              = NULL;
  56 Mutex*   AdapterHandlerLibrary_lock   = NULL;
  57 Mutex*   SignatureHandlerLibrary_lock = NULL;
  58 Mutex*   VtableStubs_lock             = NULL;
  59 Mutex*   SymbolArena_lock             = NULL;
  60 Monitor* StringDedupQueue_lock        = NULL;
  61 Mutex*   StringDedupTable_lock        = NULL;


  76 Mutex*   Shared_DirtyCardQ_lock       = NULL;
  77 Mutex*   MarkStackFreeList_lock       = NULL;
  78 Mutex*   MarkStackChunkList_lock      = NULL;
  79 Mutex*   MonitoringSupport_lock       = NULL;
  80 Mutex*   ParGCRareEvent_lock          = NULL;
  81 Monitor* CGCPhaseManager_lock         = NULL;
  82 Mutex*   Compile_lock                 = NULL;
  83 Monitor* MethodCompileQueue_lock      = NULL;
  84 Monitor* CompileThread_lock           = NULL;
  85 Monitor* Compilation_lock             = NULL;
  86 Mutex*   CompileTaskAlloc_lock        = NULL;
  87 Mutex*   CompileStatistics_lock       = NULL;
  88 Mutex*   DirectivesStack_lock         = NULL;
  89 Mutex*   MultiArray_lock              = NULL;
  90 Monitor* Terminator_lock              = NULL;
  91 Monitor* InitCompleted_lock           = NULL;
  92 Monitor* BeforeExit_lock              = NULL;
  93 Monitor* Notify_lock                  = NULL;
  94 Mutex*   ProfilePrint_lock            = NULL;
  95 Mutex*   ExceptionCache_lock          = NULL;
  96 Mutex*   OsrList_lock                 = NULL;
  97 Mutex*   NMethodSweeperStats_lock     = NULL;
  98 #ifndef PRODUCT
  99 Mutex*   FullGCALot_lock              = NULL;
 100 #endif
 101 
 102 Mutex*   Debug1_lock                  = NULL;
 103 Mutex*   Debug2_lock                  = NULL;
 104 Mutex*   Debug3_lock                  = NULL;
 105 
 106 Mutex*   tty_lock                     = NULL;
 107 
 108 Mutex*   RawMonitor_lock              = NULL;
 109 Mutex*   PerfDataMemAlloc_lock        = NULL;
 110 Mutex*   PerfDataManager_lock         = NULL;
 111 Mutex*   OopMapCacheAlloc_lock        = NULL;
 112 
 113 Mutex*   FreeList_lock                = NULL;
 114 Mutex*   OldSets_lock                 = NULL;
 115 Monitor* RootRegionScan_lock          = NULL;
 116 


 216 
 217     def(MarkStackFreeList_lock     , PaddedMutex  , leaf     ,   true,  Monitor::_safepoint_check_never);
 218     def(MarkStackChunkList_lock    , PaddedMutex  , leaf     ,   true,  Monitor::_safepoint_check_never);
 219 
 220     def(MonitoringSupport_lock     , PaddedMutex  , native   ,   true,  Monitor::_safepoint_check_never);      // used for serviceability monitoring support
 221   }
 222   if (UseShenandoahGC) {
 223     def(StringDedupQueue_lock      , PaddedMonitor, leaf,        true,  Monitor::_safepoint_check_never);
 224     def(StringDedupTable_lock      , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_never);
 225   }
 226   def(ParGCRareEvent_lock          , PaddedMutex  , leaf     ,   true,  Monitor::_safepoint_check_always);
 227   def(CGCPhaseManager_lock         , PaddedMonitor, leaf,        false, Monitor::_safepoint_check_always);
 228   def(CodeCache_lock               , PaddedMonitor, special,     true,  Monitor::_safepoint_check_never);
 229   def(RawMonitor_lock              , PaddedMutex  , special,     true,  Monitor::_safepoint_check_never);
 230   def(OopMapCacheAlloc_lock        , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_always); // used for oop_map_cache allocation.
 231 
 232   def(MetaspaceExpand_lock         , PaddedMutex  , leaf-1,      true,  Monitor::_safepoint_check_never);
 233   def(ClassLoaderDataGraph_lock    , PaddedMutex  , nonleaf,     true,  Monitor::_safepoint_check_always);
 234 
 235   def(Patching_lock                , PaddedMutex  , special,     true,  Monitor::_safepoint_check_never);      // used for safepointing and code patching.

 236   def(Service_lock                 , PaddedMonitor, special,     true,  Monitor::_safepoint_check_never);      // used for service thread operations
 237   def(JmethodIdCreation_lock       , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_always); // used for creating jmethodIDs.
 238 
 239   def(SystemDictionary_lock        , PaddedMonitor, leaf,        true,  Monitor::_safepoint_check_always);
 240   def(ProtectionDomainSet_lock     , PaddedMutex  , leaf-1,      true,  Monitor::_safepoint_check_never);
 241   def(SharedDictionary_lock        , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_always);
 242   def(Module_lock                  , PaddedMutex  , leaf+2,      true,  Monitor::_safepoint_check_always);
 243   def(InlineCacheBuffer_lock       , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_never);
 244   def(VMStatistic_lock             , PaddedMutex  , leaf,        false, Monitor::_safepoint_check_always);
 245   def(ExpandHeap_lock              , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_always); // Used during compilation by VM thread
 246   def(JNIHandleBlockFreeList_lock  , PaddedMutex  , leaf-1,      true,  Monitor::_safepoint_check_never);      // handles are used by VM thread
 247   def(SignatureHandlerLibrary_lock , PaddedMutex  , leaf,        false, Monitor::_safepoint_check_always);
 248   def(SymbolArena_lock             , PaddedMutex  , leaf+2,      true,  Monitor::_safepoint_check_never);
 249   def(ProfilePrint_lock            , PaddedMutex  , leaf,        false, Monitor::_safepoint_check_always); // serial profile printing
 250   def(ExceptionCache_lock          , PaddedMutex  , leaf,        false, Monitor::_safepoint_check_always); // serial profile printing
 251   def(OsrList_lock                 , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_never);
 252   def(Debug1_lock                  , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_never);
 253 #ifndef PRODUCT
 254   def(FullGCALot_lock              , PaddedMutex  , leaf,        false, Monitor::_safepoint_check_always); // a lock to make FullGCALot MT safe
 255 #endif
 256   def(BeforeExit_lock              , PaddedMonitor, leaf,        true,  Monitor::_safepoint_check_always);
 257   def(PerfDataMemAlloc_lock        , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_always); // used for allocating PerfData memory for performance data
 258   def(PerfDataManager_lock         , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_always); // used for synchronized access to PerfDataManager resources
 259 
 260   // CMS_modUnionTable_lock                   leaf
 261   // CMS_bitMap_lock                          leaf 1
 262   // CMS_freeList_lock                        leaf 2
 263 
 264   def(Threads_lock                 , PaddedMonitor, barrier,     true,  Monitor::_safepoint_check_always);  // Used for safepoint protocol.
 265   def(NonJavaThreadsList_lock      , PaddedMutex,   leaf,        true,  Monitor::_safepoint_check_never);
 266   def(NonJavaThreadsListSync_lock  , PaddedMutex,   leaf,        true,  Monitor::_safepoint_check_never);
 267 
 268   def(VMOperationQueue_lock        , PaddedMonitor, nonleaf,     true,  Monitor::_safepoint_check_never);  // VM_thread allowed to block on these
 269   def(VMOperationRequest_lock      , PaddedMonitor, nonleaf,     true,  Monitor::_safepoint_check_always);
 270   def(RetData_lock                 , PaddedMutex  , nonleaf,     false, Monitor::_safepoint_check_always);
 271   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*   JNIHandleBlockFreeList_lock  = NULL;
  51 Mutex*   JmethodIdCreation_lock       = NULL;
  52 Mutex*   JfieldIdCreation_lock        = NULL;
  53 Monitor* JNICritical_lock             = NULL;
  54 Mutex*   JvmtiThreadState_lock        = NULL;
  55 Monitor* Heap_lock                    = NULL;
  56 Mutex*   ExpandHeap_lock              = NULL;
  57 Mutex*   AdapterHandlerLibrary_lock   = NULL;
  58 Mutex*   SignatureHandlerLibrary_lock = NULL;
  59 Mutex*   VtableStubs_lock             = NULL;
  60 Mutex*   SymbolArena_lock             = NULL;
  61 Monitor* StringDedupQueue_lock        = NULL;
  62 Mutex*   StringDedupTable_lock        = NULL;


  77 Mutex*   Shared_DirtyCardQ_lock       = NULL;
  78 Mutex*   MarkStackFreeList_lock       = NULL;
  79 Mutex*   MarkStackChunkList_lock      = NULL;
  80 Mutex*   MonitoringSupport_lock       = NULL;
  81 Mutex*   ParGCRareEvent_lock          = NULL;
  82 Monitor* CGCPhaseManager_lock         = NULL;
  83 Mutex*   Compile_lock                 = NULL;
  84 Monitor* MethodCompileQueue_lock      = NULL;
  85 Monitor* CompileThread_lock           = NULL;
  86 Monitor* Compilation_lock             = NULL;
  87 Mutex*   CompileTaskAlloc_lock        = NULL;
  88 Mutex*   CompileStatistics_lock       = NULL;
  89 Mutex*   DirectivesStack_lock         = NULL;
  90 Mutex*   MultiArray_lock              = NULL;
  91 Monitor* Terminator_lock              = NULL;
  92 Monitor* InitCompleted_lock           = NULL;
  93 Monitor* BeforeExit_lock              = NULL;
  94 Monitor* Notify_lock                  = NULL;
  95 Mutex*   ProfilePrint_lock            = NULL;
  96 Mutex*   ExceptionCache_lock          = NULL;

  97 Mutex*   NMethodSweeperStats_lock     = NULL;
  98 #ifndef PRODUCT
  99 Mutex*   FullGCALot_lock              = NULL;
 100 #endif
 101 
 102 Mutex*   Debug1_lock                  = NULL;
 103 Mutex*   Debug2_lock                  = NULL;
 104 Mutex*   Debug3_lock                  = NULL;
 105 
 106 Mutex*   tty_lock                     = NULL;
 107 
 108 Mutex*   RawMonitor_lock              = NULL;
 109 Mutex*   PerfDataMemAlloc_lock        = NULL;
 110 Mutex*   PerfDataManager_lock         = NULL;
 111 Mutex*   OopMapCacheAlloc_lock        = NULL;
 112 
 113 Mutex*   FreeList_lock                = NULL;
 114 Mutex*   OldSets_lock                 = NULL;
 115 Monitor* RootRegionScan_lock          = NULL;
 116 


 216 
 217     def(MarkStackFreeList_lock     , PaddedMutex  , leaf     ,   true,  Monitor::_safepoint_check_never);
 218     def(MarkStackChunkList_lock    , PaddedMutex  , leaf     ,   true,  Monitor::_safepoint_check_never);
 219 
 220     def(MonitoringSupport_lock     , PaddedMutex  , native   ,   true,  Monitor::_safepoint_check_never);      // used for serviceability monitoring support
 221   }
 222   if (UseShenandoahGC) {
 223     def(StringDedupQueue_lock      , PaddedMonitor, leaf,        true,  Monitor::_safepoint_check_never);
 224     def(StringDedupTable_lock      , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_never);
 225   }
 226   def(ParGCRareEvent_lock          , PaddedMutex  , leaf     ,   true,  Monitor::_safepoint_check_always);
 227   def(CGCPhaseManager_lock         , PaddedMonitor, leaf,        false, Monitor::_safepoint_check_always);
 228   def(CodeCache_lock               , PaddedMonitor, special,     true,  Monitor::_safepoint_check_never);
 229   def(RawMonitor_lock              , PaddedMutex  , special,     true,  Monitor::_safepoint_check_never);
 230   def(OopMapCacheAlloc_lock        , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_always); // used for oop_map_cache allocation.
 231 
 232   def(MetaspaceExpand_lock         , PaddedMutex  , leaf-1,      true,  Monitor::_safepoint_check_never);
 233   def(ClassLoaderDataGraph_lock    , PaddedMutex  , nonleaf,     true,  Monitor::_safepoint_check_always);
 234 
 235   def(Patching_lock                , PaddedMutex  , special,     true,  Monitor::_safepoint_check_never);      // used for safepointing and code patching.
 236   def(CompiledMethod_lock          , PaddedMutex  , special-1,   true,  Monitor::_safepoint_check_never);
 237   def(Service_lock                 , PaddedMonitor, special,     true,  Monitor::_safepoint_check_never);      // used for service thread operations
 238   def(JmethodIdCreation_lock       , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_always); // used for creating jmethodIDs.
 239 
 240   def(SystemDictionary_lock        , PaddedMonitor, leaf,        true,  Monitor::_safepoint_check_always);
 241   def(ProtectionDomainSet_lock     , PaddedMutex  , leaf-1,      true,  Monitor::_safepoint_check_never);
 242   def(SharedDictionary_lock        , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_always);
 243   def(Module_lock                  , PaddedMutex  , leaf+2,      true,  Monitor::_safepoint_check_always);
 244   def(InlineCacheBuffer_lock       , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_never);
 245   def(VMStatistic_lock             , PaddedMutex  , leaf,        false, Monitor::_safepoint_check_always);
 246   def(ExpandHeap_lock              , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_always); // Used during compilation by VM thread
 247   def(JNIHandleBlockFreeList_lock  , PaddedMutex  , leaf-1,      true,  Monitor::_safepoint_check_never);      // handles are used by VM thread
 248   def(SignatureHandlerLibrary_lock , PaddedMutex  , leaf,        false, Monitor::_safepoint_check_always);
 249   def(SymbolArena_lock             , PaddedMutex  , leaf+2,      true,  Monitor::_safepoint_check_never);
 250   def(ProfilePrint_lock            , PaddedMutex  , leaf,        false, Monitor::_safepoint_check_always); // serial profile printing
 251   def(ExceptionCache_lock          , PaddedMutex  , leaf,        false, Monitor::_safepoint_check_always); // serial profile printing

 252   def(Debug1_lock                  , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_never);
 253 #ifndef PRODUCT
 254   def(FullGCALot_lock              , PaddedMutex  , leaf,        false, Monitor::_safepoint_check_always); // a lock to make FullGCALot MT safe
 255 #endif
 256   def(BeforeExit_lock              , PaddedMonitor, leaf,        true,  Monitor::_safepoint_check_always);
 257   def(PerfDataMemAlloc_lock        , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_always); // used for allocating PerfData memory for performance data
 258   def(PerfDataManager_lock         , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_always); // used for synchronized access to PerfDataManager resources
 259 
 260   // CMS_modUnionTable_lock                   leaf
 261   // CMS_bitMap_lock                          leaf 1
 262   // CMS_freeList_lock                        leaf 2
 263 
 264   def(Threads_lock                 , PaddedMonitor, barrier,     true,  Monitor::_safepoint_check_always);  // Used for safepoint protocol.
 265   def(NonJavaThreadsList_lock      , PaddedMutex,   leaf,        true,  Monitor::_safepoint_check_never);
 266   def(NonJavaThreadsListSync_lock  , PaddedMutex,   leaf,        true,  Monitor::_safepoint_check_never);
 267 
 268   def(VMOperationQueue_lock        , PaddedMonitor, nonleaf,     true,  Monitor::_safepoint_check_never);  // VM_thread allowed to block on these
 269   def(VMOperationRequest_lock      , PaddedMonitor, nonleaf,     true,  Monitor::_safepoint_check_always);
 270   def(RetData_lock                 , PaddedMutex  , nonleaf,     false, Monitor::_safepoint_check_always);
 271   def(Terminator_lock              , PaddedMonitor, nonleaf,     true,  Monitor::_safepoint_check_always);


< prev index next >