8273916: Remove 'special' ranking
Reviewed-by: dholmes, pchilanomate
This commit is contained in:
parent
4f3b626a36
commit
d098751366
src/hotspot/share/runtime
test/hotspot/gtest/runtime
@ -51,8 +51,7 @@ class Mutex : public CHeapObj<mtSynchronizer> {
|
||||
service = event + 6,
|
||||
stackwatermark = service + 3,
|
||||
tty = stackwatermark + 3,
|
||||
special = tty + 3,
|
||||
oopstorage = special + 3,
|
||||
oopstorage = tty + 3,
|
||||
nosafepoint = oopstorage + 6,
|
||||
leaf = nosafepoint + 6,
|
||||
barrier = leaf + 10,
|
||||
|
@ -225,17 +225,17 @@ 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, special, true, _safepoint_check_never);
|
||||
def(CodeSweeper_lock , PaddedMonitor, special-2, true, _safepoint_check_never);
|
||||
def(RawMonitor_lock , PaddedMutex , special, true, _safepoint_check_never);
|
||||
def(CodeCache_lock , PaddedMonitor, nosafepoint-3, true, _safepoint_check_never);
|
||||
def(CodeSweeper_lock , PaddedMonitor, nosafepoint-5, true, _safepoint_check_never);
|
||||
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 , special, true, _safepoint_check_never); // used for safepointing and code patching.
|
||||
def(CompiledMethod_lock , PaddedMutex , special-1, true, _safepoint_check_never);
|
||||
def(MonitorDeflation_lock , PaddedMonitor, special, true, _safepoint_check_never); // used for monitor deflation thread operations
|
||||
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
|
||||
|
||||
if (UseNotificationThread) {
|
||||
@ -244,7 +244,7 @@ void mutex_init() {
|
||||
Notification_lock = Service_lock;
|
||||
}
|
||||
|
||||
def(JmethodIdCreation_lock , PaddedMutex , special-2, true, _safepoint_check_never); // used for creating jmethodIDs.
|
||||
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);
|
||||
@ -283,7 +283,7 @@ void mutex_init() {
|
||||
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 , special, true, _safepoint_check_never);
|
||||
def(DirectivesStack_lock , PaddedMutex , nosafepoint, true, _safepoint_check_never);
|
||||
def(MultiArray_lock , PaddedMutex , nonleaf+2, false, _safepoint_check_always);
|
||||
|
||||
def(JvmtiThreadState_lock , PaddedMutex , nonleaf+2, false, _safepoint_check_always); // Used by JvmtiThreadState/JvmtiEventController
|
||||
@ -314,12 +314,12 @@ void mutex_init() {
|
||||
#endif
|
||||
|
||||
#ifndef SUPPORTS_NATIVE_CX8
|
||||
def(UnsafeJlong_lock , PaddedMutex , special, true, _safepoint_check_never);
|
||||
def(UnsafeJlong_lock , PaddedMutex , nosafepoint, true, _safepoint_check_never);
|
||||
#endif
|
||||
|
||||
def(CodeHeapStateAnalytics_lock , PaddedMutex , nonleaf+6, false, _safepoint_check_always);
|
||||
def(NMethodSweeperStats_lock , PaddedMutex , special, true, _safepoint_check_never);
|
||||
def(ThreadsSMRDelete_lock , PaddedMonitor, special, true, _safepoint_check_never);
|
||||
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);
|
||||
|
@ -54,7 +54,7 @@ extern Mutex* VtableStubs_lock; // a lock on the VtableStubs
|
||||
extern Mutex* SymbolArena_lock; // a lock on the symbol table arena
|
||||
extern Monitor* StringDedup_lock; // a lock on the string deduplication facility
|
||||
extern Mutex* StringDedupIntern_lock; // a lock on StringTable notification of StringDedup
|
||||
extern Monitor* CodeCache_lock; // a lock on the CodeCache, rank is special
|
||||
extern Monitor* CodeCache_lock; // a lock on the CodeCache
|
||||
extern Monitor* CodeSweeper_lock; // a lock used by the sweeper only for wait notify
|
||||
extern Mutex* MethodData_lock; // a lock on installation of method data
|
||||
extern Mutex* TouchedMethodLog_lock; // a lock on allocation of LogExecutedMethods info
|
||||
@ -196,8 +196,6 @@ class MutexLocker: public StackObj {
|
||||
_mutex(mutex) {
|
||||
bool no_safepoint_check = flag == Mutex::_no_safepoint_check_flag;
|
||||
if (_mutex != NULL) {
|
||||
assert(_mutex->rank() > Mutex::special || no_safepoint_check,
|
||||
"Mutexes with rank special or lower should not do safepoint checks");
|
||||
if (no_safepoint_check) {
|
||||
_mutex->lock_without_safepoint_check();
|
||||
} else {
|
||||
@ -210,8 +208,6 @@ class MutexLocker: public StackObj {
|
||||
_mutex(mutex) {
|
||||
bool no_safepoint_check = flag == Mutex::_no_safepoint_check_flag;
|
||||
if (_mutex != NULL) {
|
||||
assert(_mutex->rank() > Mutex::special || no_safepoint_check,
|
||||
"Mutexes with rank special or lower should not do safepoint checks");
|
||||
if (no_safepoint_check) {
|
||||
_mutex->lock_without_safepoint_check(thread);
|
||||
} else {
|
||||
|
@ -143,18 +143,18 @@ TEST_VM_ASSERT_MSG(MutexRank, mutex_lock_event_nosafepoint,
|
||||
mutex_rank_event->unlock();
|
||||
}
|
||||
|
||||
TEST_VM_ASSERT_MSG(MutexRank, mutex_lock_tty_special,
|
||||
".* Attempting to acquire lock mutex_rank_special/.* out of order with lock mutex_rank_tty/.*"
|
||||
TEST_VM_ASSERT_MSG(MutexRank, mutex_lock_tty_nosafepoint,
|
||||
".* Attempting to acquire lock mutex_rank_nosafepoint/.* out of order with lock mutex_rank_tty/.*"
|
||||
"-- possible deadlock") {
|
||||
JavaThread* THREAD = JavaThread::current();
|
||||
ThreadInVMfromNative invm(THREAD);
|
||||
|
||||
Mutex* mutex_rank_tty = new Mutex(Mutex::tty, "mutex_rank_tty", Mutex::_safepoint_check_never);
|
||||
Mutex* mutex_rank_special = new Mutex(Mutex::special, "mutex_rank_special", Mutex::_safepoint_check_never);
|
||||
Mutex* mutex_rank_nosafepoint = new Mutex(Mutex::nosafepoint, "mutex_rank_nosafepoint", Mutex::_safepoint_check_never);
|
||||
|
||||
mutex_rank_tty->lock_without_safepoint_check();
|
||||
mutex_rank_special->lock_without_safepoint_check();
|
||||
mutex_rank_special->unlock();
|
||||
mutex_rank_nosafepoint->lock_without_safepoint_check();
|
||||
mutex_rank_nosafepoint->unlock();
|
||||
mutex_rank_tty->unlock();
|
||||
}
|
||||
|
||||
@ -204,20 +204,20 @@ TEST_VM_ASSERT_MSG(MutexRank, monitor_wait_rank_out_of_order_trylock,
|
||||
monitor_rankA->unlock();
|
||||
}
|
||||
|
||||
TEST_VM_ASSERT_MSG(MutexRank, monitor_wait_rank_special,
|
||||
".* Attempting to wait on monitor monitor_rank_special_minus_one/.* while holding lock monitor_rank_special/.*"
|
||||
TEST_VM_ASSERT_MSG(MutexRank, monitor_wait_rank_nosafepoint,
|
||||
".* Attempting to wait on monitor monitor_rank_nosafepoint_minus_one/.* while holding lock monitor_rank_nosafepoint/.*"
|
||||
"-- possible deadlock. Should not block\\(wait\\) while holding a lock of rank nosafepoint or below.") {
|
||||
JavaThread* THREAD = JavaThread::current();
|
||||
ThreadInVMfromNative invm(THREAD);
|
||||
|
||||
Monitor* monitor_rank_special = new Monitor(Mutex::special, "monitor_rank_special", Mutex::_safepoint_check_never);
|
||||
Monitor* monitor_rank_special_minus_one = new Monitor(Mutex::special - 1, "monitor_rank_special_minus_one", Mutex::_safepoint_check_never);
|
||||
Monitor* monitor_rank_nosafepoint = new Monitor(Mutex::nosafepoint, "monitor_rank_nosafepoint", Mutex::_safepoint_check_never);
|
||||
Monitor* monitor_rank_nosafepoint_minus_one = new Monitor(Mutex::nosafepoint - 1, "monitor_rank_nosafepoint_minus_one", Mutex::_safepoint_check_never);
|
||||
|
||||
monitor_rank_special->lock_without_safepoint_check();
|
||||
monitor_rank_special_minus_one->lock_without_safepoint_check();
|
||||
monitor_rank_special_minus_one->wait_without_safepoint_check(1);
|
||||
monitor_rank_special_minus_one->unlock();
|
||||
monitor_rank_special->unlock();
|
||||
monitor_rank_nosafepoint->lock_without_safepoint_check();
|
||||
monitor_rank_nosafepoint_minus_one->lock_without_safepoint_check();
|
||||
monitor_rank_nosafepoint_minus_one->wait_without_safepoint_check(1);
|
||||
monitor_rank_nosafepoint_minus_one->unlock();
|
||||
monitor_rank_nosafepoint->unlock();
|
||||
}
|
||||
|
||||
TEST_VM_ASSERT_MSG(MutexRank, monitor_wait_event_tty,
|
||||
@ -236,30 +236,30 @@ TEST_VM_ASSERT_MSG(MutexRank, monitor_wait_event_tty,
|
||||
monitor_rank_tty->unlock();
|
||||
}
|
||||
|
||||
TEST_VM_ASSERT_MSG(MutexRank, monitor_wait_tty_special,
|
||||
".* Attempting to wait on monitor monitor_rank_tty/.* while holding lock monitor_rank_special/.*"
|
||||
TEST_VM_ASSERT_MSG(MutexRank, monitor_wait_tty_nosafepoint,
|
||||
".* Attempting to wait on monitor monitor_rank_tty/.* while holding lock monitor_rank_nosafepoint/.*"
|
||||
"-- possible deadlock. Should not block\\(wait\\) while holding a lock of rank nosafepoint or below.") {
|
||||
JavaThread* THREAD = JavaThread::current();
|
||||
ThreadInVMfromNative invm(THREAD);
|
||||
|
||||
Monitor* monitor_rank_special = new Monitor(Mutex::special, "monitor_rank_special", Mutex::_safepoint_check_never);
|
||||
Monitor* monitor_rank_nosafepoint = new Monitor(Mutex::nosafepoint, "monitor_rank_nosafepoint", Mutex::_safepoint_check_never);
|
||||
Monitor* monitor_rank_tty = new Monitor(Mutex::tty, "monitor_rank_tty", Mutex::_safepoint_check_never);
|
||||
|
||||
monitor_rank_special->lock_without_safepoint_check();
|
||||
monitor_rank_nosafepoint->lock_without_safepoint_check();
|
||||
monitor_rank_tty->lock_without_safepoint_check();
|
||||
monitor_rank_tty->wait_without_safepoint_check(1);
|
||||
monitor_rank_tty->unlock();
|
||||
monitor_rank_special->unlock();
|
||||
monitor_rank_nosafepoint->unlock();
|
||||
}
|
||||
|
||||
TEST_VM_ASSERT_MSG(MutexRank, monitor_special_vm_block,
|
||||
TEST_VM_ASSERT_MSG(MutexRank, monitor_nosafepoint_vm_block,
|
||||
".*Safepoint check never locks should always allow the vm to block") {
|
||||
JavaThread* THREAD = JavaThread::current();
|
||||
ThreadInVMfromNative invm(THREAD);
|
||||
|
||||
Monitor* monitor_rank_special = new Monitor(Mutex::special, "monitor_rank_special", Mutex::_safepoint_check_never, false);
|
||||
monitor_rank_special->lock_without_safepoint_check();
|
||||
monitor_rank_special->unlock();
|
||||
Monitor* monitor_rank_nosafepoint = new Monitor(Mutex::nosafepoint, "monitor_rank_nosafepoint", Mutex::_safepoint_check_never, false);
|
||||
monitor_rank_nosafepoint->lock_without_safepoint_check();
|
||||
monitor_rank_nosafepoint->unlock();
|
||||
}
|
||||
|
||||
TEST_VM_ASSERT_MSG(MutexRank, monitor_negative_rank,
|
||||
|
@ -42,9 +42,9 @@ TEST_VM_ASSERT_MSG(SafepointLockAssertTest, never_check,
|
||||
Mutex::_safepoint_check_flag);
|
||||
}
|
||||
|
||||
TEST_VM_ASSERT_MSG(SafepointLockAssertTest, special_locks,
|
||||
TEST_VM_ASSERT_MSG(SafepointLockAssertTest, nosafepoint_locks,
|
||||
".*Locks below nosafepoint rank should never safepoint: SpecialTest_lock") {
|
||||
MutexLocker ml(new Mutex(Mutex::special, "SpecialTest_lock", Mutex::_safepoint_check_always),
|
||||
MutexLocker ml(new Mutex(Mutex::nosafepoint, "SpecialTest_lock", Mutex::_safepoint_check_always),
|
||||
Mutex::_safepoint_check_flag);
|
||||
}
|
||||
|
||||
@ -52,10 +52,10 @@ TEST_VM_ASSERT_MSG(SafepointLockAssertTest, possible_safepoint_lock,
|
||||
".* Possible safepoint reached by thread that does not allow it") {
|
||||
JavaThread* thread = JavaThread::current();
|
||||
ThreadInVMfromNative in_native(thread);
|
||||
MutexLocker ml(new Mutex(Mutex::special, "SpecialTest_lock", Mutex::_safepoint_check_never),
|
||||
MutexLocker ml(new Mutex(Mutex::nosafepoint, "SpecialTest_lock", Mutex::_safepoint_check_never),
|
||||
Mutex::_no_safepoint_check_flag);
|
||||
thread->print_thread_state_on(tty);
|
||||
// If the lock above succeeds, try to safepoint to test the NSV implied with this special lock.
|
||||
// If the lock above succeeds, try to safepoint to test the NSV implied with this nosafepoint lock.
|
||||
ThreadBlockInVM tbivm(thread);
|
||||
thread->print_thread_state_on(tty);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user