diff -r abf1d797e380 -r 51825789dd89 src/hotspot/share/runtime/mutex.cpp --- a/src/hotspot/share/runtime/mutex.cpp Wed Jan 03 17:29:20 2018 +0000 +++ b/src/hotspot/share/runtime/mutex.cpp Thu Jan 04 18:18:18 2018 -0500 @@ -467,7 +467,7 @@ OrderAccess::fence(); // Optional optimization ... try barging on the inner lock - if ((NativeMonitorFlags & 32) && Atomic::cmpxchg(ESelf, &_OnDeck, (ParkEvent*)NULL) == NULL) { + if ((NativeMonitorFlags & 32) && Atomic::replace_if_null(ESelf, &_OnDeck)) { goto OnDeck_LOOP; } @@ -574,7 +574,7 @@ // Unlike a normal lock, however, the exiting thread "locks" OnDeck, // picks a successor and marks that thread as OnDeck. That successor // thread will then clear OnDeck once it eventually acquires the outer lock. - if (Atomic::cmpxchg((ParkEvent*)_LBIT, &_OnDeck, (ParkEvent*)NULL) != NULL) { + if (!Atomic::replace_if_null((ParkEvent*)_LBIT, &_OnDeck)) { return; }