3887 // Serial Complete GC closure
3888 G1STWDrainQueueClosure drain_queue(this, pss);
3889
3890 // Setup the soft refs policy...
3891 rp->setup_policy(false);
3892
3893 ReferenceProcessorPhaseTimes* pt = g1_policy()->phase_times()->ref_phase_times();
3894
3895 ReferenceProcessorStats stats;
3896 if (!rp->processing_is_mt()) {
3897 // Serial reference processing...
3898 stats = rp->process_discovered_references(&is_alive,
3899 &keep_alive,
3900 &drain_queue,
3901 NULL,
3902 pt);
3903 } else {
3904 uint no_of_gc_workers = workers()->active_workers();
3905
3906 // Parallel reference processing
3907 assert(no_of_gc_workers <= rp->max_num_q(),
3908 "Mismatch between the number of GC workers %u and the maximum number of Reference process queues %u",
3909 no_of_gc_workers, rp->max_num_q());
3910
3911 G1STWRefProcTaskExecutor par_task_executor(this, per_thread_states, workers(), _task_queues, no_of_gc_workers);
3912 stats = rp->process_discovered_references(&is_alive,
3913 &keep_alive,
3914 &drain_queue,
3915 &par_task_executor,
3916 pt);
3917 }
3918
3919 _gc_tracer_stw->report_gc_reference_stats(stats);
3920
3921 // We have completed copying any necessary live referent objects.
3922 assert(pss->queue_is_empty(), "both queue and overflow should be empty");
3923
3924 double ref_proc_time = os::elapsedTime() - ref_proc_start;
3925 g1_policy()->phase_times()->record_ref_proc_time(ref_proc_time * 1000.0);
3926 }
3927
3928 // Weak Reference processing during an evacuation pause (part 2).
3929 void G1CollectedHeap::enqueue_discovered_references(G1ParScanThreadStateSet* per_thread_states) {
3930 double ref_enq_start = os::elapsedTime();
3931
3932 ReferenceProcessor* rp = _ref_processor_stw;
3933 assert(!rp->discovery_enabled(), "should have been disabled as part of processing");
3934
3935 ReferenceProcessorPhaseTimes* pt = g1_policy()->phase_times()->ref_phase_times();
3936
3937 // Now enqueue any remaining on the discovered lists on to
3938 // the pending list.
3939 if (!rp->processing_is_mt()) {
3940 // Serial reference processing...
3941 rp->enqueue_discovered_references(NULL, pt);
3942 } else {
3943 // Parallel reference enqueueing
3944
3945 uint n_workers = workers()->active_workers();
3946
3947 assert(n_workers <= rp->max_num_q(),
3948 "Mismatch between the number of GC workers %u and the maximum number of Reference process queues %u",
3949 n_workers, rp->max_num_q());
3950
3951 G1STWRefProcTaskExecutor par_task_executor(this, per_thread_states, workers(), _task_queues, n_workers);
3952 rp->enqueue_discovered_references(&par_task_executor, pt);
3953 }
3954
3955 rp->verify_no_references_recorded();
3956 assert(!rp->discovery_enabled(), "should have been disabled");
3957
3958 // If during an initial mark pause we install a pending list head which is not otherwise reachable
3959 // ensure that it is marked in the bitmap for concurrent marking to discover.
3960 if (collector_state()->in_initial_mark_gc()) {
3961 oop pll_head = Universe::reference_pending_list();
3962 if (pll_head != NULL) {
3963 // Any valid worker id is fine here as we are in the VM thread and single-threaded.
3964 _cm->mark_in_next_bitmap(0 /* worker_id */, pll_head);
3965 }
3966 }
3967
3968 // FIXME
3969 // CM's reference processing also cleans up the string and symbol tables.
|
3887 // Serial Complete GC closure
3888 G1STWDrainQueueClosure drain_queue(this, pss);
3889
3890 // Setup the soft refs policy...
3891 rp->setup_policy(false);
3892
3893 ReferenceProcessorPhaseTimes* pt = g1_policy()->phase_times()->ref_phase_times();
3894
3895 ReferenceProcessorStats stats;
3896 if (!rp->processing_is_mt()) {
3897 // Serial reference processing...
3898 stats = rp->process_discovered_references(&is_alive,
3899 &keep_alive,
3900 &drain_queue,
3901 NULL,
3902 pt);
3903 } else {
3904 uint no_of_gc_workers = workers()->active_workers();
3905
3906 // Parallel reference processing
3907 assert(no_of_gc_workers <= rp->max_num_queues(),
3908 "Mismatch between the number of GC workers %u and the maximum number of Reference process queues %u",
3909 no_of_gc_workers, rp->max_num_queues());
3910
3911 G1STWRefProcTaskExecutor par_task_executor(this, per_thread_states, workers(), _task_queues, no_of_gc_workers);
3912 stats = rp->process_discovered_references(&is_alive,
3913 &keep_alive,
3914 &drain_queue,
3915 &par_task_executor,
3916 pt);
3917 }
3918
3919 _gc_tracer_stw->report_gc_reference_stats(stats);
3920
3921 // We have completed copying any necessary live referent objects.
3922 assert(pss->queue_is_empty(), "both queue and overflow should be empty");
3923
3924 double ref_proc_time = os::elapsedTime() - ref_proc_start;
3925 g1_policy()->phase_times()->record_ref_proc_time(ref_proc_time * 1000.0);
3926 }
3927
3928 // Weak Reference processing during an evacuation pause (part 2).
3929 void G1CollectedHeap::enqueue_discovered_references(G1ParScanThreadStateSet* per_thread_states) {
3930 double ref_enq_start = os::elapsedTime();
3931
3932 ReferenceProcessor* rp = _ref_processor_stw;
3933 assert(!rp->discovery_enabled(), "should have been disabled as part of processing");
3934
3935 ReferenceProcessorPhaseTimes* pt = g1_policy()->phase_times()->ref_phase_times();
3936
3937 // Now enqueue any remaining on the discovered lists on to
3938 // the pending list.
3939 if (!rp->processing_is_mt()) {
3940 // Serial reference processing...
3941 rp->enqueue_discovered_references(NULL, pt);
3942 } else {
3943 // Parallel reference enqueueing
3944
3945 uint n_workers = workers()->active_workers();
3946
3947 assert(n_workers <= rp->max_num_queues(),
3948 "Mismatch between the number of GC workers %u and the maximum number of Reference process queues %u",
3949 n_workers, rp->max_num_queues());
3950
3951 G1STWRefProcTaskExecutor par_task_executor(this, per_thread_states, workers(), _task_queues, n_workers);
3952 rp->enqueue_discovered_references(&par_task_executor, pt);
3953 }
3954
3955 rp->verify_no_references_recorded();
3956 assert(!rp->discovery_enabled(), "should have been disabled");
3957
3958 // If during an initial mark pause we install a pending list head which is not otherwise reachable
3959 // ensure that it is marked in the bitmap for concurrent marking to discover.
3960 if (collector_state()->in_initial_mark_gc()) {
3961 oop pll_head = Universe::reference_pending_list();
3962 if (pll_head != NULL) {
3963 // Any valid worker id is fine here as we are in the VM thread and single-threaded.
3964 _cm->mark_in_next_bitmap(0 /* worker_id */, pll_head);
3965 }
3966 }
3967
3968 // FIXME
3969 // CM's reference processing also cleans up the string and symbol tables.
|