< prev index next >

src/hotspot/share/gc/g1/g1CollectedHeap.cpp

Print this page
rev 49900 : imported patch 6672778-partial-queue-trimming
rev 49901 : imported patch 6672778-refactoring
rev 49902 : imported patch 6672778-stefanj-review
rev 49905 : imported patch 8201492-properly-implement-non-contiguous-reference-processing
rev 49906 : imported patch 8201640-use-ref-processor-members-directly
rev 49907 : imported patch 8202018-move-card-table-clear
rev 49908 : imported patch 8202021-cleanup-referenceprocessor
rev 49910 : imported patch 8202017-reference-processor-remove-enqueue

@@ -3859,11 +3859,10 @@
   _workers->run_task(&enq_task_proxy);
 }
 
 // End of weak reference support closures
 
-// Weak Reference processing during an evacuation pause (part 1).
 void G1CollectedHeap::process_discovered_references(G1ParScanThreadStateSet* per_thread_states) {
   double ref_proc_start = os::elapsedTime();
 
   ReferenceProcessor* rp = _ref_processor_stw;
   assert(rp->discovery_enabled(), "should have been enabled");

@@ -3919,61 +3918,26 @@
   _gc_tracer_stw->report_gc_reference_stats(stats);
 
   // We have completed copying any necessary live referent objects.
   assert(pss->queue_is_empty(), "both queue and overflow should be empty");
 
+  make_pending_list_reachable();
+  
+  rp->verify_no_references_recorded();
+
   double ref_proc_time = os::elapsedTime() - ref_proc_start;
   g1_policy()->phase_times()->record_ref_proc_time(ref_proc_time * 1000.0);
 }
 
-// Weak Reference processing during an evacuation pause (part 2).
-void G1CollectedHeap::enqueue_discovered_references(G1ParScanThreadStateSet* per_thread_states) {
-  double ref_enq_start = os::elapsedTime();
-
-  ReferenceProcessor* rp = _ref_processor_stw;
-  assert(!rp->discovery_enabled(), "should have been disabled as part of processing");
-
-  ReferenceProcessorPhaseTimes* pt = g1_policy()->phase_times()->ref_phase_times();
-
-  // Now enqueue any remaining on the discovered lists on to
-  // the pending list.
-  if (!rp->processing_is_mt()) {
-    // Serial reference processing...
-    rp->enqueue_discovered_references(NULL, pt);
-  } else {
-    // Parallel reference enqueueing
-
-    uint n_workers = workers()->active_workers();
-
-    assert(n_workers <= rp->max_num_queues(),
-           "Mismatch between the number of GC workers %u and the maximum number of Reference process queues %u",
-           n_workers,  rp->max_num_queues());
-
-    G1STWRefProcTaskExecutor par_task_executor(this, per_thread_states, workers(), _task_queues, n_workers);
-    rp->enqueue_discovered_references(&par_task_executor, pt);
-  }
-
-  rp->verify_no_references_recorded();
-  assert(!rp->discovery_enabled(), "should have been disabled");
-
-  // If during an initial mark pause we install a pending list head which is not otherwise reachable
-  // ensure that it is marked in the bitmap for concurrent marking to discover.
+void G1CollectedHeap::make_pending_list_reachable() {
   if (collector_state()->in_initial_mark_gc()) {
     oop pll_head = Universe::reference_pending_list();
     if (pll_head != NULL) {
       // Any valid worker id is fine here as we are in the VM thread and single-threaded.
       _cm->mark_in_next_bitmap(0 /* worker_id */, pll_head);
     }
   }
-
-  // FIXME
-  // CM's reference processing also cleans up the string and symbol tables.
-  // Should we do that here also? We could, but it is a serial operation
-  // and could significantly increase the pause time.
-
-  double ref_enq_time = os::elapsedTime() - ref_enq_start;
-  g1_policy()->phase_times()->record_ref_enq_time(ref_enq_time * 1000.0);
 }
 
 void G1CollectedHeap::merge_per_thread_state_info(G1ParScanThreadStateSet* per_thread_states) {
   double merge_pss_time_start = os::elapsedTime();
   per_thread_states->flush();

@@ -4049,11 +4013,15 @@
   // 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);
+
+  // FIXME
+  // CM's reference processing also cleans up the string and symbol tables.
+  // Should we do that here also? We could, but it is a serial operation
+  // and could significantly increase the pause time.
 
   G1STWIsAliveClosure is_alive(this);
   G1KeepAliveClosure keep_alive(this);
 
   {
< prev index next >