17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "gc/g1/g1CollectedHeap.hpp"
27 #include "gc/g1/g1FullCollector.hpp"
28 #include "gc/g1/g1FullGCMarker.hpp"
29 #include "gc/g1/g1FullGCOopClosures.inline.hpp"
30 #include "gc/g1/g1FullGCReferenceProcessorExecutor.hpp"
31 #include "gc/shared/gcTraceTime.inline.hpp"
32 #include "gc/shared/referenceProcessor.hpp"
33
34 G1FullGCReferenceProcessingExecutor::G1FullGCReferenceProcessingExecutor(G1FullCollector* collector) :
35 _collector(collector),
36 _reference_processor(collector->reference_processor()),
37 _old_mt_degree(_reference_processor->num_q()) {
38 if (_reference_processor->processing_is_mt()) {
39 _reference_processor->set_active_mt_degree(_collector->workers());
40 }
41 }
42
43 G1FullGCReferenceProcessingExecutor::~G1FullGCReferenceProcessingExecutor() {
44 if (_reference_processor->processing_is_mt()) {
45 _reference_processor->set_active_mt_degree(_old_mt_degree);
46 }
47 }
48
49 G1FullGCReferenceProcessingExecutor::G1RefProcTaskProxy::G1RefProcTaskProxy(ProcessTask& proc_task,
50 G1FullCollector* collector) :
51 AbstractGangTask("G1 reference processing task"),
52 _proc_task(proc_task),
53 _collector(collector),
54 _terminator(_collector->workers(), _collector->oop_queue_set()) { }
55
56 void G1FullGCReferenceProcessingExecutor::G1RefProcTaskProxy::work(uint worker_id) {
57 G1FullGCMarker* marker = _collector->marker(worker_id);
75 G1CollectedHeap::heap()->workers()->run_task(task, _collector->workers());
76 }
77
78 void G1FullGCReferenceProcessingExecutor::execute(ProcessTask& proc_task) {
79 G1RefProcTaskProxy proc_task_proxy(proc_task, _collector);
80 run_task(&proc_task_proxy);
81 }
82
83 // Driver routine for parallel reference processing.
84 void G1FullGCReferenceProcessingExecutor::execute(EnqueueTask& enq_task) {
85 G1RefEnqueueTaskProxy enq_task_proxy(enq_task);
86 run_task(&enq_task_proxy);
87 }
88
89 void G1FullGCReferenceProcessingExecutor::execute(STWGCTimer* timer, G1FullGCTracer* tracer) {
90 GCTraceTime(Debug, gc, phases) debug("Phase 1: Reference Processing", timer);
91 // Process reference objects found during marking.
92 G1FullGCMarker* marker = _collector->marker(0);
93 G1IsAliveClosure is_alive(_collector->mark_bitmap());
94 G1FullKeepAliveClosure keep_alive(marker);
95 ReferenceProcessorPhaseTimes pt(timer, _reference_processor->num_q());
96 AbstractRefProcTaskExecutor* executor = _reference_processor->processing_is_mt() ? this : NULL;
97
98 // Process discovered references, use this executor if multi-threaded
99 // processing is enabled.
100 const ReferenceProcessorStats& stats =
101 _reference_processor->process_discovered_references(&is_alive,
102 &keep_alive,
103 marker->stack_closure(),
104 executor,
105 &pt);
106
107 tracer->report_gc_reference_stats(stats);
108 pt.print_all_references();
109
110 assert(marker->oop_stack()->is_empty(), "Should be no oops on the stack");
111
112 // Now enqueue the references.
113 _reference_processor->enqueue_discovered_references(executor, &pt);
114 pt.print_enqueue_phase();
115 }
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "gc/g1/g1CollectedHeap.hpp"
27 #include "gc/g1/g1FullCollector.hpp"
28 #include "gc/g1/g1FullGCMarker.hpp"
29 #include "gc/g1/g1FullGCOopClosures.inline.hpp"
30 #include "gc/g1/g1FullGCReferenceProcessorExecutor.hpp"
31 #include "gc/shared/gcTraceTime.inline.hpp"
32 #include "gc/shared/referenceProcessor.hpp"
33
34 G1FullGCReferenceProcessingExecutor::G1FullGCReferenceProcessingExecutor(G1FullCollector* collector) :
35 _collector(collector),
36 _reference_processor(collector->reference_processor()),
37 _old_mt_degree(_reference_processor->num_queues()) {
38 if (_reference_processor->processing_is_mt()) {
39 _reference_processor->set_active_mt_degree(_collector->workers());
40 }
41 }
42
43 G1FullGCReferenceProcessingExecutor::~G1FullGCReferenceProcessingExecutor() {
44 if (_reference_processor->processing_is_mt()) {
45 _reference_processor->set_active_mt_degree(_old_mt_degree);
46 }
47 }
48
49 G1FullGCReferenceProcessingExecutor::G1RefProcTaskProxy::G1RefProcTaskProxy(ProcessTask& proc_task,
50 G1FullCollector* collector) :
51 AbstractGangTask("G1 reference processing task"),
52 _proc_task(proc_task),
53 _collector(collector),
54 _terminator(_collector->workers(), _collector->oop_queue_set()) { }
55
56 void G1FullGCReferenceProcessingExecutor::G1RefProcTaskProxy::work(uint worker_id) {
57 G1FullGCMarker* marker = _collector->marker(worker_id);
75 G1CollectedHeap::heap()->workers()->run_task(task, _collector->workers());
76 }
77
78 void G1FullGCReferenceProcessingExecutor::execute(ProcessTask& proc_task) {
79 G1RefProcTaskProxy proc_task_proxy(proc_task, _collector);
80 run_task(&proc_task_proxy);
81 }
82
83 // Driver routine for parallel reference processing.
84 void G1FullGCReferenceProcessingExecutor::execute(EnqueueTask& enq_task) {
85 G1RefEnqueueTaskProxy enq_task_proxy(enq_task);
86 run_task(&enq_task_proxy);
87 }
88
89 void G1FullGCReferenceProcessingExecutor::execute(STWGCTimer* timer, G1FullGCTracer* tracer) {
90 GCTraceTime(Debug, gc, phases) debug("Phase 1: Reference Processing", timer);
91 // Process reference objects found during marking.
92 G1FullGCMarker* marker = _collector->marker(0);
93 G1IsAliveClosure is_alive(_collector->mark_bitmap());
94 G1FullKeepAliveClosure keep_alive(marker);
95 ReferenceProcessorPhaseTimes pt(timer, _reference_processor->num_queues());
96 AbstractRefProcTaskExecutor* executor = _reference_processor->processing_is_mt() ? this : NULL;
97
98 // Process discovered references, use this executor if multi-threaded
99 // processing is enabled.
100 const ReferenceProcessorStats& stats =
101 _reference_processor->process_discovered_references(&is_alive,
102 &keep_alive,
103 marker->stack_closure(),
104 executor,
105 &pt);
106
107 tracer->report_gc_reference_stats(stats);
108 pt.print_all_references();
109
110 assert(marker->oop_stack()->is_empty(), "Should be no oops on the stack");
111
112 // Now enqueue the references.
113 _reference_processor->enqueue_discovered_references(executor, &pt);
114 pt.print_enqueue_phase();
115 }
|