From a372be4ba2216adb325f7616e54c1d58ac8fdf2a Mon Sep 17 00:00:00 2001 From: Zhengyu Gu Date: Tue, 15 Dec 2020 13:22:10 +0000 Subject: [PATCH] 8258244: Shenandoah: Not expecting forwarded object in roots during mark after JDK-8240868 Reviewed-by: rkennke --- .../shenandoah/shenandoahConcurrentMark.cpp | 26 +++++-------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.cpp b/src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.cpp index 2e6ff75b431..7000cdc8ef1 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.cpp @@ -51,7 +51,6 @@ #include "oops/oop.inline.hpp" #include "runtime/handles.inline.hpp" -template class ShenandoahInitMarkRootsClosure : public OopClosure { private: ShenandoahObjToScanQueue* _queue; @@ -60,7 +59,7 @@ private: template inline void do_oop_work(T* p) { - ShenandoahConcurrentMark::mark_through_ref(p, _heap, _queue, _mark_context, false); + ShenandoahConcurrentMark::mark_through_ref(p, _heap, _queue, _mark_context, false); } public: @@ -81,7 +80,6 @@ ShenandoahMarkRefsSuperClosure::ShenandoahMarkRefsSuperClosure(ShenandoahObjToSc _weak(false) { } -template class ShenandoahInitMarkRootsTask : public AbstractGangTask { private: ShenandoahRootScanner* _rp; @@ -101,7 +99,7 @@ public: ShenandoahObjToScanQueue* q = queues->queue(worker_id); - ShenandoahInitMarkRootsClosure mark_cl(q); + ShenandoahInitMarkRootsClosure mark_cl(q); do_work(heap, &mark_cl, worker_id); } @@ -301,15 +299,8 @@ void ShenandoahConcurrentMark::mark_roots(ShenandoahPhaseTimings::Phase root_pha TASKQUEUE_STATS_ONLY(task_queues()->reset_taskqueue_stats()); task_queues()->reserve(nworkers); - if (heap->has_forwarded_objects()) { - ShenandoahInitMarkRootsTask mark_roots(&root_proc); - workers->run_task(&mark_roots); - } else { - // No need to update references, which means the heap is stable. - // Can save time not walking through forwarding pointers. - ShenandoahInitMarkRootsTask mark_roots(&root_proc); - workers->run_task(&mark_roots); - } + ShenandoahInitMarkRootsTask mark_roots(&root_proc); + workers->run_task(&mark_roots); } void ShenandoahConcurrentMark::update_roots(ShenandoahPhaseTimings::Phase root_phase) { @@ -463,13 +454,8 @@ void ShenandoahConcurrentMark::finish_mark_from_roots(bool full_gc) { ShenandoahPhaseTimings::full_gc_scan_conc_roots : ShenandoahPhaseTimings::degen_gc_scan_conc_roots; ShenandoahGCPhase gc_phase(phase); - if (_heap->has_forwarded_objects()) { - ShenandoahProcessConcurrentRootsTask task(this, phase, nworkers); - _heap->workers()->run_task(&task); - } else { - ShenandoahProcessConcurrentRootsTask task(this, phase, nworkers); - _heap->workers()->run_task(&task); - } + ShenandoahProcessConcurrentRootsTask task(this, phase, nworkers); + _heap->workers()->run_task(&task); } // Finally mark everything else we've got in our queues during the previous steps.