8047290: Make Mutex::_no_safepoint_check_flag locks verify that this lock never checks for safepoint

Ensure consistent safepoint checking in Mutex/Monitor locking methods.

Reviewed-by: dholmes, dcubed, coleenp
This commit is contained in:
Max Ockner 2014-12-11 21:34:43 -05:00 committed by Coleen Phillimore
parent bb30bd7e0a
commit 1d76295d70
32 changed files with 447 additions and 134 deletions

View file

@ -167,131 +167,133 @@ void assert_lock_strong(const Monitor * lock) {
}
#endif
#define def(var, type, pri, vm_block) { \
var = new type(Mutex::pri, #var, vm_block); \
assert(_num_mutex < MAX_NUM_MUTEX, \
"increase MAX_NUM_MUTEX"); \
_mutex_array[_num_mutex++] = var; \
#define def(var, type, pri, vm_block, safepoint_check_allowed ) { \
var = new type(Mutex::pri, #var, vm_block, safepoint_check_allowed); \
assert(_num_mutex < MAX_NUM_MUTEX, "increase MAX_NUM_MUTEX"); \
_mutex_array[_num_mutex] = var; \
}
void mutex_init() {
def(tty_lock , Mutex , event, true ); // allow to lock in VM
def(tty_lock , Mutex , event, true, Monitor::_safepoint_check_never); // allow to lock in VM
def(CGC_lock , Monitor, special, true, Monitor::_safepoint_check_never); // coordinate between fore- and background GC
def(STS_lock , Monitor, leaf, true, Monitor::_safepoint_check_never);
def(CGC_lock , Monitor, special, true ); // coordinate between fore- and background GC
def(STS_lock , Monitor, leaf, true );
if (UseConcMarkSweepGC || UseG1GC) {
def(FullGCCount_lock , Monitor, leaf, true ); // in support of ExplicitGCInvokesConcurrent
def(FullGCCount_lock , Monitor, leaf, true, Monitor::_safepoint_check_never); // in support of ExplicitGCInvokesConcurrent
}
if (UseG1GC) {
def(CMark_lock , Monitor, nonleaf, true ); // coordinate concurrent mark thread
def(CMRegionStack_lock , Mutex, leaf, true );
def(SATB_Q_FL_lock , Mutex , special, true );
def(SATB_Q_CBL_mon , Monitor, nonleaf, true );
def(Shared_SATB_Q_lock , Mutex, nonleaf, true );
def(DirtyCardQ_FL_lock , Mutex , special, true );
def(DirtyCardQ_CBL_mon , Monitor, nonleaf, true );
def(Shared_DirtyCardQ_lock , Mutex, nonleaf, true );
def(CMark_lock , Monitor, nonleaf, true, Monitor::_safepoint_check_never); // coordinate concurrent mark thread
def(CMRegionStack_lock , Mutex, leaf, true, Monitor::_safepoint_check_never);
def(SATB_Q_FL_lock , Mutex , special, true, Monitor::_safepoint_check_never);
def(SATB_Q_CBL_mon , Monitor, nonleaf, true, Monitor::_safepoint_check_never);
def(Shared_SATB_Q_lock , Mutex, nonleaf, true, Monitor::_safepoint_check_never);
def(FreeList_lock , Mutex, leaf , true );
def(SecondaryFreeList_lock , Monitor, leaf , true );
def(OldSets_lock , Mutex , leaf , true );
def(RootRegionScan_lock , Monitor, leaf , true );
def(MMUTracker_lock , Mutex , leaf , true );
def(HotCardCache_lock , Mutex , special , true );
def(EvacFailureStack_lock , Mutex , nonleaf , true );
def(DirtyCardQ_FL_lock , Mutex , special, true, Monitor::_safepoint_check_never);
def(DirtyCardQ_CBL_mon , Monitor, nonleaf, true, Monitor::_safepoint_check_never);
def(Shared_DirtyCardQ_lock , Mutex, nonleaf, true, Monitor::_safepoint_check_never);
def(StringDedupQueue_lock , Monitor, leaf, true );
def(StringDedupTable_lock , Mutex , leaf, true );
def(FreeList_lock , Mutex, leaf , true, Monitor::_safepoint_check_never);
def(SecondaryFreeList_lock , Monitor, leaf , true, Monitor::_safepoint_check_never);
def(OldSets_lock , Mutex , leaf , true, Monitor::_safepoint_check_never);
def(RootRegionScan_lock , Monitor, leaf , true, Monitor::_safepoint_check_never);
def(MMUTracker_lock , Mutex , leaf , true, Monitor::_safepoint_check_never);
def(HotCardCache_lock , Mutex , special , true, Monitor::_safepoint_check_never);
def(EvacFailureStack_lock , Mutex , nonleaf , true, Monitor::_safepoint_check_never);
def(StringDedupQueue_lock , Monitor, leaf, true, Monitor::_safepoint_check_never);
def(StringDedupTable_lock , Mutex , leaf, true, Monitor::_safepoint_check_never);
}
def(ParGCRareEvent_lock , Mutex , leaf , true );
def(DerivedPointerTableGC_lock , Mutex, leaf, true );
def(CodeCache_lock , Monitor, special, true );
def(Interrupt_lock , Monitor, special, true ); // used for interrupt processing
def(RawMonitor_lock , Mutex, special, true );
def(OopMapCacheAlloc_lock , Mutex, leaf, true ); // used for oop_map_cache allocation.
def(ParGCRareEvent_lock , Mutex , leaf , true, Monitor::_safepoint_check_sometimes);
def(DerivedPointerTableGC_lock , Mutex, leaf, true, Monitor::_safepoint_check_never);
def(CodeCache_lock , Mutex , special, true, Monitor::_safepoint_check_never);
def(Interrupt_lock , Monitor, special, true, Monitor::_safepoint_check_never); // used for interrupt processing
def(RawMonitor_lock , Mutex, special, true, Monitor::_safepoint_check_never);
def(OopMapCacheAlloc_lock , Mutex, leaf, true, Monitor::_safepoint_check_always); // used for oop_map_cache allocation.
def(Patching_lock , Mutex , special, true ); // used for safepointing and code patching.
def(ObjAllocPost_lock , Monitor, special, false);
def(Service_lock , Monitor, special, true ); // used for service thread operations
def(JmethodIdCreation_lock , Mutex , leaf, true ); // used for creating jmethodIDs.
def(Patching_lock , Mutex , special, true, Monitor::_safepoint_check_never); // used for safepointing and code patching.
def(ObjAllocPost_lock , Monitor, special, false, Monitor::_safepoint_check_never);
def(Service_lock , Monitor, special, true, Monitor::_safepoint_check_never); // used for service thread operations
def(JmethodIdCreation_lock , Mutex , leaf, true, Monitor::_safepoint_check_always); // used for creating jmethodIDs.
def(SystemDictionary_lock , Monitor, leaf, true ); // lookups done by VM thread
def(PackageTable_lock , Mutex , leaf, false);
def(InlineCacheBuffer_lock , Mutex , leaf, true );
def(VMStatistic_lock , Mutex , leaf, false);
def(ExpandHeap_lock , Mutex , leaf, true ); // Used during compilation by VM thread
def(JNIHandleBlockFreeList_lock , Mutex , leaf, true ); // handles are used by VM thread
def(SignatureHandlerLibrary_lock , Mutex , leaf, false);
def(SymbolTable_lock , Mutex , leaf+2, true );
def(StringTable_lock , Mutex , leaf, true );
def(ProfilePrint_lock , Mutex , leaf, false); // serial profile printing
def(ExceptionCache_lock , Mutex , leaf, false); // serial profile printing
def(OsrList_lock , Mutex , leaf, true );
def(Debug1_lock , Mutex , leaf, true );
def(SystemDictionary_lock , Monitor, leaf, true, Monitor::_safepoint_check_always); // lookups done by VM thread
def(PackageTable_lock , Mutex , leaf, false, Monitor::_safepoint_check_always);
def(InlineCacheBuffer_lock , Mutex , leaf, true, Monitor::_safepoint_check_always);
def(VMStatistic_lock , Mutex , leaf, false, Monitor::_safepoint_check_always);
def(ExpandHeap_lock , Mutex , leaf, true, Monitor::_safepoint_check_always); // Used during compilation by VM thread
def(JNIHandleBlockFreeList_lock , Mutex , leaf, true, Monitor::_safepoint_check_never); // handles are used by VM thread
def(SignatureHandlerLibrary_lock , Mutex , leaf, false, Monitor::_safepoint_check_always);
def(SymbolTable_lock , Mutex , leaf+2, true, Monitor::_safepoint_check_always);
def(StringTable_lock , Mutex , leaf, true, Monitor::_safepoint_check_always);
def(ProfilePrint_lock , Mutex , leaf, false, Monitor::_safepoint_check_always); // serial profile printing
def(ExceptionCache_lock , Mutex , leaf, false, Monitor::_safepoint_check_always); // serial profile printing
def(OsrList_lock , Mutex , leaf, true, Monitor::_safepoint_check_never);
def(Debug1_lock , Mutex , leaf, true, Monitor::_safepoint_check_never);
#ifndef PRODUCT
def(FullGCALot_lock , Mutex , leaf, false); // a lock to make FullGCALot MT safe
def(FullGCALot_lock , Mutex , leaf, false, Monitor::_safepoint_check_always); // a lock to make FullGCALot MT safe
#endif
def(BeforeExit_lock , Monitor, leaf, true );
def(PerfDataMemAlloc_lock , Mutex , leaf, true ); // used for allocating PerfData memory for performance data
def(PerfDataManager_lock , Mutex , leaf, true ); // used for synchronized access to PerfDataManager resources
def(BeforeExit_lock , Monitor, leaf, true, Monitor::_safepoint_check_always);
def(PerfDataMemAlloc_lock , Mutex , leaf, true, Monitor::_safepoint_check_always); // used for allocating PerfData memory for performance data
def(PerfDataManager_lock , Mutex , leaf, true, Monitor::_safepoint_check_always); // used for synchronized access to PerfDataManager resources
// CMS_modUnionTable_lock leaf
// CMS_bitMap_lock leaf + 1
// CMS_freeList_lock leaf + 2
// CMS_bitMap_lock leaf 1
// CMS_freeList_lock leaf 2
def(Safepoint_lock , Monitor, safepoint, true ); // locks SnippetCache_lock/Threads_lock
def(Safepoint_lock , Monitor, safepoint, true, Monitor::_safepoint_check_sometimes); // locks SnippetCache_lock/Threads_lock
def(Threads_lock , Monitor, barrier, true );
def(Threads_lock , Monitor, barrier, true, Monitor::_safepoint_check_sometimes);
def(VMOperationQueue_lock , Monitor, nonleaf, true ); // VM_thread allowed to block on these
def(VMOperationRequest_lock , Monitor, nonleaf, true );
def(RetData_lock , Mutex , nonleaf, false);
def(Terminator_lock , Monitor, nonleaf, true );
def(VtableStubs_lock , Mutex , nonleaf, true );
def(Notify_lock , Monitor, nonleaf, true );
def(JNIGlobalHandle_lock , Mutex , nonleaf, true ); // locks JNIHandleBlockFreeList_lock
def(JNICritical_lock , Monitor, nonleaf, true ); // used for JNI critical regions
def(AdapterHandlerLibrary_lock , Mutex , nonleaf, true);
def(VMOperationQueue_lock , Monitor, nonleaf, true, Monitor::_safepoint_check_sometimes); // VM_thread allowed to block on these
def(VMOperationRequest_lock , Monitor, nonleaf, true, Monitor::_safepoint_check_sometimes);
def(RetData_lock , Mutex , nonleaf, false, Monitor::_safepoint_check_always);
def(Terminator_lock , Monitor, nonleaf, true, Monitor::_safepoint_check_sometimes);
def(VtableStubs_lock , Mutex , nonleaf, true, Monitor::_safepoint_check_always);
def(Notify_lock , Monitor, nonleaf, true, Monitor::_safepoint_check_always);
def(JNIGlobalHandle_lock , Mutex , nonleaf, true, Monitor::_safepoint_check_always); // locks JNIHandleBlockFreeList_lock
def(JNICritical_lock , Monitor, nonleaf, true, Monitor::_safepoint_check_always); // used for JNI critical regions
def(AdapterHandlerLibrary_lock , Mutex , nonleaf, true, Monitor::_safepoint_check_always);
if (UseConcMarkSweepGC) {
def(SLT_lock , Monitor, nonleaf, false );
// used in CMS GC for locking PLL lock
def(SLT_lock , Monitor, nonleaf, false, Monitor::_safepoint_check_never); // used in CMS GC for locking PLL lock
}
def(Heap_lock , Monitor, nonleaf+1, false);
def(JfieldIdCreation_lock , Mutex , nonleaf+1, true ); // jfieldID, Used in VM_Operation
def(MemberNameTable_lock , Mutex , nonleaf+1, false); // Used to protect MemberNameTable
def(CompiledIC_lock , Mutex , nonleaf+2, false); // locks VtableStubs_lock, InlineCacheBuffer_lock
def(CompileTaskAlloc_lock , Mutex , nonleaf+2, true );
def(CompileStatistics_lock , Mutex , nonleaf+2, false);
def(MultiArray_lock , Mutex , nonleaf+2, false); // locks SymbolTable_lock
def(Heap_lock , Monitor, nonleaf+1, false, Monitor::_safepoint_check_sometimes);
def(JfieldIdCreation_lock , Mutex , nonleaf+1, true, Monitor::_safepoint_check_always); // jfieldID, Used in VM_Operation
def(MemberNameTable_lock , Mutex , nonleaf+1, false, Monitor::_safepoint_check_always); // Used to protect MemberNameTable
def(JvmtiThreadState_lock , Mutex , nonleaf+2, false); // Used by JvmtiThreadState/JvmtiEventController
def(JvmtiPendingEvent_lock , Monitor, nonleaf, false); // Used by JvmtiCodeBlobEvents
def(Management_lock , Mutex , nonleaf+2, false); // used for JVM management
def(CompiledIC_lock , Mutex , nonleaf+2, false, Monitor::_safepoint_check_always); // locks VtableStubs_lock, InlineCacheBuffer_lock
def(CompileTaskAlloc_lock , Mutex , nonleaf+2, true, Monitor::_safepoint_check_always);
def(CompileStatistics_lock , Mutex , nonleaf+2, false, Monitor::_safepoint_check_always);
def(MultiArray_lock , Mutex , nonleaf+2, false, Monitor::_safepoint_check_always); // locks SymbolTable_lock
def(Compile_lock , Mutex , nonleaf+3, true );
def(MethodData_lock , Mutex , nonleaf+3, false);
def(JvmtiThreadState_lock , Mutex , nonleaf+2, false, Monitor::_safepoint_check_always); // Used by JvmtiThreadState/JvmtiEventController
def(JvmtiPendingEvent_lock , Monitor, nonleaf, false, Monitor::_safepoint_check_never); // Used by JvmtiCodeBlobEvents
def(Management_lock , Mutex , nonleaf+2, false, Monitor::_safepoint_check_always); // used for JVM management
def(MethodCompileQueue_lock , Monitor, nonleaf+4, true );
def(Debug2_lock , Mutex , nonleaf+4, true );
def(Debug3_lock , Mutex , nonleaf+4, true );
def(ProfileVM_lock , Monitor, special, false); // used for profiling of the VMThread
def(CompileThread_lock , Monitor, nonleaf+5, false );
def(PeriodicTask_lock , Monitor, nonleaf+5, true);
def(Compile_lock , Mutex , nonleaf+3, true, Monitor::_safepoint_check_sometimes);
def(MethodData_lock , Mutex , nonleaf+3, false, Monitor::_safepoint_check_always);
def(MethodCompileQueue_lock , Monitor, nonleaf+4, true, Monitor::_safepoint_check_always);
def(Debug2_lock , Mutex , nonleaf+4, true, Monitor::_safepoint_check_never);
def(Debug3_lock , Mutex , nonleaf+4, true, Monitor::_safepoint_check_never);
def(ProfileVM_lock , Monitor, special, false, Monitor::_safepoint_check_never); // used for profiling of the VMThread
def(CompileThread_lock , Monitor, nonleaf+5, false, Monitor::_safepoint_check_always);
def(PeriodicTask_lock , Monitor, nonleaf+5, true, Monitor::_safepoint_check_sometimes);
if (WhiteBoxAPI) {
def(Compilation_lock , Monitor, leaf, false );
def(Compilation_lock , Monitor, leaf, false, Monitor::_safepoint_check_never);
}
#ifdef INCLUDE_TRACE
def(JfrMsg_lock , Monitor, leaf, true);
def(JfrBuffer_lock , Mutex, leaf, true);
def(JfrThreadGroups_lock , Mutex, leaf, true);
def(JfrStream_lock , Mutex, nonleaf, true);
def(JfrStacktrace_lock , Mutex, special, true);
def(JfrMsg_lock , Monitor, leaf, true, Monitor::_safepoint_check_always);
def(JfrBuffer_lock , Mutex, leaf, true, Monitor::_safepoint_check_never);
def(JfrThreadGroups_lock , Mutex, leaf, true, Monitor::_safepoint_check_always);
def(JfrStream_lock , Mutex, nonleaf, true, Monitor::_safepoint_check_never);
def(JfrStacktrace_lock , Mutex, special, true, Monitor::_safepoint_check_sometimes);
#endif
#ifndef SUPPORTS_NATIVE_CX8
def(UnsafeJlong_lock , Mutex, special, false);
def(UnsafeJlong_lock , Mutex, special, false, Monitor::_safepoint_check_never);
#endif
}