src/share/vm/gc_implementation/g1/g1EvacFailure.hpp

Print this page
rev 7107 : imported patch 8058298
rev 7109 : imported patch rev2

@@ -182,24 +182,25 @@
   DirtyCardQueue _dcq;
   UpdateRSetDeferred _update_rset_cl;
 
 public:
   RemoveSelfForwardPtrHRClosure(G1CollectedHeap* g1h,
-                                uint worker_id,
-                                HeapRegionClaimer* hrclaimer) :
+                                uint worker_id = 0,
+                                HeapRegionClaimer* hrclaimer = NULL) :
       _g1h(g1h), _dcq(&g1h->dirty_card_queue_set()), _update_rset_cl(g1h, &_dcq),
       _worker_id(worker_id), _cm(_g1h->concurrent_mark()), _hrclaimer(hrclaimer) {
+    assert(hrclaimer != NULL || worker_id == 0, "Must use a HeapRegionClaimer when used in parallel.");
   }
 
   bool doHeapRegion(HeapRegion *hr) {
     bool during_initial_mark = _g1h->g1_policy()->during_initial_mark_pause();
     bool during_conc_mark = _g1h->mark_in_progress();
 
     assert(!hr->is_humongous(), "sanity");
     assert(hr->in_collection_set(), "bad CS");
 
-    if (_hrclaimer->claim_region(hr->hrm_index())) {
+    if (_hrclaimer == NULL || _hrclaimer->claim_region(hr->hrm_index())) {
       if (hr->evacuation_failed()) {
         RemoveSelfForwardPtrObjClosure rspc(_g1h, _cm, hr, &_update_rset_cl,
                                             during_initial_mark,
                                             during_conc_mark,
                                             _worker_id);

@@ -233,18 +234,19 @@
 };
 
 class G1ParRemoveSelfForwardPtrsTask: public AbstractGangTask {
 protected:
   G1CollectedHeap* _g1h;
-  HeapRegionClaimer* _hrclaimer;
+  HeapRegionClaimer _hrclaimer;
 
 public:
-  G1ParRemoveSelfForwardPtrsTask(G1CollectedHeap* g1h, HeapRegionClaimer* hrclaimer) :
-      AbstractGangTask("G1 Remove Self-forwarding Pointers"), _g1h(g1h), _hrclaimer(hrclaimer) {}
+  G1ParRemoveSelfForwardPtrsTask(G1CollectedHeap* g1h) :
+      AbstractGangTask("G1 Remove Self-forwarding Pointers"), _g1h(g1h),
+      _hrclaimer(g1h->workers()->active_workers()) {}
 
   void work(uint worker_id) {
-    RemoveSelfForwardPtrHRClosure rsfp_cl(_g1h, worker_id, _hrclaimer);
+    RemoveSelfForwardPtrHRClosure rsfp_cl(_g1h, worker_id, &_hrclaimer);
 
     HeapRegion* hr = _g1h->start_cset_region_for_worker(worker_id);
     _g1h->collection_set_iterate_from(hr, &rsfp_cl);
   }
 };