--- old/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp 2019-11-21 11:55:25.713215219 +0100 +++ new/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp 2019-11-21 11:55:25.501211635 +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); }