< prev index next >
src/hotspot/share/runtime/objectMonitor.cpp
Print this page
rev 57560 : imported patch 8236035.patch.cr0
rev 57561 : dholmes CR - rename simply_set_owner_from() -> set_owner_from() and simply_set_owner_from_BasicLock() -> set_owner_from_BasicLock(); rename release_clear_owner_with_barrier() -> release_clear_owner() and refactor barrier code back into the call sites.
rev 57562 : kbarrett CR - rearrange some loads of _owner field to be more efficient; clarify header comment for try_set_owner_from() declaration; make some loads of _owner field DEBUG_ONLY since they only exist for assert()'s; update related logging calls to use the existing function parameter instead.
*** 858,870 ****
// then wake a thread unnecessarily. This is benign, and we've
// structured the code so the windows are short and the frequency
// of such futile wakups is low.
void ObjectMonitor::exit(bool not_suspended, TRAPS) {
! Thread * const Self = THREAD;
! if (THREAD != _owner) {
! void* cur = _owner;
if (THREAD->is_lock_owned((address)cur)) {
assert(_recursions == 0, "invariant");
set_owner_from_BasicLock(cur, Self); // Convert from BasicLock* to Thread*.
_recursions = 0;
} else {
--- 858,870 ----
// then wake a thread unnecessarily. This is benign, and we've
// structured the code so the windows are short and the frequency
// of such futile wakups is low.
void ObjectMonitor::exit(bool not_suspended, TRAPS) {
! Thread* const Self = THREAD;
! void* cur = Atomic::load(&_owner);
! if (THREAD != cur) {
if (THREAD->is_lock_owned((address)cur)) {
assert(_recursions == 0, "invariant");
set_owner_from_BasicLock(cur, Self); // Convert from BasicLock* to Thread*.
_recursions = 0;
} else {
*** 1118,1129 ****
assert(Self->is_Java_thread(), "Must be Java thread!");
JavaThread *jt = (JavaThread *)THREAD;
assert(InitDone, "Unexpectedly not initialized");
! if (THREAD != _owner) {
! void* cur = _owner;
if (THREAD->is_lock_owned((address)cur)) {
assert(_recursions == 0, "internal state error");
set_owner_from_BasicLock(cur, Self); // Convert from BasicLock* to Thread*.
_recursions = 0;
}
--- 1118,1129 ----
assert(Self->is_Java_thread(), "Must be Java thread!");
JavaThread *jt = (JavaThread *)THREAD;
assert(InitDone, "Unexpectedly not initialized");
! void* cur = Atomic::load(&_owner);
! if (THREAD != cur) {
if (THREAD->is_lock_owned((address)cur)) {
assert(_recursions == 0, "internal state error");
set_owner_from_BasicLock(cur, Self); // Convert from BasicLock* to Thread*.
_recursions = 0;
}
*** 1167,1180 ****
// Returns true if the specified thread owns the ObjectMonitor.
// Otherwise returns false and throws IllegalMonitorStateException
// (IMSE). If there is a pending exception and the specified thread
// is not the owner, that exception will be replaced by the IMSE.
bool ObjectMonitor::check_owner(Thread* THREAD) {
! if (_owner == THREAD) {
return true;
}
- void* cur = _owner;
if (THREAD->is_lock_owned((address)cur)) {
set_owner_from_BasicLock(cur, THREAD); // Convert from BasicLock* to Thread*.
_recursions = 0;
return true;
}
--- 1167,1180 ----
// Returns true if the specified thread owns the ObjectMonitor.
// Otherwise returns false and throws IllegalMonitorStateException
// (IMSE). If there is a pending exception and the specified thread
// is not the owner, that exception will be replaced by the IMSE.
bool ObjectMonitor::check_owner(Thread* THREAD) {
! void* cur = Atomic::load(&_owner);
! if (cur == THREAD) {
return true;
}
if (THREAD->is_lock_owned((address)cur)) {
set_owner_from_BasicLock(cur, THREAD); // Convert from BasicLock* to Thread*.
_recursions = 0;
return true;
}
< prev index next >