8222130: Shenandoah should verify roots after pre-evacuation
authorshade
Mon, 08 Apr 2019 19:43:04 +0200
changeset 54463 b9c461c02f7c
parent 54462 2020eaa9ca9f
child 54464 1f8938ce8564
8222130: Shenandoah should verify roots after pre-evacuation Reviewed-by: rkennke, zgu
src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp
src/hotspot/share/gc/shenandoah/shenandoahVerifier.cpp
src/hotspot/share/gc/shenandoah/shenandoahVerifier.hpp
--- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp	Mon Apr 08 13:33:28 2019 -0400
+++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp	Mon Apr 08 19:43:04 2019 +0200
@@ -1547,6 +1547,10 @@
       if (ShenandoahPacing) {
         pacer()->setup_for_evac();
       }
+
+      if (ShenandoahVerify) {
+        verifier()->verify_during_evacuation();
+      }
     } else {
       if (ShenandoahVerify) {
         verifier()->verify_after_concmark();
--- a/src/hotspot/share/gc/shenandoah/shenandoahVerifier.cpp	Mon Apr 08 13:33:28 2019 -0400
+++ b/src/hotspot/share/gc/shenandoah/shenandoahVerifier.cpp	Mon Apr 08 19:43:04 2019 +0200
@@ -628,6 +628,10 @@
         enabled = true;
         expected = ShenandoahHeap::HAS_FORWARDED;
         break;
+      case _verify_gcstate_evacuation:
+        enabled = true;
+        expected = ShenandoahHeap::HAS_FORWARDED | ShenandoahHeap::EVACUATION;
+        break;
       case _verify_gcstate_stable:
         enabled = true;
         expected = ShenandoahHeap::STABLE;
@@ -808,6 +812,18 @@
   );
 }
 
+void ShenandoahVerifier::verify_during_evacuation() {
+  verify_at_safepoint(
+          "During Evacuation",
+          _verify_forwarded_allow,   // some forwarded references are allowed
+          _verify_marked_disable,    // walk only roots
+          _verify_cset_disable,      // some cset references are not forwarded yet
+          _verify_liveness_disable,  // liveness data might be already stale after pre-evacs
+          _verify_regions_disable,   // trash regions not yet recycled
+          _verify_gcstate_evacuation // evacuation is in progress
+  );
+}
+
 void ShenandoahVerifier::verify_after_evacuation() {
   verify_at_safepoint(
           "After Evacuation",
--- a/src/hotspot/share/gc/shenandoah/shenandoahVerifier.hpp	Mon Apr 08 13:33:28 2019 -0400
+++ b/src/hotspot/share/gc/shenandoah/shenandoahVerifier.hpp	Mon Apr 08 19:43:04 2019 +0200
@@ -135,6 +135,9 @@
 
     // Nothing is in progress, some objects are forwarded
     _verify_gcstate_forwarded,
+
+    // Evacuation is in progress, some objects are forwarded
+    _verify_gcstate_evacuation,
   } VerifyGCState;
 
   struct VerifyOptions {
@@ -173,6 +176,7 @@
   void verify_before_concmark();
   void verify_after_concmark();
   void verify_before_evacuation();
+  void verify_during_evacuation();
   void verify_after_evacuation();
   void verify_before_updaterefs();
   void verify_after_updaterefs();