8145774: Move scrubbing setup code away out of ConcurrentMark
authortschatzl
Tue, 22 Dec 2015 11:03:37 +0100
changeset 35211 3771329165d4
parent 35210 eb1d5c68bf64
child 35213 a92a6b278599
child 35214 d86005e0b4c2
8145774: Move scrubbing setup code away out of ConcurrentMark Summary: Remove dependency of ConcurrentMark to G1RemSet. Reviewed-by: jmasa, mgerdin
hotspot/src/share/vm/gc/g1/concurrentMark.cpp
hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp
hotspot/src/share/vm/gc/g1/g1CollectedHeap.hpp
--- a/hotspot/src/share/vm/gc/g1/concurrentMark.cpp	Tue Dec 22 11:02:04 2015 +0100
+++ b/hotspot/src/share/vm/gc/g1/concurrentMark.cpp	Tue Dec 22 11:03:37 2015 +0100
@@ -32,10 +32,8 @@
 #include "gc/g1/g1CollectorPolicy.hpp"
 #include "gc/g1/g1CollectorState.hpp"
 #include "gc/g1/g1OopClosures.inline.hpp"
-#include "gc/g1/g1RemSet.hpp"
 #include "gc/g1/g1StringDedup.hpp"
 #include "gc/g1/heapRegion.inline.hpp"
-#include "gc/g1/heapRegionManager.inline.hpp"
 #include "gc/g1/heapRegionRemSet.hpp"
 #include "gc/g1/heapRegionSet.inline.hpp"
 #include "gc/g1/suspendibleThreadSet.hpp"
@@ -1595,24 +1593,6 @@
   }
 };
 
-class G1ParScrubRemSetTask: public AbstractGangTask {
-protected:
-  G1RemSet* _g1rs;
-  BitMap* _region_bm;
-  BitMap* _card_bm;
-  HeapRegionClaimer _hrclaimer;
-
-public:
-  G1ParScrubRemSetTask(G1CollectedHeap* g1h, BitMap* region_bm, BitMap* card_bm, uint n_workers) :
-      AbstractGangTask("G1 ScrubRS"), _g1rs(g1h->g1_rem_set()), _region_bm(region_bm), _card_bm(card_bm), _hrclaimer(n_workers) {
-  }
-
-  void work(uint worker_id) {
-    _g1rs->scrub(_region_bm, _card_bm, worker_id, &_hrclaimer);
-  }
-
-};
-
 void ConcurrentMark::cleanup() {
   // world is stopped at this checkpoint
   assert(SafepointSynchronize::is_at_safepoint(),
@@ -1700,12 +1680,8 @@
   // regions.
   if (G1ScrubRemSets) {
     double rs_scrub_start = os::elapsedTime();
-    G1ParScrubRemSetTask g1_par_scrub_rs_task(g1h, &_region_bm, &_card_bm, n_workers);
-    g1h->workers()->run_task(&g1_par_scrub_rs_task);
-
-    double rs_scrub_end = os::elapsedTime();
-    double this_rs_scrub_time = (rs_scrub_end - rs_scrub_start);
-    _total_rs_scrub_time += this_rs_scrub_time;
+    g1h->scrub_rem_set(&_region_bm, &_card_bm);
+    _total_rs_scrub_time += (os::elapsedTime() - rs_scrub_start);
   }
 
   // this will also free any regions totally full of garbage objects,
--- a/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp	Tue Dec 22 11:02:04 2015 +0100
+++ b/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp	Tue Dec 22 11:03:37 2015 +0100
@@ -5411,6 +5411,33 @@
 }
 #endif // PRODUCT
 
+class G1ParScrubRemSetTask: public AbstractGangTask {
+protected:
+  G1RemSet* _g1rs;
+  BitMap* _region_bm;
+  BitMap* _card_bm;
+  HeapRegionClaimer _hrclaimer;
+
+public:
+  G1ParScrubRemSetTask(G1RemSet* g1_rs, BitMap* region_bm, BitMap* card_bm, uint num_workers) :
+    AbstractGangTask("G1 ScrubRS"),
+    _g1rs(g1_rs),
+    _region_bm(region_bm),
+    _card_bm(card_bm),
+    _hrclaimer(num_workers) {
+  }
+
+  void work(uint worker_id) {
+    _g1rs->scrub(_region_bm, _card_bm, worker_id, &_hrclaimer);
+  }
+};
+
+void G1CollectedHeap::scrub_rem_set(BitMap* region_bm, BitMap* card_bm) {
+  uint num_workers = workers()->active_workers();
+  G1ParScrubRemSetTask g1_par_scrub_rs_task(g1_rem_set(), region_bm, card_bm, num_workers);
+  workers()->run_task(&g1_par_scrub_rs_task);
+}
+
 void G1CollectedHeap::cleanUpCardTable() {
   G1SATBCardTableModRefBS* ct_bs = g1_barrier_set();
   double start = os::elapsedTime();
--- a/hotspot/src/share/vm/gc/g1/g1CollectedHeap.hpp	Tue Dec 22 11:02:04 2015 +0100
+++ b/hotspot/src/share/vm/gc/g1/g1CollectedHeap.hpp	Tue Dec 22 11:03:37 2015 +0100
@@ -984,6 +984,8 @@
   // The rem set and barrier set.
   G1RemSet* g1_rem_set() const { return _g1_rem_set; }
 
+  void scrub_rem_set(BitMap* region_bm, BitMap* card_bm);
+
   unsigned get_gc_time_stamp() {
     return _gc_time_stamp;
   }