< prev index next >

src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.cpp

Print this page

 91   nmethod::oops_do_marking_epilogue();
 92 }
 93 
 94 ShenandoahRootProcessor::ShenandoahRootProcessor(ShenandoahPhaseTimings::Phase phase) :
 95   _heap(ShenandoahHeap::heap()),
 96   _phase(phase),
 97   _worker_phase(phase) {
 98 }
 99 
100 ShenandoahRootScanner::ShenandoahRootScanner(uint n_workers, ShenandoahPhaseTimings::Phase phase) :
101   ShenandoahRootProcessor(phase),
102   _thread_roots(phase, n_workers > 1) {
103   nmethod::oops_do_marking_prologue();
104 }
105 
106 ShenandoahRootScanner::~ShenandoahRootScanner() {
107   nmethod::oops_do_marking_epilogue();
108 }
109 
110 void ShenandoahRootScanner::roots_do(uint worker_id, OopClosure* oops) {
111   MarkingCodeBlobClosure blobs_cl(oops, !CodeBlobToOopClosure::FixRelocations);
112   roots_do(worker_id, oops, &blobs_cl);
113 }
114 
115 void ShenandoahRootScanner::roots_do(uint worker_id, OopClosure* oops, CodeBlobClosure* code, ThreadClosure *tc) {
116   assert(ShenandoahSafepoint::is_at_shenandoah_safepoint(), "Must be at a safepoint");
117 
118   ShenandoahParallelOopsDoThreadClosure tc_cl(oops, code, tc);
119   ResourceMark rm;
120   _thread_roots.threads_do(&tc_cl, worker_id);
121 }
122 
123 ShenandoahSTWRootScanner::ShenandoahSTWRootScanner(ShenandoahPhaseTimings::Phase phase) :
124    ShenandoahRootProcessor(phase),
125    _thread_roots(phase, ShenandoahHeap::heap()->workers()->active_workers() > 1),
126    _code_roots(phase),
127    _cld_roots(phase, ShenandoahHeap::heap()->workers()->active_workers(), false /*heap iteration*/),
128    _vm_roots(phase),
129    _unload_classes(ShenandoahHeap::heap()->unload_classes()) {
130 }
131 

243   _weak_roots.oops_do<OopClosure>(oops, worker_id);
244   _cld_roots.cld_do(&adjust_cld_closure, worker_id);
245 
246   // Process heavy-weight/fully parallel roots the last
247   _code_roots.code_blobs_do(adjust_code_closure, worker_id);
248   _thread_roots.oops_do(oops, NULL, worker_id);
249 }
250 
251 ShenandoahHeapIterationRootScanner::ShenandoahHeapIterationRootScanner(uint n_workers) :
252    ShenandoahRootProcessor(ShenandoahPhaseTimings::heap_iteration_roots),
253    _thread_roots(ShenandoahPhaseTimings::heap_iteration_roots, false /*is par*/),
254    _vm_roots(ShenandoahPhaseTimings::heap_iteration_roots),
255    _cld_roots(ShenandoahPhaseTimings::heap_iteration_roots, n_workers, true /*heap iteration*/),
256    _weak_roots(ShenandoahPhaseTimings::heap_iteration_roots),
257    _code_roots(ShenandoahPhaseTimings::heap_iteration_roots) {
258  }
259 
260  void ShenandoahHeapIterationRootScanner::roots_do(OopClosure* oops) {
261    // Must use _claim_other to avoid interfering with concurrent CLDG iteration
262    CLDToOopClosure clds(oops, ClassLoaderData::_claim_other);
263    MarkingCodeBlobClosure code(oops, !CodeBlobToOopClosure::FixRelocations);
264    ShenandoahParallelOopsDoThreadClosure tc_cl(oops, &code, NULL);
265    AlwaysTrueClosure always_true;
266 
267    ResourceMark rm;
268 
269    // Process light-weight/limited parallel roots then
270    _vm_roots.oops_do(oops, 0);
271    _weak_roots.oops_do<OopClosure>(oops, 0);
272    _cld_roots.cld_do(&clds, 0);
273 
274    // Process heavy-weight/fully parallel roots the last
275    _code_roots.code_blobs_do(&code, 0);
276    _thread_roots.threads_do(&tc_cl, 0);
277  }

 91   nmethod::oops_do_marking_epilogue();
 92 }
 93 
 94 ShenandoahRootProcessor::ShenandoahRootProcessor(ShenandoahPhaseTimings::Phase phase) :
 95   _heap(ShenandoahHeap::heap()),
 96   _phase(phase),
 97   _worker_phase(phase) {
 98 }
 99 
