src/hotspot/share/prims/jni.cpp
changeset 59252 623722a6aeb9
parent 59251 4cbfa5077d68
child 59290 97d13893ec3c
--- a/src/hotspot/share/prims/jni.cpp	Mon Nov 25 12:32:40 2019 +0100
+++ b/src/hotspot/share/prims/jni.cpp	Mon Nov 25 12:33:15 2019 +0100
@@ -273,7 +273,7 @@
     _name = elementName;
     uintx count = 0;
 
-    while (Atomic::cmpxchg(1, &JNIHistogram_lock, 0) != 0) {
+    while (Atomic::cmpxchg(&JNIHistogram_lock, 0, 1) != 0) {
       while (Atomic::load_acquire(&JNIHistogram_lock) != 0) {
         count +=1;
         if ( (WarnOnStalledSpinLock > 0)
@@ -3233,7 +3233,7 @@
     return false;
   }
 
-  if (Atomic::cmpxchg(1, &directBufferSupportInitializeStarted, 0) == 0) {
+  if (Atomic::cmpxchg(&directBufferSupportInitializeStarted, 0, 1) == 0) {
     if (!lookupDirectBufferClasses(env)) {
       directBufferSupportInitializeFailed = 1;
       return false;