< prev index next >

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

Print this page
rev 56313 : 8231197: Shenandoah: JVMTI heap walking cleanup crashes with NULL forwardee
Reviewed-by: XXX
rev 56314 : 8231198: Shenandoah: heap walking should visit all roots most of the time
Reviewed-by: XXX

@@ -1294,11 +1294,14 @@
 
   // First, we process GC roots according to current GC cycle. This populates the work stack with initial objects.
   ShenandoahHeapIterationRootScanner rp;
   ObjectIterateScanRootClosure oops(&_aux_bit_map, &oop_stack);
 
-  if (unload_classes()) {
+  // If we are unloading classes right now, we should not touch weak roots,
+  // on the off-chance we would evacuate them and make them live accidentally.
+  // In other cases, we have to scan all roots.
+  if (is_evacuation_in_progress() && unload_classes()) {
     rp.strong_roots_do(&oops);
   } else {
     rp.roots_do(&oops);
   }
 
< prev index next >