src/hotspot/share/jvmci/jvmciCompilerToVM.cpp
changeset 59252 623722a6aeb9
parent 59056 15936b142f86
child 59290 97d13893ec3c
--- a/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp	Mon Nov 25 12:32:40 2019 +0100
+++ b/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp	Mon Nov 25 12:33:15 2019 +0100
@@ -1586,7 +1586,7 @@
       jint res = main_vm.AttachCurrentThread((void**)&hotspotEnv, NULL);
       _attached = res == JNI_OK;
       static volatile int report_attach_error = 0;
-      if (res != JNI_OK && report_attach_error == 0 && Atomic::cmpxchg(1, &report_attach_error, 0) == 0) {
+      if (res != JNI_OK && report_attach_error == 0 && Atomic::cmpxchg(&report_attach_error, 0, 1) == 0) {
         // Only report an attach error once
         jio_printf("Warning: attaching current thread to VM failed with %d (future attach errors are suppressed)\n", res);
       }
@@ -1599,7 +1599,7 @@
       extern struct JavaVM_ main_vm;
       jint res = main_vm.DetachCurrentThread();
       static volatile int report_detach_error = 0;
-      if (res != JNI_OK && report_detach_error == 0 && Atomic::cmpxchg(1, &report_detach_error, 0) == 0) {
+      if (res != JNI_OK && report_detach_error == 0 && Atomic::cmpxchg(&report_detach_error, 0, 1) == 0) {
         // Only report an attach error once
         jio_printf("Warning: detaching current thread from VM failed with %d (future attach errors are suppressed)\n", res);
       }