< prev index next >

src/hotspot/share/gc/g1/g1ConcurrentMark.cpp

Print this page

        

@@ -205,11 +205,11 @@
   // wraparound of _hwm.
   if (_hwm >= _chunk_capacity) {
     return NULL;
   }
 
-  size_t cur_idx = Atomic::add(1u, &_hwm) - 1;
+  size_t cur_idx = Atomic::add(&_hwm, 1u) - 1;
   if (cur_idx >= _chunk_capacity) {
     return NULL;
   }
 
   TaskQueueEntryChunk* result = ::new (&_base[cur_idx]) TaskQueueEntryChunk;

@@ -278,11 +278,11 @@
   _num_root_regions = 0;
 }
 
 void G1CMRootMemRegions::add(HeapWord* start, HeapWord* end) {
   assert_at_safepoint();
-  size_t idx = Atomic::add((size_t)1, &_num_root_regions) - 1;
+  size_t idx = Atomic::add(&_num_root_regions, (size_t)1) - 1;
   assert(idx < _max_regions, "Trying to add more root MemRegions than there is space " SIZE_FORMAT, _max_regions);
   assert(start != NULL && end != NULL && start <= end, "Start (" PTR_FORMAT ") should be less or equal to "
          "end (" PTR_FORMAT ")", p2i(start), p2i(end));
   _root_regions[idx].set_start(start);
   _root_regions[idx].set_end(end);

@@ -306,11 +306,11 @@
 
   if (_claimed_root_regions >= _num_root_regions) {
     return NULL;
   }
 
-  size_t claimed_index = Atomic::add((size_t)1, &_claimed_root_regions) - 1;
+  size_t claimed_index = Atomic::add(&_claimed_root_regions, (size_t)1) - 1;
   if (claimed_index < _num_root_regions) {
     return &_root_regions[claimed_index];
   }
   return NULL;
 }

@@ -1119,11 +1119,11 @@
     _g1h(g1h), _cm(cm), _hrclaimer(num_workers), _total_selected_for_rebuild(0), _cl("Post-Marking") { }
 
   virtual void work(uint worker_id) {
     G1UpdateRemSetTrackingBeforeRebuild update_cl(_g1h, _cm, &_cl);
     _g1h->heap_region_par_iterate_from_worker_offset(&update_cl, &_hrclaimer, worker_id);
-    Atomic::add(update_cl.num_selected_for_rebuild(), &_total_selected_for_rebuild);
+    Atomic::add(&_total_selected_for_rebuild, update_cl.num_selected_for_rebuild());
   }
 
   uint total_selected_for_rebuild() const { return _total_selected_for_rebuild; }
 
   // Number of regions for which roughly one thread should be spawned for this work.
< prev index next >