src/share/vm/runtime/mutex.cpp
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File
*** old/src/share/vm/runtime/mutex.cpp Thu Nov 6 12:39:42 2014
--- new/src/share/vm/runtime/mutex.cpp Thu Nov 6 12:39:41 2014
*** 893,902 ****
--- 893,907 ----
// But of course the proper ultimate approach is to avoid schemes that require explicit
// sneaking or dependence on any any clever invariants or subtle implementation properties
// of Mutex-Monitor and instead directly address the underlying design flaw.
void Monitor::lock(Thread * Self) {
+ //Ensure that the Monitor requires/allows safepoint checks.
+ assert(this->_safepoint_check_required != Monitor::_safepoint_check_never,
+ err_msg("This lock should never have a safepoint check: %s",
+ this->name()));
+
#ifdef CHECK_UNHANDLED_OOPS
// Clear unhandled oops so we get a crash right away. Only clear for non-vm
// or GC threads.
if (Self->is_Java_thread()) {
Self->clear_unhandled_oops();
*** 951,960 ****
--- 956,969 ----
// Should ONLY be used by safepoint code and other code
// that is guaranteed not to block while running inside the VM. If this is called with
// thread state set to be in VM, the safepoint synchronization code will deadlock!
void Monitor::lock_without_safepoint_check(Thread * Self) {
+ //Ensure that the Monitor does not require or allow safepoint checks.
+ assert(this->_safepoint_check_required != Monitor::_safepoint_check_always,
+ err_msg("This lock should always have a safepoint check: %s",
+ this->name()));
assert(_owner != Self, "invariant");
ILock(Self);
assert(_owner == NULL, "invariant");
set_owner(Self);
}
*** 1166,1192 ****
--- 1175,1205 ----
m->_WaitLock[0] = 0;
}
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);
#ifdef ASSERT
_allow_vm_block = allow_vm_block;
_rank = Rank;
+ NOT_PRODUCT(_safepoint_check_required = safepoint_check_required;)
#endif
}
Mutex::~Mutex() {
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);
#ifdef ASSERT
_allow_vm_block = allow_vm_block;
_rank = Rank;
+ NOT_PRODUCT(_safepoint_check_required = safepoint_check_required;)
#endif
}
bool Monitor::owned_by_self() const {
bool ret = _owner == Thread::current();
src/share/vm/runtime/mutex.cpp
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File