< prev index next >

src/share/vm/gc/g1/g1RemSet.cpp

Print this page
rev 13131 : imported patch 8178148-more-detailed-scan-rs-logging
rev 13135 : imported patch 8175554-improve-g1updatersorpushrefclosure
rev 13138 : [mq]: 8175554-erikd-review3

@@ -325,15 +325,15 @@
     _card_live_data.pretouch();
   }
 }
 
 G1ScanRSClosure::G1ScanRSClosure(G1RemSetScanState* scan_state,
-                                 G1ParPushHeapRSClosure* push_heap_cl,
+                                 G1ScanObjsDuringScanRSClosure* scan_obj_on_card,
                                  CodeBlobClosure* code_root_cl,
                                  uint worker_i) :
   _scan_state(scan_state),
-  _push_heap_cl(push_heap_cl),
+  _scan_objs_on_card_cl(scan_obj_on_card),
   _code_root_cl(code_root_cl),
   _strong_code_root_scan_time_sec(0.0),
   _cards_claimed(0),
   _cards_scanned(0),
   _cards_skipped(0),

@@ -351,12 +351,12 @@
   if (!mr.is_empty() && !_ct_bs->is_card_claimed(index)) {
     // We make the card as "claimed" lazily (so races are possible
     // but they're benign), which reduces the number of duplicate
     // scans (the rsets of the regions in the cset can intersect).
     _ct_bs->set_card_claimed(index);
-    _push_heap_cl->set_region(r);
-    r->oops_on_card_seq_iterate_careful<true>(mr, _push_heap_cl);
+    _scan_objs_on_card_cl->set_region(r);
+    r->oops_on_card_seq_iterate_careful<true>(mr, _scan_objs_on_card_cl);
     _cards_scanned++;
   }
 }
 
 void G1ScanRSClosure::scan_strong_code_roots(HeapRegion* r) {

@@ -411,11 +411,11 @@
     scan_strong_code_roots(r);
   }
   return false;
 }
 
