changeset 56316:de9d23469c68

8231198: Shenandoah: heap walking should visit all roots most of the time Reviewed-by: zgu, rkennke
author shade
date Thu, 19 Sep 2019 20:26:52 +0200
parents 13e041be4e5c
children 89033e6641ed
files src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp	Thu Sep 19 20:26:51 2019 +0200
+++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp	Thu Sep 19 20:26:52 2019 +0200
@@ -1296,7 +1296,10 @@
   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);