8273917: Remove 'leaf' ranking for Mutex
Reviewed-by: eosterlund, dholmes
This commit is contained in:
parent
c80a612709
commit
b8af6a9bfb
src/hotspot/share
compiler
gc
oops
runtime
services
test/hotspot/gtest/runtime
@ -104,7 +104,7 @@ class CompileTask : public CHeapObj<mtCompiler> {
|
||||
|
||||
public:
|
||||
CompileTask() : _failure_reason(NULL), _failure_reason_on_C_heap(false) {
|
||||
_lock = new Monitor(Mutex::nonleaf+2, "CompileTaskLock", Mutex::_safepoint_check_always);
|
||||
_lock = new Monitor(Mutex::nonleaf, "CompileTask_lock", Mutex::_safepoint_check_always);
|
||||
}
|
||||
|
||||
void initialize(int compile_id, const methodHandle& method, int osr_bci, int comp_level,
|
||||
|
@ -773,7 +773,7 @@ void OffsetTableContigSpace::alloc_block(HeapWord* start, HeapWord* end) {
|
||||
OffsetTableContigSpace::OffsetTableContigSpace(BlockOffsetSharedArray* sharedOffsetArray,
|
||||
MemRegion mr) :
|
||||
_offsets(sharedOffsetArray, mr),
|
||||
_par_alloc_lock(Mutex::leaf, "OffsetTableContigSpace par alloc lock",
|
||||
_par_alloc_lock(Mutex::nonleaf, "OffsetTableContigSpaceParAlloc_lock",
|
||||
Mutex::_safepoint_check_always, true)
|
||||
{
|
||||
_offsets.set_contig_space(this);
|
||||
|
@ -47,8 +47,8 @@
|
||||
|
||||
ShenandoahControlThread::ShenandoahControlThread() :
|
||||
ConcurrentGCThread(),
|
||||
_alloc_failure_waiters_lock(Mutex::leaf, "ShenandoahAllocFailureGC_lock", Monitor::_safepoint_check_always, true),
|
||||
_gc_waiters_lock(Mutex::leaf, "ShenandoahRequestedGC_lock", Monitor::_safepoint_check_always, true),
|
||||
_alloc_failure_waiters_lock(Mutex::nonleaf, "ShenandoahAllocFailureGC_lock", Monitor::_safepoint_check_always, true),
|
||||
_gc_waiters_lock(Mutex::nonleaf, "ShenandoahRequestedGC_lock", Monitor::_safepoint_check_always, true),
|
||||
_periodic_task(this),
|
||||
_requested_gc_cause(GCCause::_no_cause_specified),
|
||||
_degen_point(ShenandoahGC::_degenerated_outside_cycle),
|
||||
|
@ -67,7 +67,7 @@ public:
|
||||
_heap(heap),
|
||||
_last_time(os::elapsedTime()),
|
||||
_progress_history(new TruncatedSeq(5)),
|
||||
_wait_monitor(new Monitor(Mutex::leaf, "_wait_monitor", Monitor::_safepoint_check_always, true)),
|
||||
_wait_monitor(new Monitor(Mutex::nonleaf-1, "ShenandoahWaitMonitor_lock", Monitor::_safepoint_check_always, true)),
|
||||
_epoch(0),
|
||||
_tax_rate(1),
|
||||
_budget(0),
|
||||
|
@ -1206,7 +1206,8 @@ void MethodData::post_initialize(BytecodeStream* stream) {
|
||||
// Initialize the MethodData* corresponding to a given method.
|
||||
MethodData::MethodData(const methodHandle& method)
|
||||
: _method(method()),
|
||||
_extra_data_lock(Mutex::leaf, "MDO extra data lock", Mutex::_safepoint_check_always),
|
||||
// Holds Compile_lock
|
||||
_extra_data_lock(Mutex::nonleaf-2, "MDOExtraData_lock", Mutex::_safepoint_check_always),
|
||||
_compiler_counters(),
|
||||
_parameters_type_data_di(parameters_uninitialized) {
|
||||
initialize();
|
||||
|
@ -285,6 +285,8 @@ Mutex::Mutex(int Rank, const char * name, SafepointCheckRequired safepoint_check
|
||||
_safepoint_check_required = safepoint_check_required;
|
||||
_skip_rank_check = false;
|
||||
|
||||
assert(_rank >= 0 && _rank <= nonleaf, "Bad lock rank %d: %s", _rank, name);
|
||||
|
||||
assert(_rank > nosafepoint || _safepoint_check_required == _safepoint_check_never,
|
||||
"Locks below nosafepoint rank should never safepoint: %s", name);
|
||||
|
||||
@ -295,8 +297,6 @@ Mutex::Mutex(int Rank, const char * name, SafepointCheckRequired safepoint_check
|
||||
// allowing Java threads to block in native.
|
||||
assert(_safepoint_check_required == _safepoint_check_always || _allow_vm_block,
|
||||
"Safepoint check never locks should always allow the vm to block: %s", name);
|
||||
|
||||
assert(_rank >= 0, "Bad lock rank: %s", name);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -53,10 +53,8 @@ class Mutex : public CHeapObj<mtSynchronizer> {
|
||||
tty = stackwatermark + 3,
|
||||
oopstorage = tty + 3,
|
||||
nosafepoint = oopstorage + 6,
|
||||
leaf = nosafepoint + 6,
|
||||
barrier = leaf + 10,
|
||||
nonleaf = barrier + 1,
|
||||
max_nonleaf = nonleaf + 900
|
||||
nonleaf = nosafepoint + 20,
|
||||
max_nonleaf = nonleaf
|
||||
};
|
||||
|
||||
private:
|
||||
|
@ -194,12 +194,29 @@ void assert_locked_or_safepoint_or_handshake(const Mutex* lock, const JavaThread
|
||||
}
|
||||
#endif
|
||||
|
||||
static void add_mutex(Mutex* var) {
|
||||
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, Mutex::safepoint_check_allowed, vm_block); \
|
||||
assert(_num_mutex < MAX_NUM_MUTEX, "increase MAX_NUM_MUTEX"); \
|
||||
_mutex_array[_num_mutex++] = var; \
|
||||
add_mutex(var); \
|
||||
}
|
||||
|
||||
// Specify relative ranked lock
|
||||
#ifdef ASSERT
|
||||
#define defl(var, type, held_lock, vm_block, safepoint_check_allowed) { \
|
||||
var = new type(held_lock->rank()-1, #var, Mutex::safepoint_check_allowed, vm_block); \
|
||||
add_mutex(var); \
|
||||
}
|
||||
#else
|
||||
#define defl(var, type, held_lock, vm_block, safepoint_check_allowed) { \
|
||||
var = new type(Mutex::nonleaf, #var, Mutex::safepoint_check_allowed, vm_block); \
|
||||
add_mutex(var); \
|
||||
}
|
||||
#endif
|
||||
|
||||
// Using Padded subclasses to prevent false sharing of these global monitors and mutexes.
|
||||
void mutex_init() {
|
||||
def(tty_lock , PaddedMutex , tty, true, _safepoint_check_never); // allow to lock in VM
|
||||
@ -208,7 +225,6 @@ void mutex_init() {
|
||||
|
||||
if (UseG1GC) {
|
||||
def(CGC_lock , PaddedMonitor, nosafepoint, true, _safepoint_check_never);
|
||||
def(G1OldGCCount_lock , PaddedMonitor, leaf, true, _safepoint_check_always);
|
||||
|
||||
def(G1DetachedRefinementStats_lock, PaddedMutex, nosafepoint-2, true, _safepoint_check_never);
|
||||
|
||||
@ -224,17 +240,12 @@ void mutex_init() {
|
||||
}
|
||||
def(StringDedup_lock , PaddedMonitor, nosafepoint, true, _safepoint_check_never);
|
||||
def(StringDedupIntern_lock , PaddedMutex , nosafepoint, true, _safepoint_check_never);
|
||||
def(ParGCRareEvent_lock , PaddedMutex , leaf, true, _safepoint_check_always);
|
||||
def(CodeCache_lock , PaddedMonitor, nosafepoint-3, true, _safepoint_check_never);
|
||||
def(CodeSweeper_lock , PaddedMonitor, nosafepoint-5, true, _safepoint_check_never);
|
||||
def(ParGCRareEvent_lock , PaddedMutex , nonleaf, true, _safepoint_check_always);
|
||||
def(RawMonitor_lock , PaddedMutex , nosafepoint-1, true, _safepoint_check_never);
|
||||
def(OopMapCacheAlloc_lock , PaddedMutex , leaf, true, _safepoint_check_always); // used for oop_map_cache allocation.
|
||||
|
||||
def(Metaspace_lock , PaddedMutex , nosafepoint-3, true, _safepoint_check_never);
|
||||
def(ClassLoaderDataGraph_lock , PaddedMutex , nonleaf, false, _safepoint_check_always);
|
||||
|
||||
def(Patching_lock , PaddedMutex , nosafepoint, true, _safepoint_check_never); // used for safepointing and code patching.
|
||||
def(CompiledMethod_lock , PaddedMutex , nosafepoint-4, true, _safepoint_check_never);
|
||||
def(MonitorDeflation_lock , PaddedMonitor, nosafepoint, true, _safepoint_check_never); // used for monitor deflation thread operations
|
||||
def(Service_lock , PaddedMonitor, service, true, _safepoint_check_never); // used for service thread operations
|
||||
|
||||
@ -246,68 +257,54 @@ void mutex_init() {
|
||||
|
||||
def(JmethodIdCreation_lock , PaddedMutex , nosafepoint-2, true, _safepoint_check_never); // used for creating jmethodIDs.
|
||||
|
||||
def(SystemDictionary_lock , PaddedMonitor, leaf, true, _safepoint_check_always);
|
||||
def(SharedDictionary_lock , PaddedMutex , leaf, true, _safepoint_check_always);
|
||||
def(ClassInitError_lock , PaddedMonitor, leaf+1, true, _safepoint_check_always);
|
||||
def(Module_lock , PaddedMutex , leaf+2, false, _safepoint_check_always);
|
||||
def(InlineCacheBuffer_lock , PaddedMutex , nosafepoint-1, true, _safepoint_check_never);
|
||||
def(VMStatistic_lock , PaddedMutex , leaf, false, _safepoint_check_always);
|
||||
def(ExpandHeap_lock , PaddedMutex , leaf, true, _safepoint_check_always); // Used during compilation by VM thread
|
||||
def(JNIHandleBlockFreeList_lock , PaddedMutex , nosafepoint-1, true, _safepoint_check_never); // handles are used by VM thread
|
||||
def(SignatureHandlerLibrary_lock , PaddedMutex , leaf, false, _safepoint_check_always);
|
||||
def(SymbolArena_lock , PaddedMutex , nosafepoint, true, _safepoint_check_never);
|
||||
def(ExceptionCache_lock , PaddedMutex , leaf, false, _safepoint_check_always);
|
||||
def(SharedDictionary_lock , PaddedMutex , nonleaf, true, _safepoint_check_always);
|
||||
def(VMStatistic_lock , PaddedMutex , nonleaf, false, _safepoint_check_always);
|
||||
def(JNIHandleBlockFreeList_lock , PaddedMutex , nosafepoint-1, true, _safepoint_check_never); // handles are used by VM thread
|
||||
def(SignatureHandlerLibrary_lock , PaddedMutex , nonleaf, false, _safepoint_check_always);
|
||||
def(SymbolArena_lock , PaddedMutex , nosafepoint, true, _safepoint_check_never);
|
||||
def(ExceptionCache_lock , PaddedMutex , nonleaf, false, _safepoint_check_always);
|
||||
#ifndef PRODUCT
|
||||
def(FullGCALot_lock , PaddedMutex , leaf, false, _safepoint_check_always); // a lock to make FullGCALot MT safe
|
||||
def(FullGCALot_lock , PaddedMutex , nonleaf, false, _safepoint_check_always); // a lock to make FullGCALot MT safe
|
||||
#endif
|
||||
def(BeforeExit_lock , PaddedMonitor, leaf, true, _safepoint_check_always);
|
||||
def(PerfDataMemAlloc_lock , PaddedMutex , leaf, true, _safepoint_check_always); // used for allocating PerfData memory for performance data
|
||||
def(PerfDataManager_lock , PaddedMutex , leaf, true, _safepoint_check_always); // used for synchronized access to PerfDataManager resources
|
||||
def(BeforeExit_lock , PaddedMonitor, nonleaf, true, _safepoint_check_always);
|
||||
|
||||
def(Threads_lock , PaddedMonitor, barrier, true, _safepoint_check_always); // Used for safepoint protocol.
|
||||
def(NonJavaThreadsList_lock , PaddedMutex, nosafepoint-1, true, _safepoint_check_never);
|
||||
def(NonJavaThreadsListSync_lock , PaddedMutex, nosafepoint, true, _safepoint_check_never);
|
||||
|
||||
def(VMOperation_lock , PaddedMonitor, nonleaf, true, _safepoint_check_always); // VM_thread allowed to block on these
|
||||
def(RetData_lock , PaddedMutex , nonleaf, false, _safepoint_check_always);
|
||||
def(Terminator_lock , PaddedMonitor, nonleaf, true, _safepoint_check_always);
|
||||
def(InitCompleted_lock , PaddedMonitor, nosafepoint, true, _safepoint_check_never);
|
||||
def(VtableStubs_lock , PaddedMutex , nosafepoint-2, true, _safepoint_check_never);
|
||||
def(Notify_lock , PaddedMonitor, nonleaf, true, _safepoint_check_always);
|
||||
def(JNICritical_lock , PaddedMonitor, nonleaf, true, _safepoint_check_always); // used for JNI critical regions
|
||||
def(AdapterHandlerLibrary_lock , PaddedMutex , nonleaf, true, _safepoint_check_always);
|
||||
|
||||
def(Heap_lock , PaddedMonitor, nonleaf+1, false, _safepoint_check_always); // Doesn't safepoint check during termination.
|
||||
def(JfieldIdCreation_lock , PaddedMutex , nonleaf+1, true, _safepoint_check_always); // jfieldID, Used in VM_Operation
|
||||
def(Heap_lock , PaddedMonitor, nonleaf, false, _safepoint_check_always); // Doesn't safepoint check during termination.
|
||||
def(JfieldIdCreation_lock , PaddedMutex , nonleaf, true, _safepoint_check_always); // jfieldID, Used in VM_Operation
|
||||
|
||||
def(CompiledIC_lock , PaddedMutex , nosafepoint, true, _safepoint_check_never); // locks VtableStubs_lock, InlineCacheBuffer_lock
|
||||
def(CompileTaskAlloc_lock , PaddedMutex , nonleaf+2, true, _safepoint_check_always);
|
||||
def(CompileStatistics_lock , PaddedMutex , nonleaf+2, false, _safepoint_check_always);
|
||||
def(DirectivesStack_lock , PaddedMutex , nosafepoint, true, _safepoint_check_never);
|
||||
def(MultiArray_lock , PaddedMutex , nonleaf+2, false, _safepoint_check_always);
|
||||
def(MethodCompileQueue_lock , PaddedMonitor, nonleaf, false, _safepoint_check_always);
|
||||
def(CompileStatistics_lock , PaddedMutex , nonleaf, false, _safepoint_check_always);
|
||||
def(DirectivesStack_lock , PaddedMutex , nosafepoint, true, _safepoint_check_never);
|
||||
def(MultiArray_lock , PaddedMutex , nonleaf, false, _safepoint_check_always);
|
||||
|
||||
def(JvmtiThreadState_lock , PaddedMutex , nonleaf+2, false, _safepoint_check_always); // Used by JvmtiThreadState/JvmtiEventController
|
||||
def(JvmtiThreadState_lock , PaddedMutex , nonleaf, false, _safepoint_check_always); // Used by JvmtiThreadState/JvmtiEventController
|
||||
def(EscapeBarrier_lock , PaddedMonitor, nosafepoint, true, _safepoint_check_never); // Used to synchronize object reallocation/relocking triggered by JVMTI
|
||||
def(Management_lock , PaddedMutex , nonleaf+2, false, _safepoint_check_always); // used for JVM management
|
||||
def(Management_lock , PaddedMutex , nonleaf, false, _safepoint_check_always); // used for JVM management
|
||||
|
||||
def(ConcurrentGCBreakpoints_lock , PaddedMonitor, nonleaf, true, _safepoint_check_always);
|
||||
def(Compile_lock , PaddedMutex , nonleaf+3, false, _safepoint_check_always);
|
||||
def(MethodData_lock , PaddedMutex , nonleaf+3, false, _safepoint_check_always);
|
||||
def(TouchedMethodLog_lock , PaddedMutex , nonleaf+3, false, _safepoint_check_always);
|
||||
def(MethodData_lock , PaddedMutex , nonleaf, false, _safepoint_check_always);
|
||||
def(TouchedMethodLog_lock , PaddedMutex , nonleaf, false, _safepoint_check_always);
|
||||
|
||||
def(MethodCompileQueue_lock , PaddedMonitor, nonleaf+4, false, _safepoint_check_always);
|
||||
def(CompileThread_lock , PaddedMonitor, nonleaf+5, false, _safepoint_check_always);
|
||||
def(PeriodicTask_lock , PaddedMonitor, nonleaf+5, true, _safepoint_check_always);
|
||||
def(RedefineClasses_lock , PaddedMonitor, nonleaf+5, true, _safepoint_check_always);
|
||||
def(Verify_lock , PaddedMutex, nonleaf+5, true, _safepoint_check_always);
|
||||
def(Zip_lock , PaddedMonitor, nosafepoint-2, true, _safepoint_check_never);
|
||||
def(CompileThread_lock , PaddedMonitor, nonleaf, false, _safepoint_check_always);
|
||||
def(PeriodicTask_lock , PaddedMonitor, nonleaf, true, _safepoint_check_always);
|
||||
def(RedefineClasses_lock , PaddedMonitor, nonleaf, true, _safepoint_check_always);
|
||||
def(Verify_lock , PaddedMutex, nonleaf, true, _safepoint_check_always);
|
||||
|
||||
if (WhiteBoxAPI) {
|
||||
def(Compilation_lock , PaddedMonitor, nosafepoint, true, _safepoint_check_never);
|
||||
}
|
||||
|
||||
#if INCLUDE_JFR
|
||||
def(JfrMsg_lock , PaddedMonitor, leaf, true, _safepoint_check_always);
|
||||
def(JfrBuffer_lock , PaddedMutex , nosafepoint, true, _safepoint_check_never);
|
||||
def(JfrStacktrace_lock , PaddedMutex , stackwatermark-1, true, _safepoint_check_never);
|
||||
def(JfrThreadSampler_lock , PaddedMonitor, nosafepoint, true, _safepoint_check_never);
|
||||
@ -317,29 +314,61 @@ void mutex_init() {
|
||||
def(UnsafeJlong_lock , PaddedMutex , nosafepoint, true, _safepoint_check_never);
|
||||
#endif
|
||||
|
||||
def(CodeHeapStateAnalytics_lock , PaddedMutex , nonleaf+6, false, _safepoint_check_always);
|
||||
def(CodeHeapStateAnalytics_lock , PaddedMutex , nonleaf, false, _safepoint_check_always);
|
||||
def(NMethodSweeperStats_lock , PaddedMutex , nosafepoint, true, _safepoint_check_never);
|
||||
def(ThreadsSMRDelete_lock , PaddedMonitor, nosafepoint-3, true, _safepoint_check_never); // Holds ConcurrentHashTableResize_lock
|
||||
def(ThreadIdTableCreate_lock , PaddedMutex , leaf, false, _safepoint_check_always);
|
||||
def(SharedDecoder_lock , PaddedMutex , tty-1, true, _safepoint_check_never);
|
||||
def(DCmdFactory_lock , PaddedMutex , nosafepoint, true, _safepoint_check_never);
|
||||
def(ThreadIdTableCreate_lock , PaddedMutex , nonleaf, false, _safepoint_check_always);
|
||||
def(SharedDecoder_lock , PaddedMutex , tty-1, true, _safepoint_check_never);
|
||||
def(DCmdFactory_lock , PaddedMutex , nosafepoint, true, _safepoint_check_never);
|
||||
#if INCLUDE_NMT
|
||||
def(NMTQuery_lock , PaddedMutex , max_nonleaf, false, _safepoint_check_always);
|
||||
def(NMTQuery_lock , PaddedMutex , nonleaf, false, _safepoint_check_always);
|
||||
#endif
|
||||
#if INCLUDE_CDS
|
||||
#if INCLUDE_JVMTI
|
||||
def(CDSClassFileStream_lock , PaddedMutex , max_nonleaf, false, _safepoint_check_always);
|
||||
def(CDSClassFileStream_lock , PaddedMutex , nonleaf, false, _safepoint_check_always);
|
||||
#endif
|
||||
def(DumpTimeTable_lock , PaddedMutex , nosafepoint-1, true, _safepoint_check_never);
|
||||
def(DumpTimeTable_lock , PaddedMutex , nosafepoint, true, _safepoint_check_never);
|
||||
def(CDSLambda_lock , PaddedMutex , nosafepoint, true, _safepoint_check_never);
|
||||
def(DumpRegion_lock , PaddedMutex , nosafepoint, true, _safepoint_check_never);
|
||||
def(ClassListFile_lock , PaddedMutex , nosafepoint, true, _safepoint_check_never);
|
||||
def(LambdaFormInvokers_lock , PaddedMutex , nonleaf+2, false, _safepoint_check_always);
|
||||
def(LambdaFormInvokers_lock , PaddedMutex , nonleaf, false, _safepoint_check_always);
|
||||
#endif // INCLUDE_CDS
|
||||
def(Bootclasspath_lock , PaddedMutex , nosafepoint, true, _safepoint_check_never);
|
||||
def(Zip_lock , PaddedMonitor, nosafepoint-1, true, _safepoint_check_never); // Holds DumpTimeTable_lock
|
||||
|
||||
#if INCLUDE_JVMCI
|
||||
def(JVMCI_lock , PaddedMonitor, nonleaf+2, true, _safepoint_check_always);
|
||||
def(JVMCI_lock , PaddedMonitor, nonleaf, true, _safepoint_check_always);
|
||||
#endif
|
||||
|
||||
// These locks have safepoint_check_never and relative rankings.
|
||||
defl(InlineCacheBuffer_lock , PaddedMutex , CompiledIC_lock, true, _safepoint_check_never);
|
||||
defl(VtableStubs_lock , PaddedMutex , CompiledIC_lock, true, _safepoint_check_never); // Also holds DumpTimeTable_lock
|
||||
defl(CodeCache_lock , PaddedMonitor, VtableStubs_lock, true, _safepoint_check_never);
|
||||
defl(CompiledMethod_lock , PaddedMutex , CodeCache_lock, true, _safepoint_check_never);
|
||||
defl(CodeSweeper_lock , PaddedMonitor, CompiledMethod_lock, true, _safepoint_check_never);
|
||||
|
||||
// These locks have safepoint_check_always and relative rankings.
|
||||
defl(Threads_lock , PaddedMonitor, CompileThread_lock, true, _safepoint_check_always);
|
||||
defl(Heap_lock , PaddedMonitor, MultiArray_lock, false, _safepoint_check_always);
|
||||
defl(Compile_lock , PaddedMutex , MethodCompileQueue_lock, false, _safepoint_check_always);
|
||||
|
||||
defl(PerfDataMemAlloc_lock , PaddedMutex , Heap_lock, true, _safepoint_check_always);
|
||||
defl(PerfDataManager_lock , PaddedMutex , Heap_lock, true, _safepoint_check_always);
|
||||
defl(ClassLoaderDataGraph_lock , PaddedMutex , MultiArray_lock, false, _safepoint_check_always);
|
||||
defl(VMOperation_lock , PaddedMonitor, Compile_lock, true, _safepoint_check_always);
|
||||
defl(ClassInitError_lock , PaddedMonitor, Threads_lock, true, _safepoint_check_always);
|
||||
|
||||
if (UseG1GC) {
|
||||
defl(G1OldGCCount_lock , PaddedMonitor, Threads_lock, true, _safepoint_check_always);
|
||||
}
|
||||
defl(CompileTaskAlloc_lock , PaddedMutex , MethodCompileQueue_lock, true, _safepoint_check_always);
|
||||
defl(ExpandHeap_lock , PaddedMutex , Heap_lock, true, _safepoint_check_always);
|
||||
defl(OopMapCacheAlloc_lock , PaddedMutex , Threads_lock, true, _safepoint_check_always);
|
||||
defl(Module_lock , PaddedMutex , ClassLoaderDataGraph_lock, false, _safepoint_check_always);
|
||||
defl(SystemDictionary_lock , PaddedMonitor, Module_lock, true, _safepoint_check_always);
|
||||
|
||||
#if INCLUDE_JFR
|
||||
defl(JfrMsg_lock , PaddedMonitor, Module_lock, true, _safepoint_check_always);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -748,7 +748,7 @@ class ParDumpWriter : public AbstractDumpWriter {
|
||||
|
||||
static void before_work() {
|
||||
assert(_lock == NULL, "ParDumpWriter lock must be initialized only once");
|
||||
_lock = new (std::nothrow) PaddedMonitor(Mutex::leaf, "ParallelHProfWriter_lock", Mutex::_safepoint_check_always);
|
||||
_lock = new (std::nothrow) PaddedMonitor(Mutex::nonleaf, "ParallelHProfWriter_lock", Mutex::_safepoint_check_always);
|
||||
}
|
||||
|
||||
static void after_work() {
|
||||
@ -1814,7 +1814,7 @@ class DumperController : public CHeapObj<mtInternal> {
|
||||
public:
|
||||
DumperController(uint number) :
|
||||
_started(false),
|
||||
_lock(new (std::nothrow) PaddedMonitor(Mutex::leaf, "DumperController_lock",
|
||||
_lock(new (std::nothrow) PaddedMonitor(Mutex::nonleaf, "DumperController_lock",
|
||||
Mutex::_safepoint_check_always)),
|
||||
_dumper_number(number),
|
||||
_complete_number(0) { }
|
||||
|
@ -53,14 +53,16 @@ TEST_VM(MutexName, mutex_name) {
|
||||
|
||||
#ifdef ASSERT
|
||||
|
||||
const int rankA = 50;
|
||||
const int rankA = Mutex::nonleaf-5;
|
||||
const int rankAplusOne = Mutex::nonleaf-4;
|
||||
const int rankAplusTwo = Mutex::nonleaf-3;
|
||||
|
||||
TEST_OTHER_VM(MutexRank, mutex_lock_rank_in_order) {
|
||||
JavaThread* THREAD = JavaThread::current();
|
||||
ThreadInVMfromNative invm(THREAD);
|
||||
|
||||
Mutex* mutex_rankA = new Mutex(rankA, "mutex_rankA", Mutex::_safepoint_check_always);
|
||||
Mutex* mutex_rankA_plus_one = new Mutex(rankA + 1, "mutex_rankA_plus_one", Mutex::_safepoint_check_always);
|
||||
Mutex* mutex_rankA_plus_one = new Mutex(rankAplusOne, "mutex_rankA_plus_one", Mutex::_safepoint_check_always);
|
||||
|
||||
mutex_rankA_plus_one->lock();
|
||||
mutex_rankA->lock();
|
||||
@ -69,12 +71,12 @@ TEST_OTHER_VM(MutexRank, mutex_lock_rank_in_order) {
|
||||
}
|
||||
|
||||
TEST_VM_ASSERT_MSG(MutexRank, mutex_lock_rank_out_of_orderA,
|
||||
".* Attempting to acquire lock mutex_rankA_plus_one/51 out of order with lock mutex_rankA/50 -- possible deadlock") {
|
||||
".* Attempting to acquire lock mutex_rankA_plus_one/.* out of order with lock mutex_rankA/.* -- possible deadlock") {
|
||||
JavaThread* THREAD = JavaThread::current();
|
||||
ThreadInVMfromNative invm(THREAD);
|
||||
|
||||
Mutex* mutex_rankA = new Mutex(rankA, "mutex_rankA", Mutex::_safepoint_check_always);
|
||||
Mutex* mutex_rankA_plus_one = new Mutex(rankA + 1, "mutex_rankA_plus_one", Mutex::_safepoint_check_always);
|
||||
Mutex* mutex_rankA_plus_one = new Mutex(rankAplusOne, "mutex_rankA_plus_one", Mutex::_safepoint_check_always);
|
||||
|
||||
mutex_rankA->lock();
|
||||
mutex_rankA_plus_one->lock();
|
||||
@ -83,7 +85,7 @@ TEST_VM_ASSERT_MSG(MutexRank, mutex_lock_rank_out_of_orderA,
|
||||
}
|
||||
|
||||
TEST_VM_ASSERT_MSG(MutexRank, mutex_lock_rank_out_of_orderB,
|
||||
".* Attempting to acquire lock mutex_rankB/50 out of order with lock mutex_rankA/50 -- possible deadlock") {
|
||||
".* Attempting to acquire lock mutex_rankB/.* out of order with lock mutex_rankA/.* -- possible deadlock") {
|
||||
JavaThread* THREAD = JavaThread::current();
|
||||
ThreadInVMfromNative invm(THREAD);
|
||||
|
||||
@ -101,8 +103,8 @@ TEST_OTHER_VM(MutexRank, mutex_trylock_rank_out_of_orderA) {
|
||||
ThreadInVMfromNative invm(THREAD);
|
||||
|
||||
Mutex* mutex_rankA = new Mutex(rankA, "mutex_rankA", Mutex::_safepoint_check_always);
|
||||
Mutex* mutex_rankA_plus_one = new Mutex(rankA + 1, "mutex_rankA_plus_one", Mutex::_safepoint_check_always);
|
||||
Mutex* mutex_rankA_plus_two = new Mutex(rankA + 2, "mutex_rankA_plus_two", Mutex::_safepoint_check_always);
|
||||
Mutex* mutex_rankA_plus_one = new Mutex(rankAplusOne, "mutex_rankA_plus_one", Mutex::_safepoint_check_always);
|
||||
Mutex* mutex_rankA_plus_two = new Mutex(rankAplusTwo, "mutex_rankA_plus_two", Mutex::_safepoint_check_always);
|
||||
|
||||
mutex_rankA_plus_one->lock();
|
||||
mutex_rankA_plus_two->try_lock_without_rank_check();
|
||||
@ -113,12 +115,12 @@ TEST_OTHER_VM(MutexRank, mutex_trylock_rank_out_of_orderA) {
|
||||
}
|
||||
|
||||
TEST_VM_ASSERT_MSG(MutexRank, mutex_trylock_rank_out_of_orderB,
|
||||
".* Attempting to acquire lock mutex_rankA_plus_one/51 out of order with lock mutex_rankA/50 -- possible deadlock") {
|
||||
".* Attempting to acquire lock mutex_rankA_plus_one/.* out of order with lock mutex_rankA/.* -- possible deadlock") {
|
||||
JavaThread* THREAD = JavaThread::current();
|
||||
ThreadInVMfromNative invm(THREAD);
|
||||
|
||||
Mutex* mutex_rankA = new Mutex(rankA, "mutex_rankA", Mutex::_safepoint_check_always);
|
||||
Mutex* mutex_rankA_plus_one = new Mutex(rankA + 1, "mutex_rankA_plus_one", Mutex::_safepoint_check_always);
|
||||
Mutex* mutex_rankA_plus_one = new Mutex(rankAplusOne, "mutex_rankA_plus_one", Mutex::_safepoint_check_always);
|
||||
|
||||
mutex_rankA->lock();
|
||||
mutex_rankA_plus_one->try_lock_without_rank_check();
|
||||
@ -163,7 +165,7 @@ TEST_OTHER_VM(MutexRank, monitor_wait_rank_in_order) {
|
||||
ThreadInVMfromNative invm(THREAD);
|
||||
|
||||
Monitor* monitor_rankA = new Monitor(rankA, "monitor_rankA", Mutex::_safepoint_check_always);
|
||||
Monitor* monitor_rankA_plus_one = new Monitor(rankA + 1, "monitor_rankA_plus_one", Mutex::_safepoint_check_always);
|
||||
Monitor* monitor_rankA_plus_one = new Monitor(rankAplusOne, "monitor_rankA_plus_one", Mutex::_safepoint_check_always);
|
||||
|
||||
monitor_rankA_plus_one->lock();
|
||||
monitor_rankA->lock();
|
||||
@ -173,13 +175,13 @@ TEST_OTHER_VM(MutexRank, monitor_wait_rank_in_order) {
|
||||
}
|
||||
|
||||
TEST_VM_ASSERT_MSG(MutexRank, monitor_wait_rank_out_of_order,
|
||||
".* Attempting to wait on monitor monitor_rankA_plus_one/51 while holding lock monitor_rankA/50 "
|
||||
".* Attempting to wait on monitor monitor_rankA_plus_one/.* while holding lock monitor_rankA/.* "
|
||||
"-- possible deadlock. Should wait on the least ranked monitor from all owned locks.") {
|
||||
JavaThread* THREAD = JavaThread::current();
|
||||
ThreadInVMfromNative invm(THREAD);
|
||||
|
||||
Monitor* monitor_rankA = new Monitor(rankA, "monitor_rankA", Mutex::_safepoint_check_always);
|
||||
Monitor* monitor_rankA_plus_one = new Monitor(rankA + 1, "monitor_rankA_plus_one", Mutex::_safepoint_check_always);
|
||||
Monitor* monitor_rankA_plus_one = new Monitor(rankAplusOne, "monitor_rankA_plus_one", Mutex::_safepoint_check_always);
|
||||
|
||||
monitor_rankA_plus_one->lock();
|
||||
monitor_rankA->lock();
|
||||
@ -189,13 +191,13 @@ TEST_VM_ASSERT_MSG(MutexRank, monitor_wait_rank_out_of_order,
|
||||
}
|
||||
|
||||
TEST_VM_ASSERT_MSG(MutexRank, monitor_wait_rank_out_of_order_trylock,
|
||||
".* Attempting to wait on monitor monitor_rankA_plus_one/51 while holding lock monitor_rankA/50 "
|
||||
".* Attempting to wait on monitor monitor_rankA_plus_one/.* while holding lock monitor_rankA/.* "
|
||||
"-- possible deadlock. Should wait on the least ranked monitor from all owned locks.") {
|
||||
JavaThread* THREAD = JavaThread::current();
|
||||
ThreadInVMfromNative invm(THREAD);
|
||||
|
||||
Monitor* monitor_rankA = new Monitor(rankA, "monitor_rankA", Mutex::_safepoint_check_always);
|
||||
Monitor* monitor_rankA_plus_one = new Monitor(rankA + 1, "monitor_rankA_plus_one", Mutex::_safepoint_check_always);
|
||||
Monitor* monitor_rankA_plus_one = new Monitor(rankAplusOne, "monitor_rankA_plus_one", Mutex::_safepoint_check_always);
|
||||
|
||||
monitor_rankA->lock();
|
||||
monitor_rankA_plus_one->try_lock_without_rank_check();
|
||||
@ -280,12 +282,12 @@ TEST_VM_ASSERT_MSG(MutexRank, monitor_negative_rank,
|
||||
}
|
||||
|
||||
TEST_VM_ASSERT_MSG(MutexRank, monitor_nosafepoint_rank,
|
||||
".*failed: Locks above nosafepoint rank should safepoint: monitor_rank_leaf") {
|
||||
".*failed: Locks above nosafepoint rank should safepoint: monitor_rank_nonleaf") {
|
||||
JavaThread* THREAD = JavaThread::current();
|
||||
ThreadInVMfromNative invm(THREAD);
|
||||
|
||||
Monitor* monitor_rank_leaf = new Monitor(Mutex::leaf, "monitor_rank_leaf", Mutex::_safepoint_check_never);
|
||||
monitor_rank_leaf->lock_without_safepoint_check();
|
||||
monitor_rank_leaf->unlock();
|
||||
Monitor* monitor_rank_nonleaf = new Monitor(Mutex::nonleaf, "monitor_rank_nonleaf", Mutex::_safepoint_check_never);
|
||||
monitor_rank_nonleaf->lock_without_safepoint_check();
|
||||
monitor_rank_nonleaf->unlock();
|
||||
}
|
||||
#endif // ASSERT
|
||||
|
@ -32,7 +32,7 @@
|
||||
// Test mismatched safepoint check flag on lock declaration vs. lock acquisition.
|
||||
TEST_VM_ASSERT_MSG(SafepointLockAssertTest, always_check,
|
||||
".*This lock should always have a safepoint check for Java threads: SFPT_Test_lock") {
|
||||
MutexLocker ml(new Mutex(Mutex::leaf, "SFPT_Test_lock", Mutex::_safepoint_check_always),
|
||||
MutexLocker ml(new Mutex(Mutex::nonleaf, "SFPT_Test_lock", Mutex::_safepoint_check_always),
|
||||
Mutex::_no_safepoint_check_flag);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user