src/hotspot/share/runtime/mutex.cpp
changeset 48488 51825789dd89
parent 47881 0ce0ac68ace7
child 49449 ef5d5d343e2a
--- 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;
   }