100 ShenandoahRootScanner::ShenandoahRootScanner(uint n_workers, ShenandoahPhaseTimings::Phase phase) :
101   ShenandoahRootProcessor(phase),
102   _thread_roots(phase, n_workers > 1) {
103   nmethod::oops_do_marking_prologue();
104 }
105 
106 ShenandoahRootScanner::~ShenandoahRootScanner() {
107   nmethod::oops_do_marking_epilogue();
108 }
109 
110 void ShenandoahRootScanner::roots_do(uint worker_id, OopClosure* oops) {
111   MarkingCodeBlobClosure blobs_cl(oops, !CodeBlobToOopClosure::FixRelocations, true /*FIXME*/);
112   roots_do(worker_id, oops, &blobs_cl);
113 }
114 
115 void ShenandoahRootScanner::roots_do(uint worker_id, OopClosure* oops, CodeBlobClosure* code, ThreadClosure *tc) {
116   assert(ShenandoahSafepoint::is_at_shenandoah_safepoint(), "Must be at a safepoint");
117 
118   ShenandoahParallelOopsDoThreadClosure tc_cl(oops, code, tc);
119   ResourceMark rm;
120   _thread_roots.threads_do(&tc_cl, worker_id);
121 }
122 
123 ShenandoahSTWRootScanner::ShenandoahSTWRootScanner(ShenandoahPhaseTimings::Phase phase) :
124    ShenandoahRootProcessor(phase),
125    _thread_roots(phase, ShenandoahHeap::heap()->workers()->active_workers() > 1),
126    _code_roots(phase),
127    _cld_roots(phase, ShenandoahHeap::heap()->workers()->active_workers(), false /*heap iteration*/),
128    _vm_roots(phase),
129    _unload_classes(ShenandoahHeap::heap()->unload_classes()) {
130 }
131 

243   _weak_roots.oops_do<OopClosure>(oops, worker_id);
244   _cld_roots.cld_do(&adjust_cld_closure, worker_id);
245 
246   // Process heavy-weight/fully parallel roots the last
247   _code_roots.code_blobs_do(adjust_code_closure, worker_id);
248   _thread_roots.oops_do(oops, NULL, worker_id);
249 }
250 
251 ShenandoahHeapIterationRootScanner::ShenandoahHeapIterationRootScanner(uint n_workers) :
252    ShenandoahRootProcessor(ShenandoahPhaseTimings::heap_iteration_roots),
253    _thread_roots(ShenandoahPhaseTimings::heap_iteration_roots, false /*is par*/),
254    _vm_roots(ShenandoahPhaseTimings::heap_iteration_roots),
255    _cld_roots(ShenandoahPhaseTimings::heap_iteration_roots, n_workers, true /*heap iteration*/),
256    _weak_roots(ShenandoahPhaseTimings::heap_iteration_roots),
257    _code_roots(ShenandoahPhaseTimings::heap_iteration_roots) {
258  }
259 
260  void ShenandoahHeapIterationRootScanner::roots_do(OopClosure* oops) {
261    // Must use _claim_other to avoid interfering with concurrent CLDG iteration
262    CLDToOopClosure clds(oops, ClassLoaderData::_claim_other);
263    MarkingCodeBlobClosure code(oops, !CodeBlobToOopClosure::FixRelocations, true /*FIXME*/);
264    ShenandoahParallelOopsDoThreadClosure tc_cl(oops, &code, NULL);
265    AlwaysTrueClosure always_true;
266 
267    ResourceMark rm;
268 
269    // Process light-weight/limited parallel roots then
270    _vm_roots.oops_do(oops, 0);
271    _weak_roots.oops_do<OopClosure>(oops, 0);
272    _cld_roots.cld_do(&clds, 0);
273 
274    // Process heavy-weight/fully parallel roots the last
275    _code_roots.code_blobs_do(&code, 0);
276    _thread_roots.threads_do(&tc_cl, 0);
277  }
< prev index next >