--- old/src/hotspot/share/runtime/synchronizer.cpp 2019-11-21 11:55:38.309428157 +0100 +++ new/src/hotspot/share/runtime/synchronizer.cpp 2019-11-21 11:55:38.045423694 +0100 @@ -240,7 +240,7 @@ // and last are the inflated Java Monitor (ObjectMonitor) checks. lock->set_displaced_header(markWord::unused_mark()); - if (owner == NULL && Atomic::replace_if_null(self, &(m->_owner))) { + if (owner == NULL && Atomic::replace_if_null(&(m->_owner), self)) { assert(m->_recursions == 0, "invariant"); return true; } @@ -745,7 +745,7 @@ hash = get_next_hash(self, obj); temp = mark.copy_set_hash(hash); // merge hash code into header assert(temp.is_neutral(), "invariant: header=" INTPTR_FORMAT, temp.value()); - uintptr_t v = Atomic::cmpxchg(temp.value(), (volatile uintptr_t*)monitor->header_addr(), mark.value()); + uintptr_t v = Atomic::cmpxchg((volatile uintptr_t*)monitor->header_addr(), mark.value(), temp.value()); test = markWord(v); if (test != mark) { // The only non-deflation update to the ObjectMonitor's