-void G1RemSet::scan_rem_set(G1ParPushHeapRSClosure* oops_in_heap_closure,
+void G1RemSet::scan_rem_set(G1ScanObjsDuringScanRSClosure* oops_in_heap_closure,
                             CodeBlobClosure* heap_region_codeblobs,
                             uint worker_i) {
   double rs_time_start = os::elapsedTime();
 
   G1ScanRSClosure cl(_scan_state, oops_in_heap_closure, heap_region_codeblobs, worker_i);

@@ -439,27 +439,26 @@
 // evacuation pause.
 
 class RefineRecordRefsIntoCSCardTableEntryClosure: public CardTableEntryClosure {
   G1RemSet* _g1rs;
   DirtyCardQueue* _into_cset_dcq;
-  G1ParPushHeapRSClosure* _cl;
+  G1ScanObjsDuringUpdateRSClosure* _cl;
 public:
   RefineRecordRefsIntoCSCardTableEntryClosure(G1CollectedHeap* g1h,
                                               DirtyCardQueue* into_cset_dcq,
-                                              G1ParPushHeapRSClosure* cl) :
+                                              G1ScanObjsDuringUpdateRSClosure* cl) :
     _g1rs(g1h->g1_rem_set()), _into_cset_dcq(into_cset_dcq), _cl(cl)
   {}
 
   bool do_card_ptr(jbyte* card_ptr, uint worker_i) {
     // The only time we care about recording cards that
     // contain references that point into the collection set
     // is during RSet updating within an evacuation pause.
     // In this case worker_i should be the id of a GC worker thread.
     assert(SafepointSynchronize::is_at_safepoint(), "not during an evacuation pause");
-    assert(worker_i < ParallelGCThreads, "should be a GC worker");
 
-    if (_g1rs->refine_card_during_gc(card_ptr, worker_i, _cl)) {
+    if (_g1rs->refine_card_during_gc(card_ptr, _cl)) {
       // 'card_ptr' contains references that point into the collection
       // set. We need to record the card in the DCQS
       // (_into_cset_dirty_card_queue_set)
       // that's used for that purpose.
       //

@@ -469,11 +468,11 @@
     return true;
   }
 };
 
 void G1RemSet::update_rem_set(DirtyCardQueue* into_cset_dcq,
-                              G1ParPushHeapRSClosure* oops_in_heap_closure,
+                              G1ScanObjsDuringUpdateRSClosure* oops_in_heap_closure,
                               uint worker_i) {
   RefineRecordRefsIntoCSCardTableEntryClosure into_cset_update_rs_cl(_g1, into_cset_dcq, oops_in_heap_closure);
 
   G1GCParPhaseTimesTracker x(_g1p->phase_times(), G1GCPhaseTimes::UpdateRS, worker_i);
   if (G1HotCardCache::default_use_cache()) {

@@ -487,11 +486,11 @@
 
 void G1RemSet::cleanupHRRS() {
   HeapRegionRemSet::cleanup();
 }
 
-void G1RemSet::oops_into_collection_set_do(G1ParPushHeapRSClosure* cl,
+void G1RemSet::oops_into_collection_set_do(G1ParScanThreadState* pss,
                                            CodeBlobClosure* heap_region_codeblobs,
                                            uint worker_i) {
   // A DirtyCardQueue that is used to hold cards containing references
   // that point into the collection set. This DCQ is associated with a
   // special DirtyCardQueueSet (see g1CollectedHeap.hpp).  Under normal

@@ -501,12 +500,18 @@
   // are wholly 'free' of live objects. In the event of an evacuation
   // failure the cards/buffers in this queue set are passed to the
   // DirtyCardQueueSet that is used to manage RSet updates
   DirtyCardQueue into_cset_dcq(&_into_cset_dirty_card_queue_set);
 
-  update_rem_set(&into_cset_dcq, cl, worker_i);
-  scan_rem_set(cl, heap_region_codeblobs, worker_i);;
+  {
+    G1ScanObjsDuringUpdateRSClosure cl(_g1, pss, worker_i);
+    update_rem_set(&into_cset_dcq, &cl, worker_i);
+  }
+  {
+    G1ScanObjsDuringScanRSClosure cl(_g1, pss);
+    scan_rem_set(&cl, heap_region_codeblobs, worker_i);;
+  }
 }
 
 void G1RemSet::prepare_for_oops_into_collection_set_do() {
   _g1->set_refine_cte_cl_concurrency(false);
   DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set();

@@ -577,21 +582,10 @@
          p2i(ct_bs->addr_for(card_ptr)),
          g1->addr_to_region(ct_bs->addr_for(card_ptr)));
 #endif
 }
 
-G1UpdateRSOrPushRefOopClosure::G1UpdateRSOrPushRefOopClosure(G1CollectedHeap* g1h,
-                                                             G1ParPushHeapRSClosure* push_ref_cl,
-                                                             bool record_refs_into_cset,
-                                                             uint worker_i) :
-  _g1(g1h),
-  _from(NULL),
-  _record_refs_into_cset(record_refs_into_cset),
-  _has_refs_into_cset(false),
-  _push_ref_cl(push_ref_cl),
-  _worker_i(worker_i) { }
-
 void G1RemSet::refine_card_concurrently(jbyte* card_ptr,
                                         uint worker_i) {
   assert(!_g1->is_gc_active(), "Only call concurrently");
 
   check_card_ptr(card_ptr, _ct_bs);

@@ -738,12 +732,11 @@
     _conc_refine_cards++;
   }
 }
 
 bool G1RemSet::refine_card_during_gc(jbyte* card_ptr,
-                                     uint worker_i,
-                                     G1ParPushHeapRSClosure*  oops_in_heap_closure) {
+                                     G1ScanObjsDuringUpdateRSClosure* oops_in_heap_closure) {
   assert(_g1->is_gc_active(), "Only call during GC");
 
   check_card_ptr(card_ptr, _ct_bs);
 
   // If the card is no longer dirty, nothing to do. This covers cards that were already

@@ -773,23 +766,18 @@
   // a card beyond the heap.
   HeapWord* card_end = card_start + CardTableModRefBS::card_size_in_words;
   MemRegion dirty_region(card_start, MIN2(scan_limit, card_end));
   assert(!dirty_region.is_empty(), "sanity");
 
-  G1UpdateRSOrPushRefOopClosure update_rs_oop_cl(_g1,
-                                                 oops_in_heap_closure,
-                                                 true,
-                                                 worker_i);
-  update_rs_oop_cl.set_from(r);
+  oops_in_heap_closure->set_region(r);
+  oops_in_heap_closure->reset_has_refs_into_cset();
 
-  bool card_processed =
-    r->oops_on_card_seq_iterate_careful<true>(dirty_region,
-                                              &update_rs_oop_cl);
+  bool card_processed = r->oops_on_card_seq_iterate_careful<true>(dirty_region, oops_in_heap_closure);
   assert(card_processed, "must be");
   _conc_refine_cards++;
 
-  return update_rs_oop_cl.has_refs_into_cset();
+  return oops_in_heap_closure->has_refs_into_cset();
 }
 
 void G1RemSet::print_periodic_summary_info(const char* header, uint period_count) {
   if ((G1SummarizeRSetStatsPeriod > 0) && log_is_enabled(Trace, gc, remset) &&
       (period_count % G1SummarizeRSetStatsPeriod == 0)) {
< prev index next >