186 { |
186 { |
187 ShenandoahTraversalClosure roots_cl(q, rp); |
187 ShenandoahTraversalClosure roots_cl(q, rp); |
188 ShenandoahMarkCLDClosure cld_cl(&roots_cl); |
188 ShenandoahMarkCLDClosure cld_cl(&roots_cl); |
189 MarkingCodeBlobClosure code_cl(&roots_cl, CodeBlobToOopClosure::FixRelocations); |
189 MarkingCodeBlobClosure code_cl(&roots_cl, CodeBlobToOopClosure::FixRelocations); |
190 if (unload_classes) { |
190 if (unload_classes) { |
191 _rp->process_strong_roots(&roots_cl, process_refs ? NULL : &roots_cl, &cld_cl, NULL, NULL, NULL, worker_id); |
191 _rp->process_strong_roots(&roots_cl, &cld_cl, NULL, NULL, NULL, worker_id); |
192 // Need to pre-evac code roots here. Otherwise we might see from-space constants. |
192 // Need to pre-evac code roots here. Otherwise we might see from-space constants. |
193 ShenandoahWorkerTimings* worker_times = _heap->phase_timings()->worker_times(); |
193 ShenandoahWorkerTimings* worker_times = _heap->phase_timings()->worker_times(); |
194 ShenandoahWorkerTimingsTracker timer(worker_times, ShenandoahPhaseTimings::CodeCacheRoots, worker_id); |
194 ShenandoahWorkerTimingsTracker timer(worker_times, ShenandoahPhaseTimings::CodeCacheRoots, worker_id); |
195 _cset_coderoots->possibly_parallel_blobs_do(&code_cl); |
195 _cset_coderoots->possibly_parallel_blobs_do(&code_cl); |
196 } else { |
196 } else { |
197 _rp->process_all_roots(&roots_cl, process_refs ? NULL : &roots_cl, &cld_cl, &code_cl, NULL, worker_id); |
197 _rp->process_all_roots(&roots_cl, &cld_cl, &code_cl, NULL, worker_id); |
198 } |
198 } |
199 } |
199 } |
200 } |
200 } |
201 }; |
201 }; |
202 |
202 |
268 ShenandoahTraversalClosure roots_cl(q, rp); |
268 ShenandoahTraversalClosure roots_cl(q, rp); |
269 CLDToOopClosure cld_cl(&roots_cl, ClassLoaderData::_claim_strong); |
269 CLDToOopClosure cld_cl(&roots_cl, ClassLoaderData::_claim_strong); |
270 ShenandoahTraversalSATBThreadsClosure tc(&satb_cl); |
270 ShenandoahTraversalSATBThreadsClosure tc(&satb_cl); |
271 if (unload_classes) { |
271 if (unload_classes) { |
272 ShenandoahRemarkCLDClosure weak_cld_cl(&roots_cl); |
272 ShenandoahRemarkCLDClosure weak_cld_cl(&roots_cl); |
273 _rp->process_strong_roots(&roots_cl, process_refs ? NULL : &roots_cl, &cld_cl, &weak_cld_cl, NULL, &tc, worker_id); |
273 _rp->process_strong_roots(&roots_cl, &cld_cl, &weak_cld_cl, NULL, &tc, worker_id); |
274 } else { |
274 } else { |
275 _rp->process_all_roots(&roots_cl, process_refs ? NULL : &roots_cl, &cld_cl, NULL, &tc, worker_id); |
275 _rp->process_all_roots(&roots_cl, &cld_cl, NULL, &tc, worker_id); |
276 } |
276 } |
277 } else { |
277 } else { |
278 ShenandoahTraversalDegenClosure roots_cl(q, rp); |
278 ShenandoahTraversalDegenClosure roots_cl(q, rp); |
279 CLDToOopClosure cld_cl(&roots_cl, ClassLoaderData::_claim_strong); |
279 CLDToOopClosure cld_cl(&roots_cl, ClassLoaderData::_claim_strong); |
280 ShenandoahTraversalSATBThreadsClosure tc(&satb_cl); |
280 ShenandoahTraversalSATBThreadsClosure tc(&satb_cl); |
281 if (unload_classes) { |
281 if (unload_classes) { |
282 ShenandoahRemarkCLDClosure weak_cld_cl(&roots_cl); |
282 ShenandoahRemarkCLDClosure weak_cld_cl(&roots_cl); |
283 _rp->process_strong_roots(&roots_cl, process_refs ? NULL : &roots_cl, &cld_cl, &weak_cld_cl, NULL, &tc, worker_id); |
283 _rp->process_strong_roots(&roots_cl, &cld_cl, &weak_cld_cl, NULL, &tc, worker_id); |
284 } else { |
284 } else { |
285 _rp->process_all_roots(&roots_cl, process_refs ? NULL : &roots_cl, &cld_cl, NULL, &tc, worker_id); |
285 _rp->process_all_roots(&roots_cl, &cld_cl, NULL, &tc, worker_id); |
286 } |
286 } |
287 } |
287 } |
288 |
288 |
289 { |
289 { |
290 ShenandoahWorkerTimings *worker_times = _heap->phase_timings()->worker_times(); |
290 ShenandoahWorkerTimings *worker_times = _heap->phase_timings()->worker_times(); |
592 |
592 |
593 if (!_heap->cancelled_gc() && _heap->process_references()) { |
593 if (!_heap->cancelled_gc() && _heap->process_references()) { |
594 weak_refs_work(); |
594 weak_refs_work(); |
595 } |
595 } |
596 |
596 |
597 if (!_heap->cancelled_gc() && _heap->unload_classes()) { |
597 if (!_heap->cancelled_gc()) { |
598 _heap->unload_classes_and_cleanup_tables(false); |
598 if (_heap->unload_classes()) { |
|
599 _heap->unload_classes_and_cleanup_tables(false); |
|
600 } |
|
601 |
599 fixup_roots(); |
602 fixup_roots(); |
600 } |
603 } |
601 |
604 |
602 if (!_heap->cancelled_gc()) { |
605 if (!_heap->cancelled_gc()) { |
603 assert(_task_queues->is_empty(), "queues must be empty after traversal GC"); |
606 assert(_task_queues->is_empty(), "queues must be empty after traversal GC"); |
696 void work(uint worker_id) { |
699 void work(uint worker_id) { |
697 ShenandoahParallelWorkerSession worker_session(worker_id); |
700 ShenandoahParallelWorkerSession worker_session(worker_id); |
698 ShenandoahTraversalFixRootsClosure cl; |
701 ShenandoahTraversalFixRootsClosure cl; |
699 MarkingCodeBlobClosure blobsCl(&cl, CodeBlobToOopClosure::FixRelocations); |
702 MarkingCodeBlobClosure blobsCl(&cl, CodeBlobToOopClosure::FixRelocations); |
700 CLDToOopClosure cldCl(&cl, ClassLoaderData::_claim_strong); |
703 CLDToOopClosure cldCl(&cl, ClassLoaderData::_claim_strong); |
701 _rp->process_all_roots(&cl, &cl, &cldCl, &blobsCl, NULL, worker_id); |
704 _rp->traversal_update_all_roots(&cl, &cldCl, &blobsCl, NULL, worker_id); |
702 } |
705 } |
703 }; |
706 }; |
704 |
707 |
705 void ShenandoahTraversalGC::fixup_roots() { |
708 void ShenandoahTraversalGC::fixup_roots() { |
706 #if defined(COMPILER2) || INCLUDE_JVMCI |
709 #if defined(COMPILER2) || INCLUDE_JVMCI |