< prev index next >

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

Print this page
rev 52753 : [backport] 8221435: Shenandoah should not mark through weak roots
Reviewed-by: rkennke, shade
rev 52754 : [backport] 8221629: Shenandoah: Cleanup class unloading logic
Reviewed-by: rkennke

*** 37,47 **** #include "gc/shenandoah/shenandoahHeap.inline.hpp" #include "gc/shenandoah/shenandoahHeapRegionSet.inline.hpp" #include "gc/shenandoah/shenandoahHeuristics.hpp" #include "gc/shenandoah/shenandoahMarkingContext.inline.hpp" #include "gc/shenandoah/shenandoahOopClosures.inline.hpp" ! #include "gc/shenandoah/shenandoahRootProcessor.hpp" #include "gc/shenandoah/shenandoahStringDedup.hpp" #include "gc/shenandoah/shenandoahTaskqueue.inline.hpp" #include "gc/shenandoah/shenandoahTimingTracker.hpp" #include "gc/shenandoah/shenandoahTraversalGC.hpp" #include "gc/shenandoah/shenandoahUtils.hpp" --- 37,47 ---- #include "gc/shenandoah/shenandoahHeap.inline.hpp" #include "gc/shenandoah/shenandoahHeapRegionSet.inline.hpp" #include "gc/shenandoah/shenandoahHeuristics.hpp" #include "gc/shenandoah/shenandoahMarkingContext.inline.hpp" #include "gc/shenandoah/shenandoahOopClosures.inline.hpp" ! #include "gc/shenandoah/shenandoahRootProcessor.inline.hpp" #include "gc/shenandoah/shenandoahStringDedup.hpp" #include "gc/shenandoah/shenandoahTaskqueue.inline.hpp" #include "gc/shenandoah/shenandoahTimingTracker.hpp" #include "gc/shenandoah/shenandoahTraversalGC.hpp" #include "gc/shenandoah/shenandoahUtils.hpp"
*** 190,206 **** { ShenandoahTraversalClosure roots_cl(q, rp); ShenandoahMarkCLDClosure cld_cl(&roots_cl); MarkingCodeBlobClosure code_cl(&roots_cl, CodeBlobToOopClosure::FixRelocations); if (unload_classes) { ! _rp->process_strong_roots(&roots_cl, process_refs ? NULL : &roots_cl, &cld_cl, NULL, NULL, NULL, worker_id); // Need to pre-evac code roots here. Otherwise we might see from-space constants. ShenandoahWorkerTimings* worker_times = _heap->phase_timings()->worker_times(); ShenandoahWorkerTimingsTracker timer(worker_times, ShenandoahPhaseTimings::CodeCacheRoots, worker_id); _cset_coderoots->possibly_parallel_blobs_do(&code_cl); } else { ! _rp->process_all_roots(&roots_cl, process_refs ? NULL : &roots_cl, &cld_cl, &code_cl, NULL, worker_id); } } } }; --- 190,206 ---- { ShenandoahTraversalClosure roots_cl(q, rp); ShenandoahMarkCLDClosure cld_cl(&roots_cl); MarkingCodeBlobClosure code_cl(&roots_cl, CodeBlobToOopClosure::FixRelocations); if (unload_classes) { ! _rp->process_strong_roots(&roots_cl, &cld_cl, NULL, NULL, worker_id); // Need to pre-evac code roots here. Otherwise we might see from-space constants. ShenandoahWorkerTimings* worker_times = _heap->phase_timings()->worker_times(); ShenandoahWorkerTimingsTracker timer(worker_times, ShenandoahPhaseTimings::CodeCacheRoots, worker_id); _cset_coderoots->possibly_parallel_blobs_do(&code_cl); } else { ! _rp->process_all_roots(&roots_cl, &cld_cl, &code_cl, NULL, worker_id); } } } };
*** 271,294 **** if (!_heap->is_degenerated_gc_in_progress()) { ShenandoahTraversalClosure roots_cl(q, rp); CLDToOopClosure cld_cl(&roots_cl); ShenandoahTraversalSATBThreadsClosure tc(&satb_cl); if (unload_classes) { ! ShenandoahRemarkCLDClosure weak_cld_cl(&roots_cl); ! _rp->process_strong_roots(&roots_cl, process_refs ? NULL : &roots_cl, &cld_cl, &weak_cld_cl, NULL, &tc, worker_id); } else { ! _rp->process_all_roots(&roots_cl, process_refs ? NULL : &roots_cl, &cld_cl, NULL, &tc, worker_id); } } else { ShenandoahTraversalDegenClosure roots_cl(q, rp); CLDToOopClosure cld_cl(&roots_cl); ShenandoahTraversalSATBThreadsClosure tc(&satb_cl); if (unload_classes) { ! ShenandoahRemarkCLDClosure weak_cld_cl(&roots_cl); ! _rp->process_strong_roots(&roots_cl, process_refs ? NULL : &roots_cl, &cld_cl, &weak_cld_cl, NULL, &tc, worker_id); } else { ! _rp->process_all_roots(&roots_cl, process_refs ? NULL : &roots_cl, &cld_cl, NULL, &tc, worker_id); } } { ShenandoahWorkerTimings *worker_times = _heap->phase_timings()->worker_times(); --- 271,294 ---- if (!_heap->is_degenerated_gc_in_progress()) { ShenandoahTraversalClosure roots_cl(q, rp); CLDToOopClosure cld_cl(&roots_cl); ShenandoahTraversalSATBThreadsClosure tc(&satb_cl); if (unload_classes) { ! ShenandoahRemarkCLDClosure remark_cld_cl(&roots_cl); ! _rp->process_strong_roots(&roots_cl, &remark_cld_cl, NULL, &tc, worker_id); } else { ! _rp->process_all_roots(&roots_cl, &cld_cl, NULL, &tc, worker_id); } } else { ShenandoahTraversalDegenClosure roots_cl(q, rp); CLDToOopClosure cld_cl(&roots_cl); ShenandoahTraversalSATBThreadsClosure tc(&satb_cl); if (unload_classes) { ! ShenandoahRemarkCLDClosure remark_cld_cl(&roots_cl); ! _rp->process_strong_roots(&roots_cl, &remark_cld_cl, NULL, &tc, worker_id); } else { ! _rp->process_all_roots(&roots_cl, &cld_cl, NULL, &tc, worker_id); } } { ShenandoahWorkerTimings *worker_times = _heap->phase_timings()->worker_times();
*** 603,614 **** if (!_heap->cancelled_gc() && _heap->process_references()) { weak_refs_work(); } ! if (!_heap->cancelled_gc() && _heap->unload_classes()) { _heap->unload_classes_and_cleanup_tables(false); fixup_roots(); } if (!_heap->cancelled_gc()) { assert(_task_queues->is_empty(), "queues must be empty after traversal GC"); --- 603,617 ---- if (!_heap->cancelled_gc() && _heap->process_references()) { weak_refs_work(); } ! if (!_heap->cancelled_gc()) { ! if (_heap->unload_classes()) { _heap->unload_classes_and_cleanup_tables(false); + } + fixup_roots(); } if (!_heap->cancelled_gc()) { assert(_task_queues->is_empty(), "queues must be empty after traversal GC");
*** 700,717 **** ShenandoahRootProcessor* _rp; public: ShenandoahTraversalFixRootsTask(ShenandoahRootProcessor* rp) : AbstractGangTask("Shenandoah traversal fix roots"), ! _rp(rp) {} void work(uint worker_id) { ShenandoahParallelWorkerSession worker_session(worker_id); ShenandoahTraversalFixRootsClosure cl; MarkingCodeBlobClosure blobsCl(&cl, CodeBlobToOopClosure::FixRelocations); CLDToOopClosure cldCl(&cl); ! _rp->process_all_roots(&cl, &cl, &cldCl, &blobsCl, NULL, worker_id); } }; void ShenandoahTraversalGC::fixup_roots() { #if defined(COMPILER2) || INCLUDE_JVMCI --- 703,722 ---- ShenandoahRootProcessor* _rp; public: ShenandoahTraversalFixRootsTask(ShenandoahRootProcessor* rp) : AbstractGangTask("Shenandoah traversal fix roots"), ! _rp(rp) { ! assert(ShenandoahHeap::heap()->has_forwarded_objects(), "Must be"); ! } void work(uint worker_id) { ShenandoahParallelWorkerSession worker_session(worker_id); ShenandoahTraversalFixRootsClosure cl; MarkingCodeBlobClosure blobsCl(&cl, CodeBlobToOopClosure::FixRelocations); CLDToOopClosure cldCl(&cl); ! _rp->update_all_roots<ShenandoahForwardedIsAliveClosure>(&cl, &cldCl, &blobsCl, NULL, worker_id); } }; void ShenandoahTraversalGC::fixup_roots() { #if defined(COMPILER2) || INCLUDE_JVMCI
< prev index next >