--- old/src/hotspot/share/gc/shared/referenceProcessor.cpp 2019-11-21 11:55:07.964915153 +0100 +++ new/src/hotspot/share/gc/shared/referenceProcessor.cpp 2019-11-21 11:55:07.704910757 +0100 @@ -1031,7 +1031,7 @@ // The last ref must have its discovered field pointing to itself. oop next_discovered = (current_head != NULL) ? current_head : obj; - oop retest = HeapAccess::oop_atomic_cmpxchg(next_discovered, discovered_addr, oop(NULL)); + oop retest = HeapAccess::oop_atomic_cmpxchg(discovered_addr, oop(NULL), next_discovered); if (retest == NULL) { // This thread just won the right to enqueue the object.