changeset 46670:55a3c36b64b2

8183539: Remove G1RemSet::_into_cset_dirty_card_queue_set Reviewed-by: tschatzl, mgerdin
author ehelin
date Mon, 17 Jul 2017 11:37:00 +0200
parents f5a564180f37
children b7c2e9a24d49
files hotspot/src/share/vm/gc/g1/g1GCPhaseTimes.cpp hotspot/src/share/vm/gc/g1/g1GCPhaseTimes.hpp hotspot/src/share/vm/gc/g1/g1OopClosures.hpp hotspot/src/share/vm/gc/g1/g1OopClosures.inline.hpp hotspot/src/share/vm/gc/g1/g1RemSet.cpp hotspot/src/share/vm/gc/g1/g1RemSet.hpp hotspot/test/gc/g1/TestGCLogMessages.java
diffstat 7 files changed, 16 insertions(+), 102 deletions(-) [+]
line wrap: on
line diff
--- a/hotspot/src/share/vm/gc/g1/g1GCPhaseTimes.cpp	Fri Jul 14 14:04:57 2017 +0200
+++ b/hotspot/src/share/vm/gc/g1/g1GCPhaseTimes.cpp	Mon Jul 17 11:37:00 2017 +0200
@@ -116,7 +116,6 @@
   _cur_collection_code_root_fixup_time_ms = 0.0;
   _cur_strong_code_root_purge_time_ms = 0.0;
   _cur_evac_fail_recalc_used = 0.0;
-  _cur_evac_fail_restore_remsets = 0.0;
   _cur_evac_fail_remove_self_forwards = 0.0;
   _cur_string_dedup_fixup_time_ms = 0.0;
   _cur_prepare_tlab_time_ms = 0.0;
@@ -346,8 +345,7 @@
 
 double G1GCPhaseTimes::print_post_evacuate_collection_set() const {
   const double evac_fail_handling = _cur_evac_fail_recalc_used +
-                                    _cur_evac_fail_remove_self_forwards +
-                                    _cur_evac_fail_restore_remsets;
+                                    _cur_evac_fail_remove_self_forwards;
   const double sum_ms = evac_fail_handling +
                         _cur_collection_code_root_fixup_time_ms +
                         _recorded_preserve_cm_referents_time_ms +
@@ -383,7 +381,6 @@
     debug_time("Evacuation Failure", evac_fail_handling);
     trace_time("Recalculate Used", _cur_evac_fail_recalc_used);
     trace_time("Remove Self Forwards",_cur_evac_fail_remove_self_forwards);
-    trace_time("Restore RemSet", _cur_evac_fail_restore_remsets);
   }
 
   debug_time("Reference Enqueuing", _cur_ref_enq_time_ms);
--- a/hotspot/src/share/vm/gc/g1/g1GCPhaseTimes.hpp	Fri Jul 14 14:04:57 2017 +0200
+++ b/hotspot/src/share/vm/gc/g1/g1GCPhaseTimes.hpp	Mon Jul 17 11:37:00 2017 +0200
@@ -105,7 +105,6 @@
   double _cur_strong_code_root_purge_time_ms;
 
   double _cur_evac_fail_recalc_used;
-  double _cur_evac_fail_restore_remsets;
   double _cur_evac_fail_remove_self_forwards;
 
   double _cur_string_dedup_fixup_time_ms;
@@ -228,10 +227,6 @@
     _cur_evac_fail_recalc_used = ms;
   }
 
-  void record_evac_fail_restore_remsets(double ms) {
-    _cur_evac_fail_restore_remsets = ms;
-  }
-
   void record_evac_fail_remove_self_forwards(double ms) {
     _cur_evac_fail_remove_self_forwards = ms;
   }
