< prev index next >

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

Print this page
rev 13269 : 8183539: Remove G1RemSet::_into_cset_dirty_card_queue_set

@@ -286,21 +286,11 @@
   _scan_state(new G1RemSetScanState()),
   _num_conc_refined_cards(0),
   _ct_bs(ct_bs),
   _g1p(_g1->g1_policy()),
   _hot_card_cache(hot_card_cache),
-  _prev_period_summary(),
-  _into_cset_dirty_card_queue_set(false)
-{
-  // Initialize the card queue set used to hold cards containing
-  // references into the collection set.
-  _into_cset_dirty_card_queue_set.initialize(DirtyCardQ_CBL_mon,
-                                             DirtyCardQ_FL_lock,
-                                             -1, // never trigger processing
-                                             -1, // no limit on length
-                                             Shared_DirtyCardQ_lock,
-                                             &JavaThread::dirty_card_queue_set());
+  _prev_period_summary() {
 }
 
 G1RemSet::~G1RemSet() {
   if (_scan_state != NULL) {
     delete _scan_state;

@@ -444,49 +434,34 @@
   p->record_thread_work_item(G1GCPhaseTimes::ScanRS, worker_i, cl.cards_skipped(), G1GCPhaseTimes::SkippedCards);
 
   p->record_time_secs(G1GCPhaseTimes::CodeRoots, worker_i, cl.strong_code_root_scan_time_sec());
 }
 
-// Closure used for updating RSets and recording references that
-// point into the collection set. Only called during an
-// evacuation pause.
+// Closure used for updating rem sets. Only called during an evacuation pause.
 class G1RefineCardClosure: public CardTableEntryClosure {
   G1RemSet* _g1rs;
-  DirtyCardQueue* _into_cset_dcq;
   G1ScanObjsDuringUpdateRSClosure* _update_rs_cl;
 public:
-  G1RefineCardClosure(G1CollectedHeap* g1h,
-                      DirtyCardQueue* into_cset_dcq,
-                      G1ScanObjsDuringUpdateRSClosure* update_rs_cl) :
-    _g1rs(g1h->g1_rem_set()), _into_cset_dcq(into_cset_dcq), _update_rs_cl(update_rs_cl)
+  G1RefineCardClosure(G1CollectedHeap* g1h, G1ScanObjsDuringUpdateRSClosure* update_rs_cl) :
+    _g1rs(g1h->g1_rem_set()), _update_rs_cl(update_rs_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");
 
-    if (_g1rs->refine_card_during_gc(card_ptr, _update_rs_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.
-      //
-      // Enqueue the card
-      _into_cset_dcq->enqueue(card_ptr);
-    }
+    _g1rs->refine_card_during_gc(card_ptr, _update_rs_cl);
     return true;
   }
 };
 
-void G1RemSet::update_rem_set(DirtyCardQueue* into_cset_dcq,
-                              G1ParScanThreadState* pss,
-                              uint worker_i) {
+void G1RemSet::update_rem_set(G1ParScanThreadState* pss, uint worker_i) {
   G1ScanObjsDuringUpdateRSClosure update_rs_cl(_g1, pss, worker_i);
-  G1RefineCardClosure refine_card_cl(_g1, into_cset_dcq, &update_rs_cl);
+  G1RefineCardClosure refine_card_cl(_g1, &update_rs_cl);
 
   G1GCParPhaseTimesTracker x(_g1p->phase_times(), G1GCPhaseTimes::UpdateRS, worker_i);
   if (G1HotCardCache::default_use_cache()) {
     // Apply the closure to the entries of the hot card cache.
     G1GCParPhaseTimesTracker y(_g1p->phase_times(), G1GCPhaseTimes::ScanHCC, worker_i);

@@ -501,22 +476,11 @@
 }
 
 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
-  // circumstances (i.e. the pause successfully completes), these cards
-  // are just discarded (there's no need to update the RSets of regions
-  // that were in the collection set - after the pause these regions
-  // 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, pss, worker_i);
+  update_rem_set(pss, worker_i);
   scan_rem_set(pss, heap_region_codeblobs, worker_i);;
 }
 
 void G1RemSet::prepare_for_oops_into_collection_set_do() {
   DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set();

@@ -530,30 +494,10 @@
 
   // Set all cards back to clean.
   double start = os::elapsedTime();
   _scan_state->clear_card_table(_g1->workers());
   phase_times->record_clear_ct_time((os::elapsedTime() - start) * 1000.0);
-
-  DirtyCardQueueSet& into_cset_dcqs = _into_cset_dirty_card_queue_set;
-
-  if (_g1->evacuation_failed()) {
-    double restore_remembered_set_start = os::elapsedTime();
-
-    // Restore remembered sets for the regions pointing into the collection set.
-    // We just need to transfer the completed buffers from the DirtyCardQueueSet
-    // used to hold cards that contain references that point into the collection set
-    // to the DCQS used to hold the deferred RS updates.
-    _g1->dirty_card_queue_set().merge_bufferlists(&into_cset_dcqs);
-    phase_times->record_evac_fail_restore_remsets((os::elapsedTime() - restore_remembered_set_start) * 1000.0);
-  }
-
-  // Free any completed buffers in the DirtyCardQueueSet used to hold cards
-  // which contain references that point into the collection.
-  _into_cset_dirty_card_queue_set.clear();
-  assert(_into_cset_dirty_card_queue_set.completed_buffers_num() == 0,
-         "all buffers should be freed");
-  _into_cset_dirty_card_queue_set.clear_n_completed_buffers();
 }
 
 class G1ScrubRSClosure: public HeapRegionClosure {
   G1CollectedHeap* _g1h;
   G1CardLiveData* _live_data;

@@ -734,22 +678,20 @@
   } else {
     _num_conc_refined_cards++; // Unsynchronized update, only used for logging.
   }
 }
 
-bool G1RemSet::refine_card_during_gc(jbyte* card_ptr,
+void G1RemSet::refine_card_during_gc(jbyte* card_ptr,
                                      G1ScanObjsDuringUpdateRSClosure* update_rs_cl) {
   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
   // scanned as parts of the remembered sets.
   if (*card_ptr != CardTableModRefBS::dirty_card_val()) {
-    // No need to return that this card contains refs that point
-    // into the collection set.
-    return false;
+    return;
   }
 
   // During GC we can immediately clean the card since we will not re-enqueue stale
   // cards as we know they can be disregarded.
   *card_ptr = CardTableModRefBS::clean_card_val();

@@ -760,26 +702,22 @@
   HeapRegion* r = _g1->heap_region_containing(card_start);
 
   HeapWord* scan_limit = _scan_state->scan_top(r->hrm_index());
   if (scan_limit <= card_start) {
     // If the card starts above the area in the region containing objects to scan, skip it.
-    return false;
+    return;
   }
 
   // Don't use addr_for(card_ptr + 1) which can ask for
   // 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");
 
   update_rs_cl->set_region(r);
-  update_rs_cl->reset_has_refs_into_cset();
-
   bool card_processed = r->oops_on_card_seq_iterate_careful<true>(dirty_region, update_rs_cl);
   assert(card_processed, "must be");
-
-  return update_rs_cl->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 >