8202018: Move card table clear before enqueuing pending references
authortschatzl
Thu, 03 May 2018 14:09:39 +0200
changeset 49966 cac87c923310
parent 49965 befc76c55940
child 49967 672ded60a082
8202018: Move card table clear before enqueuing pending references Summary: Move card table clearing in preparation of removal of the Reference enqueue phase. Reviewed-by: sangheki, sjohanss
src/hotspot/share/gc/g1/g1CollectedHeap.cpp
src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp
--- a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp	Thu May 03 14:09:21 2018 +0200
+++ b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp	Thu May 03 14:09:39 2018 +0200
@@ -4053,12 +4053,17 @@
 }
 
 void G1CollectedHeap::post_evacuate_collection_set(EvacuationInfo& evacuation_info, G1ParScanThreadStateSet* per_thread_states) {
+  // Also cleans the card table from temporary duplicate detection information used
+  // during UpdateRS/ScanRS.
+  g1_rem_set()->cleanup_after_oops_into_collection_set_do();
+
   // Process any discovered reference objects - we have
   // to do this _before_ we retire the GC alloc regions
   // as we may have to copy some 'reachable' referent
   // objects (and their reachable sub-graphs) that were
   // not copied during the pause.
   process_discovered_references(per_thread_states);
+  enqueue_discovered_references(per_thread_states);
 
   G1STWIsAliveClosure is_alive(this);
   G1KeepAliveClosure keep_alive(this);
@@ -4081,8 +4086,6 @@
     g1_policy()->phase_times()->record_string_dedup_fixup_time(fixup_time_ms);
   }
 
-  g1_rem_set()->cleanup_after_oops_into_collection_set_do();
-
   if (evacuation_failed()) {
     restore_after_evac_failure();
 
@@ -4094,15 +4097,6 @@
 
   _preserved_marks_set.assert_empty();
 
-  // Enqueue any remaining references remaining on the STW
-  // reference processor's discovered lists. We need to do
-  // this after the card table is cleaned (and verified) as
-  // the act of enqueueing entries on to the pending list
-  // will log these updates (and dirty their associated
-  // cards). We need these updates logged to update any
-  // RSets.
-  enqueue_discovered_references(per_thread_states);
-
   _allocator->release_gc_alloc_regions(evacuation_info);
 
   merge_per_thread_state_info(per_thread_states);
--- a/src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp	Thu May 03 14:09:21 2018 +0200
+++ b/src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp	Thu May 03 14:09:39 2018 +0200
@@ -397,6 +397,8 @@
 
   debug_time("Code Roots Fixup", _cur_collection_code_root_fixup_time_ms);
 
+  debug_time("Clear Card Table", _cur_clear_ct_time_ms);
+
   debug_time_for_reference("Reference Processing", _cur_ref_proc_time_ms);
   _ref_phase_times.print_all_references(2, false);
 
@@ -408,8 +410,6 @@
     debug_phase(_gc_par_phases[StringDedupTableFixup]);
   }
 
-  debug_time("Clear Card Table", _cur_clear_ct_time_ms);
-
   if (G1CollectedHeap::heap()->evacuation_failed()) {
     debug_time("Evacuation Failure", evac_fail_handling);
     trace_time("Recalculate Used", _cur_evac_fail_recalc_used);