--- a/hotspot/src/share/vm/gc/g1/g1OopClosures.hpp	Fri Jul 14 14:04:57 2017 +0200
+++ b/hotspot/src/share/vm/gc/g1/g1OopClosures.hpp	Mon Jul 17 11:37:00 2017 +0200
@@ -62,16 +62,12 @@
 // Used during the Update RS phase to refine remaining cards in the DCQ during garbage collection.
 class G1ScanObjsDuringUpdateRSClosure: public G1ScanClosureBase {
   uint _worker_i;
-  bool _has_refs_into_cset;
 
 public:
   G1ScanObjsDuringUpdateRSClosure(G1CollectedHeap* g1h,
                                   G1ParScanThreadState* pss,
                                   uint worker_i) :
-    G1ScanClosureBase(g1h, pss), _has_refs_into_cset(false), _worker_i(worker_i) { }
-
-  void reset_has_refs_into_cset() { _has_refs_into_cset = false; }
-  bool has_refs_into_cset() const { return _has_refs_into_cset; }
+    G1ScanClosureBase(g1h, pss), _worker_i(worker_i) { }
 
   template <class T> void do_oop_nv(T* p);
   virtual void do_oop(narrowOop* p) { do_oop_nv(p); }
--- a/hotspot/src/share/vm/gc/g1/g1OopClosures.inline.hpp	Fri Jul 14 14:04:57 2017 +0200
+++ b/hotspot/src/share/vm/gc/g1/g1OopClosures.inline.hpp	Mon Jul 17 11:37:00 2017 +0200
@@ -166,8 +166,6 @@
     // Since the source is always from outside the collection set, here we implicitly know
     // that this is a cross-region reference too.
     prefetch_and_push(p, obj);
-
-    _has_refs_into_cset = true;
   } else {
     HeapRegion* to = _g1->heap_region_containing(obj);
     if (_from == to) {
--- a/hotspot/src/share/vm/gc/g1/g1RemSet.cpp	Fri Jul 14 14:04:57 2017 +0200
+++ b/hotspot/src/share/vm/gc/g1/g1RemSet.cpp	Mon Jul 17 11:37:00 2017 +0200
@@ -288,17 +288,7 @@
   _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() {
@@ -446,18 +436,13 @@
   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) {
@@ -467,24 +452,14 @@
     // 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()) {
@@ -503,18 +478,7 @@
 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);;
 }
 
@@ -532,26 +496,6 @@
   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 {
@@ -736,7 +680,7 @@
   }
 }
 
-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");
 
@@ -745,9 +689,7 @@
   // 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
@@ -762,7 +704,7 @@
   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
@@ -772,12 +714,8 @@
   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) {
--- a/hotspot/src/share/vm/gc/g1/g1RemSet.hpp	Fri Jul 14 14:04:57 2017 +0200
+++ b/hotspot/src/share/vm/gc/g1/g1RemSet.hpp	Mon Jul 17 11:37:00 2017 +0200
@@ -59,12 +59,6 @@
 
   G1RemSetSummary _prev_period_summary;
 
-  // A DirtyCardQueueSet that is used to hold cards that contain
-  // references into the current collection set. This is used to
-  // update the remembered sets of the regions in the collection
-  // set in the event of an evacuation failure.
-  DirtyCardQueueSet _into_cset_dirty_card_queue_set;
-
   // Scan all remembered sets of the collection set for references into the collection
   // set.
   void scan_rem_set(G1ParScanThreadState* pss,
@@ -73,7 +67,7 @@
 
   // Flush remaining refinement buffers for cross-region references to either evacuate references
   // into the collection set or update the remembered set.
-  void update_rem_set(DirtyCardQueue* into_cset_dcq, G1ParScanThreadState* pss, uint worker_i);
+  void update_rem_set(G1ParScanThreadState* pss, uint worker_i);
 
   G1CollectedHeap* _g1;
   size_t _num_conc_refined_cards; // Number of cards refined concurrently to the mutator.
@@ -133,11 +127,8 @@
                                 uint worker_i);
 
   // Refine the card corresponding to "card_ptr", applying the given closure to
-  // all references found. Returns "true" if the given card contains
-  // oops that have references into the current collection set. Must only be
-  // called during gc.
-  bool refine_card_during_gc(jbyte* card_ptr,
-                             G1ScanObjsDuringUpdateRSClosure* update_rs_cl);
+  // all references found. Must only be called during gc.
+  void refine_card_during_gc(jbyte* card_ptr, G1ScanObjsDuringUpdateRSClosure* update_rs_cl);
 
   // Print accumulated summary info from the start of the VM.
   void print_summary_info();
--- a/hotspot/test/gc/g1/TestGCLogMessages.java	Fri Jul 14 14:04:57 2017 +0200
+++ b/hotspot/test/gc/g1/TestGCLogMessages.java	Mon Jul 17 11:37:00 2017 +0200
@@ -196,7 +196,6 @@
         new LogMessageWithLevel("Evacuation Failure", Level.DEBUG),
         new LogMessageWithLevel("Recalculate Used", Level.TRACE),
         new LogMessageWithLevel("Remove Self Forwards", Level.TRACE),
-        new LogMessageWithLevel("Restore RemSet", Level.TRACE),
     };
 
     private void testWithToSpaceExhaustionLogs() throws Exception {