src/hotspot/share/gc/g1/g1RemSet.cpp
changeset 59252 623722a6aeb9
parent 59249 29b0d0b61615
child 59290 97d13893ec3c
--- a/src/hotspot/share/gc/g1/g1RemSet.cpp	Mon Nov 25 12:32:40 2019 +0100
+++ b/src/hotspot/share/gc/g1/g1RemSet.cpp	Mon Nov 25 12:33:15 2019 +0100
@@ -177,7 +177,7 @@
         return;
       }
 
-      bool marked_as_dirty = Atomic::cmpxchg(true, &_contains[region], false) == false;
+      bool marked_as_dirty = Atomic::cmpxchg(&_contains[region], false, true) == false;
       if (marked_as_dirty) {
         uint allocated = Atomic::add(&_cur_idx, 1u) - 1;
         _buffer[allocated] = region;
@@ -437,7 +437,7 @@
     if (_collection_set_iter_state[region]) {
       return false;
     }
-    return !Atomic::cmpxchg(true, &_collection_set_iter_state[region], false);
+    return !Atomic::cmpxchg(&_collection_set_iter_state[region], false, true);
   }
 
   bool has_cards_to_scan(uint region) {
@@ -1137,7 +1137,7 @@
     if (_initial_evacuation &&
         p->fast_reclaim_humongous_candidates() > 0 &&
         !_fast_reclaim_handled &&
-        !Atomic::cmpxchg(true, &_fast_reclaim_handled, false)) {
+        !Atomic::cmpxchg(&_fast_reclaim_handled, false, true)) {
 
       G1GCParPhaseTimesTracker x(p, G1GCPhaseTimes::MergeER, worker_id);