< prev index next >

src/hotspot/share/utilities/debug.cpp

Print this page

        

@@ -321,11 +321,11 @@
 
   // A number of threads may attempt to report OutOfMemoryError at around the
   // 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);
       HeapDumper::dump_heap_from_oome();
     }

@@ -760,16 +760,15 @@
       return false; // unprotecting memory may fail in OOM situations, as surprising as this sounds.
     }
     // 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;
       }
     }
     return true;
   }
   return false;
 }
 #endif // CAN_SHOW_REGISTERS_ON_ASSERT
-
< prev index next >