diff -r a6deb69743d4 -r 4cbfa5077d68 src/hotspot/os/posix/os_posix.cpp --- a/src/hotspot/os/posix/os_posix.cpp Mon Nov 25 12:32:07 2019 +0100 +++ b/src/hotspot/os/posix/os_posix.cpp Mon Nov 25 12:32:40 2019 +0100 @@ -1998,7 +1998,7 @@ // but only in the correctly written condition checking loops of ObjectMonitor, // Mutex/Monitor, Thread::muxAcquire and JavaThread::sleep - if (Atomic::xchg(1, &_event) >= 0) return; + if (Atomic::xchg(&_event, 1) >= 0) return; int status = pthread_mutex_lock(_mutex); assert_status(status == 0, status, "mutex_lock"); @@ -2046,7 +2046,7 @@ // Return immediately if a permit is available. // We depend on Atomic::xchg() having full barrier semantics // since we are doing a lock-free update to _counter. - if (Atomic::xchg(0, &_counter) > 0) return; + if (Atomic::xchg(&_counter, 0) > 0) return; Thread* thread = Thread::current(); assert(thread->is_Java_thread(), "Must be JavaThread");