--- a/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp Mon Nov 25 12:32:40 2019 +0100
+++ b/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp Mon Nov 25 12:33:15 2019 +0100
@@ -1906,7 +1906,7 @@
HeapWord* end = curr_region != NULL ? curr_region->end() : finger + HeapRegion::GrainWords;
// Is the gap between reading the finger and doing the CAS too long?
- HeapWord* res = Atomic::cmpxchg(end, &_finger, finger);
+ HeapWord* res = Atomic::cmpxchg(&_finger, finger, end);
if (res == finger && curr_region != NULL) {
// we succeeded
HeapWord* bottom = curr_region->bottom();