--- a/src/hotspot/share/runtime/synchronizer.cpp Wed Jan 03 17:29:20 2018 +0000
+++ b/src/hotspot/share/runtime/synchronizer.cpp Thu Jan 04 18:18:18 2018 -0500
@@ -238,8 +238,7 @@
// 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;