< prev index next >

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

Print this page
rev 57001 : imported patch 8233919-incrementally-calc-num-occupied
rev 57002 : [mq]: 8233919-stefanj-review

@@ -242,12 +242,14 @@
   // Note that we can't assert "prt->hr() == from_hr", because of the
   // possibility of concurrent reuse.  But see head comment of
   // OtherRegionsTable for why this is OK.
   assert(prt != NULL, "Inv");
 
-  bool added = prt->add_reference(from);
-  Atomic::add(num_added_by_coarsening + (added ? 1 : 0), &_num_occupied, memory_order_relaxed);
+  if (prt->add_reference(from)) {
+    num_added_by_coarsening++;
+  }
+  Atomic::add(num_added_by_coarsening, &_num_occupied, memory_order_relaxed);
   assert(contains_reference(from), "We just added " PTR_FORMAT " to the PRT (%d)", p2i(from), prt->contains_reference(from));
 }
 
 PerRegionTable*
 OtherRegionsTable::find_region_table(size_t ind, HeapRegion* hr) const {
< prev index next >