--- old/src/hotspot/share/utilities/debug.cpp 2019-11-21 11:55:43.597517546 +0100 +++ new/src/hotspot/share/utilities/debug.cpp 2019-11-21 11:55:43.345513286 +0100 @@ -323,7 +323,7 @@ // same time. To avoid dumping the heap or executing the data collection // commands multiple times we just do it once when the first threads reports // the error. - if (Atomic::cmpxchg(1, &out_of_memory_reported, 0) == 0) { + if (Atomic::cmpxchg(&out_of_memory_reported, 0, 1) == 0) { // create heap dump before OnOutOfMemoryError commands are executed if (HeapDumpOnOutOfMemoryError) { tty->print_cr("java.lang.OutOfMemoryError: %s", message); @@ -762,7 +762,7 @@ // Store Context away. if (ucVoid) { const intx my_tid = os::current_thread_id(); - if (Atomic::cmpxchg(my_tid, &g_asserting_thread, (intx)0) == 0) { + if (Atomic::cmpxchg(&g_asserting_thread, (intx)0, my_tid) == 0) { store_context(ucVoid); g_assertion_context = &g_stored_assertion_context; } @@ -772,4 +772,3 @@ return false; } #endif // CAN_SHOW_REGISTERS_ON_ASSERT -