--- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp Fri Oct 18 14:56:01 2019 +0200
+++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp Fri Oct 18 11:36:35 2019 -0400
@@ -2042,11 +2042,19 @@
// Cleanup weak roots
ShenandoahGCPhase phase(timing_phase);
if (has_forwarded_objects()) {
- ShenandoahForwardedIsAliveClosure is_alive;
- ShenandoahUpdateRefsClosure keep_alive;
- ShenandoahParallelWeakRootsCleaningTask<ShenandoahForwardedIsAliveClosure, ShenandoahUpdateRefsClosure>
- cleaning_task(&is_alive, &keep_alive, num_workers);
- _workers->run_task(&cleaning_task);
+ if (is_traversal_mode()) {
+ ShenandoahForwardedIsAliveClosure is_alive;
+ ShenandoahTraversalUpdateRefsClosure keep_alive;
+ ShenandoahParallelWeakRootsCleaningTask<ShenandoahForwardedIsAliveClosure, ShenandoahTraversalUpdateRefsClosure>
+ cleaning_task(&is_alive, &keep_alive, num_workers);
+ _workers->run_task(&cleaning_task);
+ } else {
+ ShenandoahForwardedIsAliveClosure is_alive;
+ ShenandoahUpdateRefsClosure keep_alive;
+ ShenandoahParallelWeakRootsCleaningTask<ShenandoahForwardedIsAliveClosure, ShenandoahUpdateRefsClosure>
+ cleaning_task(&is_alive, &keep_alive, num_workers);
+ _workers->run_task(&cleaning_task);
+ }
} else {
ShenandoahIsAliveClosure is_alive;
#ifdef ASSERT