Skip to content

Commit 289c30b

Browse files
committed
8231198: Shenandoah: heap walking should visit all roots most of the time
Reviewed-by: zgu, rkennke
1 parent f925696 commit 289c30b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1296,7 +1296,10 @@ void ShenandoahHeap::object_iterate(ObjectClosure* cl) {
12961296
ShenandoahHeapIterationRootScanner rp;
12971297
ObjectIterateScanRootClosure oops(&_aux_bit_map, &oop_stack);
12981298

1299-
if (unload_classes()) {
1299+
// If we are unloading classes right now, we should not touch weak roots,
1300+
// on the off-chance we would evacuate them and make them live accidentally.
1301+
// In other cases, we have to scan all roots.
1302+
if (is_evacuation_in_progress() && unload_classes()) {
13001303
rp.strong_roots_do(&oops);
13011304
} else {
13021305
rp.roots_do(&oops);

0 commit comments

Comments
 (0)