mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 22:34:27 +02:00
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:
parent
bb30bd7e0a
commit
1d76295d70
32 changed files with 447 additions and 134 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* Copyright 2012, 2013 SAP AG. All rights reserved.
|
* Copyright 2012, 2013 SAP AG. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
|
@ -45,7 +45,8 @@ void OSThread::pd_initialize() {
|
||||||
|
|
||||||
sigemptyset(&_caller_sigmask);
|
sigemptyset(&_caller_sigmask);
|
||||||
|
|
||||||
_startThread_lock = new Monitor(Mutex::event, "startThread_lock", true);
|
_startThread_lock = new Monitor(Mutex::event, "startThread_lock", true,
|
||||||
|
Monitor::_safepoint_check_never);
|
||||||
assert(_startThread_lock !=NULL, "check");
|
assert(_startThread_lock !=NULL, "check");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -43,7 +43,8 @@ void OSThread::pd_initialize() {
|
||||||
|
|
||||||
sigemptyset(&_caller_sigmask);
|
sigemptyset(&_caller_sigmask);
|
||||||
|
|
||||||
_startThread_lock = new Monitor(Mutex::event, "startThread_lock", true);
|
_startThread_lock = new Monitor(Mutex::event, "startThread_lock", true,
|
||||||
|
Monitor::_safepoint_check_never);
|
||||||
assert(_startThread_lock !=NULL, "check");
|
assert(_startThread_lock !=NULL, "check");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -39,7 +39,8 @@ void OSThread::pd_initialize() {
|
||||||
|
|
||||||
sigemptyset(&_caller_sigmask);
|
sigemptyset(&_caller_sigmask);
|
||||||
|
|
||||||
_startThread_lock = new Monitor(Mutex::event, "startThread_lock", true);
|
_startThread_lock = new Monitor(Mutex::event, "startThread_lock", true,
|
||||||
|
Monitor::_safepoint_check_never);
|
||||||
assert(_startThread_lock !=NULL, "check");
|
assert(_startThread_lock !=NULL, "check");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -81,7 +81,8 @@ ClassLoaderData::ClassLoaderData(Handle h_class_loader, bool is_anonymous, Depen
|
||||||
_metaspace(NULL), _unloading(false), _klasses(NULL),
|
_metaspace(NULL), _unloading(false), _klasses(NULL),
|
||||||
_claimed(0), _jmethod_ids(NULL), _handles(NULL), _deallocate_list(NULL),
|
_claimed(0), _jmethod_ids(NULL), _handles(NULL), _deallocate_list(NULL),
|
||||||
_next(NULL), _dependencies(dependencies),
|
_next(NULL), _dependencies(dependencies),
|
||||||
_metaspace_lock(new Mutex(Monitor::leaf+1, "Metaspace allocation lock", true)) {
|
_metaspace_lock(new Mutex(Monitor::leaf+1, "Metaspace allocation lock", true,
|
||||||
|
Monitor::_safepoint_check_never)) {
|
||||||
// empty
|
// empty
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -83,9 +83,11 @@ CompactibleFreeListSpace::CompactibleFreeListSpace(BlockOffsetSharedArray* bs,
|
||||||
// Note: this requires that CFLspace c'tors
|
// Note: this requires that CFLspace c'tors
|
||||||
// are called serially in the order in which the locks are
|
// are called serially in the order in which the locks are
|
||||||
// are acquired in the program text. This is true today.
|
// are acquired in the program text. This is true today.
|
||||||
_freelistLock(_lockRank--, "CompactibleFreeListSpace._lock", true),
|
_freelistLock(_lockRank--, "CompactibleFreeListSpace._lock", true,
|
||||||
|
Monitor::_safepoint_check_sometimes),
|
||||||
_parDictionaryAllocLock(Mutex::leaf - 1, // == rank(ExpandHeap_lock) - 1
|
_parDictionaryAllocLock(Mutex::leaf - 1, // == rank(ExpandHeap_lock) - 1
|
||||||
"CompactibleFreeListSpace._dict_par_lock", true),
|
"CompactibleFreeListSpace._dict_par_lock", true,
|
||||||
|
Monitor::_safepoint_check_never),
|
||||||
_rescan_task_size(CardTableModRefBS::card_size_in_words * BitsPerWord *
|
_rescan_task_size(CardTableModRefBS::card_size_in_words * BitsPerWord *
|
||||||
CMSRescanMultiple),
|
CMSRescanMultiple),
|
||||||
_marking_task_size(CardTableModRefBS::card_size_in_words * BitsPerWord *
|
_marking_task_size(CardTableModRefBS::card_size_in_words * BitsPerWord *
|
||||||
|
@ -152,8 +154,7 @@ CompactibleFreeListSpace::CompactibleFreeListSpace(BlockOffsetSharedArray* bs,
|
||||||
// Initialize locks for parallel case.
|
// Initialize locks for parallel case.
|
||||||
for (size_t i = IndexSetStart; i < IndexSetSize; i += IndexSetStride) {
|
for (size_t i = IndexSetStart; i < IndexSetSize; i += IndexSetStride) {
|
||||||
_indexedFreeListParLocks[i] = new Mutex(Mutex::leaf - 1, // == ExpandHeap_lock - 1
|
_indexedFreeListParLocks[i] = new Mutex(Mutex::leaf - 1, // == ExpandHeap_lock - 1
|
||||||
"a freelist par lock",
|
"a freelist par lock", true, Mutex::_safepoint_check_sometimes);
|
||||||
true);
|
|
||||||
DEBUG_ONLY(
|
DEBUG_ONLY(
|
||||||
_indexedFreeList[i].set_protecting_lock(_indexedFreeListParLocks[i]);
|
_indexedFreeList[i].set_protecting_lock(_indexedFreeListParLocks[i]);
|
||||||
)
|
)
|
||||||
|
|
|
@ -479,7 +479,9 @@ CMSCollector::CMSCollector(ConcurrentMarkSweepGeneration* cmsGen,
|
||||||
_restart_addr(NULL),
|
_restart_addr(NULL),
|
||||||
_overflow_list(NULL),
|
_overflow_list(NULL),
|
||||||
_stats(cmsGen),
|
_stats(cmsGen),
|
||||||
_eden_chunk_lock(new Mutex(Mutex::leaf + 1, "CMS_eden_chunk_lock", true)),
|
_eden_chunk_lock(new Mutex(Mutex::leaf + 1, "CMS_eden_chunk_lock", true,
|
||||||
|
//verify that this lock should be acquired with safepoint check.
|
||||||
|
Monitor::_safepoint_check_sometimes)),
|
||||||
_eden_chunk_array(NULL), // may be set in ctor body
|
_eden_chunk_array(NULL), // may be set in ctor body
|
||||||
_eden_chunk_capacity(0), // -- ditto --
|
_eden_chunk_capacity(0), // -- ditto --
|
||||||
_eden_chunk_index(0), // -- ditto --
|
_eden_chunk_index(0), // -- ditto --
|
||||||
|
@ -6031,7 +6033,8 @@ HeapWord* CMSCollector::next_card_start_after_block(HeapWord* addr) const {
|
||||||
CMSBitMap::CMSBitMap(int shifter, int mutex_rank, const char* mutex_name):
|
CMSBitMap::CMSBitMap(int shifter, int mutex_rank, const char* mutex_name):
|
||||||
_bm(),
|
_bm(),
|
||||||
_shifter(shifter),
|
_shifter(shifter),
|
||||||
_lock(mutex_rank >= 0 ? new Mutex(mutex_rank, mutex_name, true) : NULL)
|
_lock(mutex_rank >= 0 ? new Mutex(mutex_rank, mutex_name, true,
|
||||||
|
Monitor::_safepoint_check_sometimes) : NULL)
|
||||||
{
|
{
|
||||||
_bmStartWord = 0;
|
_bmStartWord = 0;
|
||||||
_bmWordSize = 0;
|
_bmWordSize = 0;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -188,7 +188,8 @@ class CMSMarkStack: public CHeapObj<mtGC> {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CMSMarkStack():
|
CMSMarkStack():
|
||||||
_par_lock(Mutex::event, "CMSMarkStack._par_lock", true),
|
_par_lock(Mutex::event, "CMSMarkStack._par_lock", true,
|
||||||
|
Monitor::_safepoint_check_never),
|
||||||
_hit_limit(0),
|
_hit_limit(0),
|
||||||
_failed_double(0) {}
|
_failed_double(0) {}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -52,7 +52,8 @@ ConcurrentG1RefineThread(ConcurrentG1Refine* cg1r, ConcurrentG1RefineThread *nex
|
||||||
// The 0th worker in notified by mutator threads and has a special monitor.
|
// The 0th worker in notified by mutator threads and has a special monitor.
|
||||||
// The last worker is used for young gen rset size sampling.
|
// The last worker is used for young gen rset size sampling.
|
||||||
if (worker_id > 0) {
|
if (worker_id > 0) {
|
||||||
_monitor = new Monitor(Mutex::nonleaf, "Refinement monitor", true);
|
_monitor = new Monitor(Mutex::nonleaf, "Refinement monitor", true,
|
||||||
|
Monitor::_safepoint_check_never);
|
||||||
} else {
|
} else {
|
||||||
_monitor = DirtyCardQ_CBL_mon;
|
_monitor = DirtyCardQ_CBL_mon;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4933,7 +4933,7 @@ private:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Monitor* G1CodeCacheUnloadingTask::_lock = new Monitor(Mutex::leaf, "Code Cache Unload lock");
|
Monitor* G1CodeCacheUnloadingTask::_lock = new Monitor(Mutex::leaf, "Code Cache Unload lock", false, Monitor::_safepoint_check_never);
|
||||||
|
|
||||||
class G1KlassCleaningTask : public StackObj {
|
class G1KlassCleaningTask : public StackObj {
|
||||||
BoolObjectClosure* _is_alive;
|
BoolObjectClosure* _is_alive;
|
||||||
|
|
|
@ -840,7 +840,7 @@ uint HeapRegionRemSet::num_par_rem_sets() {
|
||||||
HeapRegionRemSet::HeapRegionRemSet(G1BlockOffsetSharedArray* bosa,
|
HeapRegionRemSet::HeapRegionRemSet(G1BlockOffsetSharedArray* bosa,
|
||||||
HeapRegion* hr)
|
HeapRegion* hr)
|
||||||
: _bosa(bosa),
|
: _bosa(bosa),
|
||||||
_m(Mutex::leaf, FormatBuffer<128>("HeapRegionRemSet lock #%u", hr->hrm_index()), true),
|
_m(Mutex::leaf, FormatBuffer<128>("HeapRegionRemSet lock #%u", hr->hrm_index()), true, Monitor::_safepoint_check_never),
|
||||||
_code_roots(), _other_regions(hr, &_m), _iter_state(Unclaimed), _iter_claimed(0) {
|
_code_roots(), _other_regions(hr, &_m), _iter_state(Unclaimed), _iter_claimed(0) {
|
||||||
reset_for_par_iteration();
|
reset_for_par_iteration();
|
||||||
}
|
}
|
||||||
|
|
|
@ -400,7 +400,8 @@ void GCTaskManager::initialize() {
|
||||||
assert(workers() != 0, "no workers");
|
assert(workers() != 0, "no workers");
|
||||||
_monitor = new Monitor(Mutex::barrier, // rank
|
_monitor = new Monitor(Mutex::barrier, // rank
|
||||||
"GCTaskManager monitor", // name
|
"GCTaskManager monitor", // name
|
||||||
Mutex::_allow_vm_block_flag); // allow_vm_block
|
Mutex::_allow_vm_block_flag, // allow_vm_block
|
||||||
|
Monitor::_safepoint_check_never);
|
||||||
// The queue for the GCTaskManager must be a CHeapObj.
|
// The queue for the GCTaskManager must be a CHeapObj.
|
||||||
GCTaskQueue* unsynchronized_queue = GCTaskQueue::create_on_c_heap();
|
GCTaskQueue* unsynchronized_queue = GCTaskQueue::create_on_c_heap();
|
||||||
_queue = SynchronizedGCTaskQueue::create(unsynchronized_queue, lock());
|
_queue = SynchronizedGCTaskQueue::create(unsynchronized_queue, lock());
|
||||||
|
@ -1125,7 +1126,8 @@ Monitor* MonitorSupply::reserve() {
|
||||||
} else {
|
} else {
|
||||||
result = new Monitor(Mutex::barrier, // rank
|
result = new Monitor(Mutex::barrier, // rank
|
||||||
"MonitorSupply monitor", // name
|
"MonitorSupply monitor", // name
|
||||||
Mutex::_allow_vm_block_flag); // allow_vm_block
|
Mutex::_allow_vm_block_flag, // allow_vm_block
|
||||||
|
Monitor::_safepoint_check_never);
|
||||||
}
|
}
|
||||||
guarantee(result != NULL, "shouldn't return NULL");
|
guarantee(result != NULL, "shouldn't return NULL");
|
||||||
assert(!result->is_locked(), "shouldn't be locked");
|
assert(!result->is_locked(), "shouldn't be locked");
|
||||||
|
|
|
@ -88,7 +88,8 @@ static void _sltLoop(JavaThread* thread, TRAPS) {
|
||||||
|
|
||||||
SurrogateLockerThread::SurrogateLockerThread() :
|
SurrogateLockerThread::SurrogateLockerThread() :
|
||||||
JavaThread(&_sltLoop),
|
JavaThread(&_sltLoop),
|
||||||
_monitor(Mutex::nonleaf, "SLTMonitor"),
|
_monitor(Mutex::nonleaf, "SLTMonitor", false,
|
||||||
|
Monitor::_safepoint_check_sometimes),
|
||||||
_buffer(empty)
|
_buffer(empty)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
|
@ -792,7 +792,8 @@ const int SpaceManager::_expand_lock_rank = Monitor::leaf - 1;
|
||||||
Mutex* const SpaceManager::_expand_lock =
|
Mutex* const SpaceManager::_expand_lock =
|
||||||
new Mutex(SpaceManager::_expand_lock_rank,
|
new Mutex(SpaceManager::_expand_lock_rank,
|
||||||
SpaceManager::_expand_lock_name,
|
SpaceManager::_expand_lock_name,
|
||||||
Mutex::_allow_vm_block_flag);
|
Mutex::_allow_vm_block_flag,
|
||||||
|
Monitor::_safepoint_check_never);
|
||||||
|
|
||||||
void VirtualSpaceNode::inc_container_count() {
|
void VirtualSpaceNode::inc_container_count() {
|
||||||
assert_lock_strong(SpaceManager::expand_lock());
|
assert_lock_strong(SpaceManager::expand_lock());
|
||||||
|
|
|
@ -152,7 +152,7 @@ SharedHeap::StrongRootsScope::~StrongRootsScope() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Monitor* SharedHeap::StrongRootsScope::_lock = new Monitor(Mutex::leaf, "StrongRootsScope lock", false);
|
Monitor* SharedHeap::StrongRootsScope::_lock = new Monitor(Mutex::leaf, "StrongRootsScope lock", false, Monitor::_safepoint_check_never);
|
||||||
|
|
||||||
void SharedHeap::StrongRootsScope::mark_worker_done_with_threads(uint n_workers) {
|
void SharedHeap::StrongRootsScope::mark_worker_done_with_threads(uint n_workers) {
|
||||||
// The Thread work barrier is only needed by G1 Class Unloading.
|
// The Thread work barrier is only needed by G1 Class Unloading.
|
||||||
|
|
|
@ -1078,6 +1078,14 @@ WB_ENTRY(jlong, WB_MetaspaceCapacityUntilGC(JNIEnv* env, jobject wb))
|
||||||
return (jlong) MetaspaceGC::capacity_until_GC();
|
return (jlong) MetaspaceGC::capacity_until_GC();
|
||||||
WB_END
|
WB_END
|
||||||
|
|
||||||
|
WB_ENTRY(void, WB_AssertMatchingSafepointCalls(JNIEnv* env, jobject o, jboolean mutexSafepointValue, jboolean attemptedNoSafepointValue))
|
||||||
|
Monitor::SafepointCheckRequired sfpt_check_required = mutexSafepointValue ?
|
||||||
|
Monitor::_safepoint_check_always :
|
||||||
|
Monitor::_safepoint_check_never;
|
||||||
|
MutexLockerEx ml(new Mutex(Mutex::leaf, "SFPT_Test_lock", true, sfpt_check_required),
|
||||||
|
attemptedNoSafepointValue == JNI_TRUE);
|
||||||
|
WB_END
|
||||||
|
|
||||||
//Some convenience methods to deal with objects from java
|
//Some convenience methods to deal with objects from java
|
||||||
int WhiteBox::offset_for_field(const char* field_name, oop object,
|
int WhiteBox::offset_for_field(const char* field_name, oop object,
|
||||||
Symbol* signature_symbol) {
|
Symbol* signature_symbol) {
|
||||||
|
@ -1274,6 +1282,7 @@ static JNINativeMethod methods[] = {
|
||||||
{CC"getCodeBlob", CC"(J)[Ljava/lang/Object;",(void*)&WB_GetCodeBlob },
|
{CC"getCodeBlob", CC"(J)[Ljava/lang/Object;",(void*)&WB_GetCodeBlob },
|
||||||
{CC"getThreadStackSize", CC"()J", (void*)&WB_GetThreadStackSize },
|
{CC"getThreadStackSize", CC"()J", (void*)&WB_GetThreadStackSize },
|
||||||
{CC"getThreadRemainingStackSize", CC"()J", (void*)&WB_GetThreadRemainingStackSize },
|
{CC"getThreadRemainingStackSize", CC"()J", (void*)&WB_GetThreadRemainingStackSize },
|
||||||
|
{CC"assertMatchingSafepointCalls", CC"(ZZ)V", (void*)&WB_AssertMatchingSafepointCalls },
|
||||||
};
|
};
|
||||||
|
|
||||||
#undef CC
|
#undef CC
|
||||||
|
|
|
@ -895,6 +895,11 @@ int Monitor::IWait(Thread * Self, jlong timo) {
|
||||||
// of Mutex-Monitor and instead directly address the underlying design flaw.
|
// of Mutex-Monitor and instead directly address the underlying design flaw.
|
||||||
|
|
||||||
void Monitor::lock(Thread * Self) {
|
void Monitor::lock(Thread * Self) {
|
||||||
|
// Ensure that the Monitor requires/allows safepoint checks.
|
||||||
|
assert(_safepoint_check_required != Monitor::_safepoint_check_never,
|
||||||
|
err_msg("This lock should never have a safepoint check: %s",
|
||||||
|
name()));
|
||||||
|
|
||||||
#ifdef CHECK_UNHANDLED_OOPS
|
#ifdef CHECK_UNHANDLED_OOPS
|
||||||
// Clear unhandled oops so we get a crash right away. Only clear for non-vm
|
// Clear unhandled oops so we get a crash right away. Only clear for non-vm
|
||||||
// or GC threads.
|
// or GC threads.
|
||||||
|
@ -953,6 +958,10 @@ void Monitor::lock() {
|
||||||
// thread state set to be in VM, the safepoint synchronization code will deadlock!
|
// thread state set to be in VM, the safepoint synchronization code will deadlock!
|
||||||
|
|
||||||
void Monitor::lock_without_safepoint_check(Thread * Self) {
|
void Monitor::lock_without_safepoint_check(Thread * Self) {
|
||||||
|
// Ensure that the Monitor does not require or allow safepoint checks.
|
||||||
|
assert(_safepoint_check_required != Monitor::_safepoint_check_always,
|
||||||
|
err_msg("This lock should always have a safepoint check: %s",
|
||||||
|
name()));
|
||||||
assert(_owner != Self, "invariant");
|
assert(_owner != Self, "invariant");
|
||||||
ILock(Self);
|
ILock(Self);
|
||||||
assert(_owner == NULL, "invariant");
|
assert(_owner == NULL, "invariant");
|
||||||
|
@ -1082,6 +1091,12 @@ void Monitor::jvm_raw_unlock() {
|
||||||
|
|
||||||
bool Monitor::wait(bool no_safepoint_check, long timeout,
|
bool Monitor::wait(bool no_safepoint_check, long timeout,
|
||||||
bool as_suspend_equivalent) {
|
bool as_suspend_equivalent) {
|
||||||
|
// Make sure safepoint checking is used properly.
|
||||||
|
assert(!(_safepoint_check_required == Monitor::_safepoint_check_never && no_safepoint_check == false),
|
||||||
|
err_msg("This lock should never have a safepoint check: %s", name()));
|
||||||
|
assert(!(_safepoint_check_required == Monitor::_safepoint_check_always && no_safepoint_check == true),
|
||||||
|
err_msg("This lock should always have a safepoint check: %s", name()));
|
||||||
|
|
||||||
Thread * const Self = Thread::current();
|
Thread * const Self = Thread::current();
|
||||||
assert(_owner == Self, "invariant");
|
assert(_owner == Self, "invariant");
|
||||||
assert(ILocked(), "invariant");
|
assert(ILocked(), "invariant");
|
||||||
|
@ -1168,11 +1183,13 @@ void Monitor::ClearMonitor(Monitor * m, const char *name) {
|
||||||
|
|
||||||
Monitor::Monitor() { ClearMonitor(this); }
|
Monitor::Monitor() { ClearMonitor(this); }
|
||||||
|
|
||||||
Monitor::Monitor(int Rank, const char * name, bool allow_vm_block) {
|
Monitor::Monitor(int Rank, const char * name, bool allow_vm_block,
|
||||||
|
SafepointCheckRequired safepoint_check_required) {
|
||||||
ClearMonitor(this, name);
|
ClearMonitor(this, name);
|
||||||
#ifdef ASSERT
|
#ifdef ASSERT
|
||||||
_allow_vm_block = allow_vm_block;
|
_allow_vm_block = allow_vm_block;
|
||||||
_rank = Rank;
|
_rank = Rank;
|
||||||
|
NOT_PRODUCT(_safepoint_check_required = safepoint_check_required;)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1180,11 +1197,13 @@ Mutex::~Mutex() {
|
||||||
assert((UNS(_owner)|UNS(_LockWord.FullWord)|UNS(_EntryList)|UNS(_WaitSet)|UNS(_OnDeck)) == 0, "");
|
assert((UNS(_owner)|UNS(_LockWord.FullWord)|UNS(_EntryList)|UNS(_WaitSet)|UNS(_OnDeck)) == 0, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
Mutex::Mutex(int Rank, const char * name, bool allow_vm_block) {
|
Mutex::Mutex(int Rank, const char * name, bool allow_vm_block,
|
||||||
|
SafepointCheckRequired safepoint_check_required) {
|
||||||
ClearMonitor((Monitor *) this, name);
|
ClearMonitor((Monitor *) this, name);
|
||||||
#ifdef ASSERT
|
#ifdef ASSERT
|
||||||
_allow_vm_block = allow_vm_block;
|
_allow_vm_block = allow_vm_block;
|
||||||
_rank = Rank;
|
_rank = Rank;
|
||||||
|
NOT_PRODUCT(_safepoint_check_required = safepoint_check_required;)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -154,6 +154,24 @@ class Monitor : public CHeapObj<mtInternal> {
|
||||||
_as_suspend_equivalent_flag = true
|
_as_suspend_equivalent_flag = true
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Locks can be acquired with or without safepoint check.
|
||||||
|
// Monitor::lock and Monitor::lock_without_safepoint_check
|
||||||
|
// checks these flags when acquiring a lock to ensure
|
||||||
|
// consistent checking for each lock.
|
||||||
|
// A few existing locks will sometimes have a safepoint check and
|
||||||
|
// sometimes not, but these locks are set up in such a way to avoid deadlocks.
|
||||||
|
enum SafepointCheckRequired {
|
||||||
|
_safepoint_check_never, // Monitors with this value will cause errors
|
||||||
|
// when acquired with a safepoint check.
|
||||||
|
_safepoint_check_sometimes, // Certain locks are called sometimes with and
|
||||||
|
// sometimes without safepoint checks. These
|
||||||
|
// locks will not produce errors when locked.
|
||||||
|
_safepoint_check_always // Causes error if locked without a safepoint
|
||||||
|
// check.
|
||||||
|
};
|
||||||
|
|
||||||
|
NOT_PRODUCT(SafepointCheckRequired _safepoint_check_required;)
|
||||||
|
|
||||||
enum WaitResults {
|
enum WaitResults {
|
||||||
CONDVAR_EVENT, // Wait returned because of condition variable notification
|
CONDVAR_EVENT, // Wait returned because of condition variable notification
|
||||||
INTERRUPT_EVENT, // Wait returned because waiting thread was interrupted
|
INTERRUPT_EVENT, // Wait returned because waiting thread was interrupted
|
||||||
|
@ -175,7 +193,8 @@ class Monitor : public CHeapObj<mtInternal> {
|
||||||
Monitor() ;
|
Monitor() ;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Monitor(int rank, const char *name, bool allow_vm_block=false);
|
Monitor(int rank, const char *name, bool allow_vm_block = false,
|
||||||
|
SafepointCheckRequired safepoint_check_required = _safepoint_check_always);
|
||||||
~Monitor();
|
~Monitor();
|
||||||
|
|
||||||
// Wait until monitor is notified (or times out).
|
// Wait until monitor is notified (or times out).
|
||||||
|
@ -261,7 +280,8 @@ class Monitor : public CHeapObj<mtInternal> {
|
||||||
|
|
||||||
class Mutex : public Monitor { // degenerate Monitor
|
class Mutex : public Monitor { // degenerate Monitor
|
||||||
public:
|
public:
|
||||||
Mutex (int rank, const char *name, bool allow_vm_block=false);
|
Mutex(int rank, const char *name, bool allow_vm_block = false,
|
||||||
|
SafepointCheckRequired safepoint_check_required = _safepoint_check_always);
|
||||||
~Mutex () ;
|
~Mutex () ;
|
||||||
private:
|
private:
|
||||||
bool notify () { ShouldNotReachHere(); return false; }
|
bool notify () { ShouldNotReachHere(); return false; }
|
||||||
|
|
|
@ -167,131 +167,133 @@ void assert_lock_strong(const Monitor * lock) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define def(var, type, pri, vm_block) { \
|
#define def(var, type, pri, vm_block, safepoint_check_allowed ) { \
|
||||||
var = new type(Mutex::pri, #var, vm_block); \
|
var = new type(Mutex::pri, #var, vm_block, safepoint_check_allowed); \
|
||||||
assert(_num_mutex < MAX_NUM_MUTEX, \
|
assert(_num_mutex < MAX_NUM_MUTEX, "increase MAX_NUM_MUTEX"); \
|
||||||
"increase MAX_NUM_MUTEX"); \
|
_mutex_array[_num_mutex] = var; \
|
||||||
_mutex_array[_num_mutex++] = var; \
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void mutex_init() {
|
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) {
|
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) {
|
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(CMark_lock , Monitor, nonleaf, true, Monitor::_safepoint_check_never); // coordinate concurrent mark thread
|
||||||
def(DirtyCardQ_CBL_mon , Monitor, nonleaf, true );
|
def(CMRegionStack_lock , Mutex, leaf, true, Monitor::_safepoint_check_never);
|
||||||
def(Shared_DirtyCardQ_lock , Mutex, nonleaf, true );
|
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(DirtyCardQ_FL_lock , Mutex , special, true, Monitor::_safepoint_check_never);
|
||||||
def(SecondaryFreeList_lock , Monitor, leaf , true );
|
def(DirtyCardQ_CBL_mon , Monitor, nonleaf, true, Monitor::_safepoint_check_never);
|
||||||
def(OldSets_lock , Mutex , leaf , true );
|
def(Shared_DirtyCardQ_lock , Mutex, nonleaf, true, Monitor::_safepoint_check_never);
|
||||||
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(StringDedupQueue_lock , Monitor, leaf, true );
|
def(FreeList_lock , Mutex, leaf , true, Monitor::_safepoint_check_never);
|
||||||
def(StringDedupTable_lock , Mutex , leaf, true );
|
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(ParGCRareEvent_lock , Mutex , leaf , true, Monitor::_safepoint_check_sometimes);
|
||||||
def(DerivedPointerTableGC_lock , Mutex, leaf, true );
|
def(DerivedPointerTableGC_lock , Mutex, leaf, true, Monitor::_safepoint_check_never);
|
||||||
def(CodeCache_lock , Monitor, special, true );
|
def(CodeCache_lock , Mutex , special, true, Monitor::_safepoint_check_never);
|
||||||
def(Interrupt_lock , Monitor, special, true ); // used for interrupt processing
|
def(Interrupt_lock , Monitor, special, true, Monitor::_safepoint_check_never); // used for interrupt processing
|
||||||
def(RawMonitor_lock , Mutex, special, true );
|
def(RawMonitor_lock , Mutex, special, true, Monitor::_safepoint_check_never);
|
||||||
def(OopMapCacheAlloc_lock , Mutex, leaf, true ); // used for oop_map_cache allocation.
|
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(Patching_lock , Mutex , special, true, Monitor::_safepoint_check_never); // used for safepointing and code patching.
|
||||||
def(ObjAllocPost_lock , Monitor, special, false);
|
def(ObjAllocPost_lock , Monitor, special, false, Monitor::_safepoint_check_never);
|
||||||
def(Service_lock , Monitor, special, true ); // used for service thread operations
|
def(Service_lock , Monitor, special, true, Monitor::_safepoint_check_never); // used for service thread operations
|
||||||
def(JmethodIdCreation_lock , Mutex , leaf, true ); // used for creating jmethodIDs.
|
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(SystemDictionary_lock , Monitor, leaf, true, Monitor::_safepoint_check_always); // lookups done by VM thread
|
||||||
def(PackageTable_lock , Mutex , leaf, false);
|
def(PackageTable_lock , Mutex , leaf, false, Monitor::_safepoint_check_always);
|
||||||
def(InlineCacheBuffer_lock , Mutex , leaf, true );
|
def(InlineCacheBuffer_lock , Mutex , leaf, true, Monitor::_safepoint_check_always);
|
||||||
def(VMStatistic_lock , Mutex , leaf, false);
|
def(VMStatistic_lock , Mutex , leaf, false, Monitor::_safepoint_check_always);
|
||||||
def(ExpandHeap_lock , Mutex , leaf, true ); // Used during compilation by VM thread
|
def(ExpandHeap_lock , Mutex , leaf, true, Monitor::_safepoint_check_always); // Used during compilation by VM thread
|
||||||
def(JNIHandleBlockFreeList_lock , Mutex , leaf, true ); // handles are used 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);
|
def(SignatureHandlerLibrary_lock , Mutex , leaf, false, Monitor::_safepoint_check_always);
|
||||||
def(SymbolTable_lock , Mutex , leaf+2, true );
|
def(SymbolTable_lock , Mutex , leaf+2, true, Monitor::_safepoint_check_always);
|
||||||
def(StringTable_lock , Mutex , leaf, true );
|
def(StringTable_lock , Mutex , leaf, true, Monitor::_safepoint_check_always);
|
||||||
def(ProfilePrint_lock , Mutex , leaf, false); // serial profile printing
|
def(ProfilePrint_lock , Mutex , leaf, false, Monitor::_safepoint_check_always); // serial profile printing
|
||||||
def(ExceptionCache_lock , Mutex , leaf, false); // serial profile printing
|
def(ExceptionCache_lock , Mutex , leaf, false, Monitor::_safepoint_check_always); // serial profile printing
|
||||||
def(OsrList_lock , Mutex , leaf, true );
|
def(OsrList_lock , Mutex , leaf, true, Monitor::_safepoint_check_never);
|
||||||
def(Debug1_lock , Mutex , leaf, true );
|
def(Debug1_lock , Mutex , leaf, true, Monitor::_safepoint_check_never);
|
||||||
#ifndef PRODUCT
|
#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
|
#endif
|
||||||
def(BeforeExit_lock , Monitor, leaf, true );
|
def(BeforeExit_lock , Monitor, leaf, true, Monitor::_safepoint_check_always);
|
||||||
def(PerfDataMemAlloc_lock , Mutex , leaf, true ); // used for allocating PerfData memory for performance data
|
def(PerfDataMemAlloc_lock , Mutex , leaf, true, Monitor::_safepoint_check_always); // used for allocating PerfData memory for performance data
|
||||||
def(PerfDataManager_lock , Mutex , leaf, true ); // used for synchronized access to PerfDataManager resources
|
def(PerfDataManager_lock , Mutex , leaf, true, Monitor::_safepoint_check_always); // used for synchronized access to PerfDataManager resources
|
||||||
|
|
||||||
// CMS_modUnionTable_lock leaf
|
// CMS_modUnionTable_lock leaf
|
||||||
// CMS_bitMap_lock leaf + 1
|
// CMS_bitMap_lock leaf 1
|
||||||
// CMS_freeList_lock leaf + 2
|
// 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(VMOperationQueue_lock , Monitor, nonleaf, true, Monitor::_safepoint_check_sometimes); // VM_thread allowed to block on these
|
||||||
def(VMOperationRequest_lock , Monitor, nonleaf, true );
|
def(VMOperationRequest_lock , Monitor, nonleaf, true, Monitor::_safepoint_check_sometimes);
|
||||||
def(RetData_lock , Mutex , nonleaf, false);
|
def(RetData_lock , Mutex , nonleaf, false, Monitor::_safepoint_check_always);
|
||||||
def(Terminator_lock , Monitor, nonleaf, true );
|
def(Terminator_lock , Monitor, nonleaf, true, Monitor::_safepoint_check_sometimes);
|
||||||
def(VtableStubs_lock , Mutex , nonleaf, true );
|
def(VtableStubs_lock , Mutex , nonleaf, true, Monitor::_safepoint_check_always);
|
||||||
def(Notify_lock , Monitor, nonleaf, true );
|
def(Notify_lock , Monitor, nonleaf, true, Monitor::_safepoint_check_always);
|
||||||
def(JNIGlobalHandle_lock , Mutex , nonleaf, true ); // locks JNIHandleBlockFreeList_lock
|
def(JNIGlobalHandle_lock , Mutex , nonleaf, true, Monitor::_safepoint_check_always); // locks JNIHandleBlockFreeList_lock
|
||||||
def(JNICritical_lock , Monitor, nonleaf, true ); // used for JNI critical regions
|
def(JNICritical_lock , Monitor, nonleaf, true, Monitor::_safepoint_check_always); // used for JNI critical regions
|
||||||
def(AdapterHandlerLibrary_lock , Mutex , nonleaf, true);
|
def(AdapterHandlerLibrary_lock , Mutex , nonleaf, true, Monitor::_safepoint_check_always);
|
||||||
if (UseConcMarkSweepGC) {
|
if (UseConcMarkSweepGC) {
|
||||||
def(SLT_lock , Monitor, nonleaf, false );
|
def(SLT_lock , Monitor, nonleaf, false, Monitor::_safepoint_check_never); // used in CMS GC for locking PLL lock
|
||||||
// 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(Heap_lock , Monitor, nonleaf+1, false, Monitor::_safepoint_check_sometimes);
|
||||||
def(CompileTaskAlloc_lock , Mutex , nonleaf+2, true );
|
def(JfieldIdCreation_lock , Mutex , nonleaf+1, true, Monitor::_safepoint_check_always); // jfieldID, Used in VM_Operation
|
||||||
def(CompileStatistics_lock , Mutex , nonleaf+2, false);
|
def(MemberNameTable_lock , Mutex , nonleaf+1, false, Monitor::_safepoint_check_always); // Used to protect MemberNameTable
|
||||||
def(MultiArray_lock , Mutex , nonleaf+2, false); // locks SymbolTable_lock
|
|
||||||
|
|
||||||
def(JvmtiThreadState_lock , Mutex , nonleaf+2, false); // Used by JvmtiThreadState/JvmtiEventController
|
def(CompiledIC_lock , Mutex , nonleaf+2, false, Monitor::_safepoint_check_always); // locks VtableStubs_lock, InlineCacheBuffer_lock
|
||||||
def(JvmtiPendingEvent_lock , Monitor, nonleaf, false); // Used by JvmtiCodeBlobEvents
|
def(CompileTaskAlloc_lock , Mutex , nonleaf+2, true, Monitor::_safepoint_check_always);
|
||||||
def(Management_lock , Mutex , nonleaf+2, false); // used for JVM management
|
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(JvmtiThreadState_lock , Mutex , nonleaf+2, false, Monitor::_safepoint_check_always); // Used by JvmtiThreadState/JvmtiEventController
|
||||||
def(MethodData_lock , Mutex , nonleaf+3, false);
|
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(Compile_lock , Mutex , nonleaf+3, true, Monitor::_safepoint_check_sometimes);
|
||||||
def(Debug2_lock , Mutex , nonleaf+4, true );
|
def(MethodData_lock , Mutex , nonleaf+3, false, Monitor::_safepoint_check_always);
|
||||||
def(Debug3_lock , Mutex , nonleaf+4, true );
|
|
||||||
def(ProfileVM_lock , Monitor, special, false); // used for profiling of the VMThread
|
def(MethodCompileQueue_lock , Monitor, nonleaf+4, true, Monitor::_safepoint_check_always);
|
||||||
def(CompileThread_lock , Monitor, nonleaf+5, false );
|
def(Debug2_lock , Mutex , nonleaf+4, true, Monitor::_safepoint_check_never);
|
||||||
def(PeriodicTask_lock , Monitor, nonleaf+5, true);
|
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) {
|
if (WhiteBoxAPI) {
|
||||||
def(Compilation_lock , Monitor, leaf, false );
|
def(Compilation_lock , Monitor, leaf, false, Monitor::_safepoint_check_never);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef INCLUDE_TRACE
|
#ifdef INCLUDE_TRACE
|
||||||
def(JfrMsg_lock , Monitor, leaf, true);
|
def(JfrMsg_lock , Monitor, leaf, true, Monitor::_safepoint_check_always);
|
||||||
def(JfrBuffer_lock , Mutex, leaf, true);
|
def(JfrBuffer_lock , Mutex, leaf, true, Monitor::_safepoint_check_never);
|
||||||
def(JfrThreadGroups_lock , Mutex, leaf, true);
|
def(JfrThreadGroups_lock , Mutex, leaf, true, Monitor::_safepoint_check_always);
|
||||||
def(JfrStream_lock , Mutex, nonleaf, true);
|
def(JfrStream_lock , Mutex, nonleaf, true, Monitor::_safepoint_check_never);
|
||||||
def(JfrStacktrace_lock , Mutex, special, true);
|
def(JfrStacktrace_lock , Mutex, special, true, Monitor::_safepoint_check_sometimes);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef SUPPORTS_NATIVE_CX8
|
#ifndef SUPPORTS_NATIVE_CX8
|
||||||
def(UnsafeJlong_lock , Mutex, special, false);
|
def(UnsafeJlong_lock , Mutex, special, false, Monitor::_safepoint_check_never);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -158,7 +158,7 @@ Tickspan NMethodSweeper::_total_time_this_sweep; // Total time thi
|
||||||
Tickspan NMethodSweeper::_peak_sweep_time; // Peak time for a full sweep
|
Tickspan NMethodSweeper::_peak_sweep_time; // Peak time for a full sweep
|
||||||
Tickspan NMethodSweeper::_peak_sweep_fraction_time; // Peak time sweeping one fraction
|
Tickspan NMethodSweeper::_peak_sweep_fraction_time; // Peak time sweeping one fraction
|
||||||
|
|
||||||
Monitor* NMethodSweeper::_stat_lock = new Monitor(Mutex::special, "Sweeper::Statistics", true);
|
Monitor* NMethodSweeper::_stat_lock = new Monitor(Mutex::special, "Sweeper::Statistics", true, Monitor::_safepoint_check_sometimes);
|
||||||
|
|
||||||
class MarkActivationClosure: public CodeBlobClosure {
|
class MarkActivationClosure: public CodeBlobClosure {
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -230,7 +230,8 @@ Thread::Thread() {
|
||||||
_visited_for_critical_count = false;
|
_visited_for_critical_count = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
_SR_lock = new Monitor(Mutex::suspend_resume, "SR_lock", true);
|
_SR_lock = new Monitor(Mutex::suspend_resume, "SR_lock", true,
|
||||||
|
Monitor::_safepoint_check_sometimes);
|
||||||
_suspend_flags = 0;
|
_suspend_flags = 0;
|
||||||
|
|
||||||
// thread-specific hashCode stream generator state - Marsaglia shift-xor form
|
// thread-specific hashCode stream generator state - Marsaglia shift-xor form
|
||||||
|
|
|
@ -214,7 +214,8 @@ void VMThread::create() {
|
||||||
_vm_queue = new VMOperationQueue();
|
_vm_queue = new VMOperationQueue();
|
||||||
guarantee(_vm_queue != NULL, "just checking");
|
guarantee(_vm_queue != NULL, "just checking");
|
||||||
|
|
||||||
_terminate_lock = new Monitor(Mutex::safepoint, "VMThread::_terminate_lock", true);
|
_terminate_lock = new Monitor(Mutex::safepoint, "VMThread::_terminate_lock", true,
|
||||||
|
Monitor::_safepoint_check_never);
|
||||||
|
|
||||||
if (UsePerfData) {
|
if (UsePerfData) {
|
||||||
// jvmstat performance counters
|
// jvmstat performance counters
|
||||||
|
|
|
@ -391,7 +391,8 @@ int VM_Exit::wait_for_threads_in_native_to_block() {
|
||||||
assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint already");
|
assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint already");
|
||||||
|
|
||||||
Thread * thr_cur = ThreadLocalStorage::get_thread_slow();
|
Thread * thr_cur = ThreadLocalStorage::get_thread_slow();
|
||||||
Monitor timer(Mutex::leaf, "VM_Exit timer", true);
|
Monitor timer(Mutex::leaf, "VM_Exit timer", true,
|
||||||
|
Monitor::_safepoint_check_never);
|
||||||
|
|
||||||
// Compiler threads need longer wait because they can access VM data directly
|
// Compiler threads need longer wait because they can access VM data directly
|
||||||
// while in native. If they are active and some structures being used are
|
// while in native. If they are active and some structures being used are
|
||||||
|
|
|
@ -487,7 +487,7 @@ void DCmdFactory::send_notification_internal(TRAPS) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Mutex* DCmdFactory::_dcmdFactory_lock = new Mutex(Mutex::leaf, "DCmdFactory", true);
|
Mutex* DCmdFactory::_dcmdFactory_lock = new Mutex(Mutex::leaf, "DCmdFactory", true, Monitor::_safepoint_check_never);
|
||||||
bool DCmdFactory::_send_jmx_notification = false;
|
bool DCmdFactory::_send_jmx_notification = false;
|
||||||
|
|
||||||
DCmdFactory* DCmdFactory::factory(DCmdSource source, const char* name, size_t len) {
|
DCmdFactory* DCmdFactory::factory(DCmdSource source, const char* name, size_t len) {
|
||||||
|
|
|
@ -198,7 +198,8 @@ void GCStatInfo::clear() {
|
||||||
GCMemoryManager::GCMemoryManager() : MemoryManager() {
|
GCMemoryManager::GCMemoryManager() : MemoryManager() {
|
||||||
_num_collections = 0;
|
_num_collections = 0;
|
||||||
_last_gc_stat = NULL;
|
_last_gc_stat = NULL;
|
||||||
_last_gc_lock = new Mutex(Mutex::leaf, "_last_gc_lock", true);
|
_last_gc_lock = new Mutex(Mutex::leaf, "_last_gc_lock", true,
|
||||||
|
Monitor::_safepoint_check_never);
|
||||||
_current_gc_stat = NULL;
|
_current_gc_stat = NULL;
|
||||||
_num_gc_threads = 1;
|
_num_gc_threads = 1;
|
||||||
_notification_enabled = false;
|
_notification_enabled = false;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -42,7 +42,9 @@ AbstractDecoder* Decoder::_shared_decoder = NULL;
|
||||||
AbstractDecoder* Decoder::_error_handler_decoder = NULL;
|
AbstractDecoder* Decoder::_error_handler_decoder = NULL;
|
||||||
NullDecoder Decoder::_do_nothing_decoder;
|
NullDecoder Decoder::_do_nothing_decoder;
|
||||||
Mutex* Decoder::_shared_decoder_lock = new Mutex(Mutex::native,
|
Mutex* Decoder::_shared_decoder_lock = new Mutex(Mutex::native,
|
||||||
"SharedDecoderLock");
|
"SharedDecoderLock",
|
||||||
|
false,
|
||||||
|
Monitor::_safepoint_check_never);
|
||||||
|
|
||||||
AbstractDecoder* Decoder::get_shared_instance() {
|
AbstractDecoder* Decoder::get_shared_instance() {
|
||||||
assert(_shared_decoder_lock != NULL && _shared_decoder_lock->owned_by_self(),
|
assert(_shared_decoder_lock != NULL && _shared_decoder_lock->owned_by_self(),
|
||||||
|
|
|
@ -90,7 +90,7 @@ template <class T> class EventLogBase : public EventLog {
|
||||||
_length(length),
|
_length(length),
|
||||||
_count(0),
|
_count(0),
|
||||||
_index(0),
|
_index(0),
|
||||||
_mutex(Mutex::event, name) {
|
_mutex(Mutex::event, name, false, Monitor::_safepoint_check_never) {
|
||||||
_records = new EventRecord<T>[length];
|
_records = new EventRecord<T>[length];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,8 @@ AbstractWorkGang::AbstractWorkGang(const char* name,
|
||||||
// Other initialization.
|
// Other initialization.
|
||||||
_monitor = new Monitor(/* priority */ Mutex::leaf,
|
_monitor = new Monitor(/* priority */ Mutex::leaf,
|
||||||
/* name */ "WorkGroup monitor",
|
/* name */ "WorkGroup monitor",
|
||||||
/* allow_vm_block */ are_GC_task_threads);
|
/* allow_vm_block */ are_GC_task_threads,
|
||||||
|
Monitor::_safepoint_check_sometimes);
|
||||||
assert(monitor() != NULL, "Failed to allocate monitor");
|
assert(monitor() != NULL, "Failed to allocate monitor");
|
||||||
_terminate = false;
|
_terminate = false;
|
||||||
_task = NULL;
|
_task = NULL;
|
||||||
|
@ -378,12 +379,13 @@ const char* AbstractGangTask::name() const {
|
||||||
// *** WorkGangBarrierSync
|
// *** WorkGangBarrierSync
|
||||||
|
|
||||||
WorkGangBarrierSync::WorkGangBarrierSync()
|
WorkGangBarrierSync::WorkGangBarrierSync()
|
||||||
: _monitor(Mutex::safepoint, "work gang barrier sync", true),
|
: _monitor(Mutex::safepoint, "work gang barrier sync", true,
|
||||||
|
Monitor::_safepoint_check_never),
|
||||||
_n_workers(0), _n_completed(0), _should_reset(false), _aborted(false) {
|
_n_workers(0), _n_completed(0), _should_reset(false), _aborted(false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
WorkGangBarrierSync::WorkGangBarrierSync(uint n_workers, const char* name)
|
WorkGangBarrierSync::WorkGangBarrierSync(uint n_workers, const char* name)
|
||||||
: _monitor(Mutex::safepoint, name, true),
|
: _monitor(Mutex::safepoint, name, true, Monitor::_safepoint_check_never),
|
||||||
_n_workers(n_workers), _n_completed(0), _should_reset(false), _aborted(false) {
|
_n_workers(n_workers), _n_completed(0), _should_reset(false), _aborted(false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,59 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
|
*
|
||||||
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License version 2 only, as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @bug 8047290
|
||||||
|
* @summary Ensure that a Monitor::lock_without_safepoint_check fires an assert when it incorrectly acquires a lock which must always have safepoint checks.
|
||||||
|
* @library /testlibrary /testlibrary/whitebox
|
||||||
|
* @build AssertSafepointCheckConsistency1
|
||||||
|
* @run main ClassFileInstaller sun.hotspot.WhiteBox
|
||||||
|
* sun.hotspot.WhiteBox$WhiteBoxPermission
|
||||||
|
* @run main AssertSafepointCheckConsistency1
|
||||||
|
*/
|
||||||
|
|
||||||
|
import com.oracle.java.testlibrary.*;
|
||||||
|
|
||||||
|
import sun.hotspot.WhiteBox;
|
||||||
|
|
||||||
|
public class AssertSafepointCheckConsistency1 {
|
||||||
|
public static void main(String args[]) throws Exception {
|
||||||
|
if (args.length > 0) {
|
||||||
|
WhiteBox.getWhiteBox().assertMatchingSafepointCalls(true, true);
|
||||||
|
}
|
||||||
|
if (Platform.isDebugBuild()){
|
||||||
|
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
|
||||||
|
"-Xbootclasspath/a:.",
|
||||||
|
"-XX:+UnlockDiagnosticVMOptions",
|
||||||
|
"-XX:+WhiteBoxAPI",
|
||||||
|
"-XX:-TransmitErrorReport",
|
||||||
|
"-Xmx32m",
|
||||||
|
"AssertSafepointCheckConsistency1",
|
||||||
|
"test");
|
||||||
|
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||||
|
output.shouldContain("assert").shouldContain("always");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
|
*
|
||||||
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License version 2 only, as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @bug 8047290
|
||||||
|
* @summary Ensure that a Monitor::lock fires an assert when it incorrectly acquires a lock which must never have safepoint checks.
|
||||||
|
* @library /testlibrary /testlibrary/whitebox
|
||||||
|
* @build AssertSafepointCheckConsistency2
|
||||||
|
* @run main ClassFileInstaller sun.hotspot.WhiteBox
|
||||||
|
* sun.hotspot.WhiteBox$WhiteBoxPermission
|
||||||
|
* @run main AssertSafepointCheckConsistency2
|
||||||
|
*/
|
||||||
|
|
||||||
|
import com.oracle.java.testlibrary.*;
|
||||||
|
|
||||||
|
import sun.hotspot.WhiteBox;
|
||||||
|
|
||||||
|
public class AssertSafepointCheckConsistency2 {
|
||||||
|
public static void main(String args[]) throws Exception {
|
||||||
|
if (args.length > 0) {
|
||||||
|
WhiteBox.getWhiteBox().assertMatchingSafepointCalls(false, false);
|
||||||
|
}
|
||||||
|
if (Platform.isDebugBuild()){
|
||||||
|
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
|
||||||
|
"-Xbootclasspath/a:.",
|
||||||
|
"-XX:+UnlockDiagnosticVMOptions",
|
||||||
|
"-XX:+WhiteBoxAPI",
|
||||||
|
"-XX:-TransmitErrorReport",
|
||||||
|
"-Xmx32m",
|
||||||
|
"AssertSafepointCheckConsistency2",
|
||||||
|
"test");
|
||||||
|
|
||||||
|
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||||
|
output.shouldContain("assert").shouldContain("never");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,60 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
|
*
|
||||||
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License version 2 only, as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @bug 8047290
|
||||||
|
* @summary Ensure that Monitor::lock_without_safepoint_check does not assert when it correctly acquires a lock which must never have safepoint checks.
|
||||||
|
* @library /testlibrary /testlibrary/whitebox
|
||||||
|
* @build AssertSafepointCheckConsistency3
|
||||||
|
* @run main ClassFileInstaller sun.hotspot.WhiteBox
|
||||||
|
* sun.hotspot.WhiteBox$WhiteBoxPermission
|
||||||
|
* @run main AssertSafepointCheckConsistency3
|
||||||
|
*/
|
||||||
|
|
||||||
|
import com.oracle.java.testlibrary.*;
|
||||||
|
|
||||||
|
import sun.hotspot.WhiteBox;
|
||||||
|
|
||||||
|
public class AssertSafepointCheckConsistency3 {
|
||||||
|
public static void main(String args[]) throws Exception {
|
||||||
|
if (args.length > 0) {
|
||||||
|
WhiteBox.getWhiteBox().assertMatchingSafepointCalls(false, true);
|
||||||
|
}
|
||||||
|
if (Platform.isDebugBuild()){
|
||||||
|
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
|
||||||
|
"-Xbootclasspath/a:.",
|
||||||
|
"-XX:+UnlockDiagnosticVMOptions",
|
||||||
|
"-XX:+WhiteBoxAPI",
|
||||||
|
"-XX:-TransmitErrorReport",
|
||||||
|
"-Xmx32m",
|
||||||
|
"AssertSafepointCheckConsistency3",
|
||||||
|
"test");
|
||||||
|
|
||||||
|
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||||
|
output.shouldNotContain("assert");
|
||||||
|
output.shouldNotContain("never");
|
||||||
|
output.shouldNotContain("always");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,62 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
|
*
|
||||||
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License version 2 only, as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @bug 8047290
|
||||||
|
* @summary Ensure that Monitor::lock does not assert when it correctly acquires a lock which must always have safepoint checks.
|
||||||
|
* @library /testlibrary /testlibrary/whitebox
|
||||||
|
* @build AssertSafepointCheckConsistency4
|
||||||
|
* @run main ClassFileInstaller sun.hotspot.WhiteBox
|
||||||
|
* sun.hotspot.WhiteBox$WhiteBoxPermission
|
||||||
|
* @run main AssertSafepointCheckConsistency4
|
||||||
|
*/
|
||||||
|
|
||||||
|
import com.oracle.java.testlibrary.*;
|
||||||
|
|
||||||
|
import sun.hotspot.WhiteBox;
|
||||||
|
|
||||||
|
public class AssertSafepointCheckConsistency4 {
|
||||||
|
public static void main(String args[]) throws Exception {
|
||||||
|
if (args.length > 0) {
|
||||||
|
WhiteBox.getWhiteBox().assertMatchingSafepointCalls(true, false);
|
||||||
|
}
|
||||||
|
if (Platform.isDebugBuild()){
|
||||||
|
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
|
||||||
|
"-Xbootclasspath/a:.",
|
||||||
|
"-XX:+UnlockDiagnosticVMOptions",
|
||||||
|
"-XX:+WhiteBoxAPI",
|
||||||
|
"-XX:-TransmitErrorReport",
|
||||||
|
"-Xmx32m",
|
||||||
|
"AssertSafepointCheckConsistency4",
|
||||||
|
"test");
|
||||||
|
|
||||||
|
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||||
|
output.shouldNotContain("assert");
|
||||||
|
output.shouldNotContain("never");
|
||||||
|
output.shouldNotContain("always");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -240,4 +240,6 @@ public class WhiteBox {
|
||||||
return offset;
|
return offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Safepoint Checking
|
||||||
|
public native void assertMatchingSafepointCalls(boolean mutexSafepointValue, boolean attemptedNoSafepointValue);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue