< prev index next >
src/hotspot/share/runtime/synchronizer.cpp
Print this page
rev 48406 : 8194406: Use Atomic::replace_if_null
Reviewed-by: coleenp, dholmes
*** 236,247 ****
// stack-locking in the object's header, the third check is for
// recursive stack-locking in the displaced header in the BasicLock,
// and last are the inflated Java Monitor (ObjectMonitor) checks.
lock->set_displaced_header(markOopDesc::unused_mark());
! if (owner == NULL &&
! Atomic::cmpxchg(Self, &(m->_owner), (void*)NULL) == NULL) {
assert(m->_recursions == 0, "invariant");
assert(m->_owner == Self, "invariant");
return true;
}
}
--- 236,246 ----
// stack-locking in the object's header, the third check is for
// recursive stack-locking in the displaced header in the BasicLock,
// and last are the inflated Java Monitor (ObjectMonitor) checks.
lock->set_displaced_header(markOopDesc::unused_mark());
! if (owner == NULL && Atomic::replace_if_null(Self, &(m->_owner))) {
assert(m->_recursions == 0, "invariant");
assert(m->_owner == Self, "invariant");
return true;
}
}
< prev index next >