diff -r 4cbfa5077d68 -r 623722a6aeb9 src/hotspot/share/gc/shared/referenceProcessor.cpp --- a/src/hotspot/share/gc/shared/referenceProcessor.cpp Mon Nov 25 12:32:40 2019 +0100 +++ b/src/hotspot/share/gc/shared/referenceProcessor.cpp Mon Nov 25 12:33:15 2019 +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.