8194406: Use Atomic::replace_if_null

Reviewed-by: coleenp, dholmes
This commit is contained in:
Kim Barrett 2018-01-04 18:18:18 -05:00
parent c7e601e911
commit 9e5bf18428
9 changed files with 17 additions and 18 deletions

View file

@ -238,8 +238,7 @@ bool ObjectSynchronizer::quick_enter(oop obj, Thread * Self,
// 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) {
if (owner == NULL && Atomic::replace_if_null(Self, &(m->_owner))) {
assert(m->_recursions == 0, "invariant");
assert(m->_owner == Self, "invariant");
return true;