8234232: [TESTBUG] gc/shenandoah/jvmti/TestHeapDump.java fails with -Xcomp
authorjiefu
Fri, 15 Nov 2019 20:39:26 +0800
changeset 59110 8c4c358272a9
parent 59109 52752425712c
child 59112 fe87a92570db
8234232: [TESTBUG] gc/shenandoah/jvmti/TestHeapDump.java fails with -Xcomp Reviewed-by: zgu
test/hotspot/jtreg/gc/shenandoah/jvmti/TestHeapDump.java
--- a/test/hotspot/jtreg/gc/shenandoah/jvmti/TestHeapDump.java	Fri Nov 15 19:38:31 2019 +0800
+++ b/test/hotspot/jtreg/gc/shenandoah/jvmti/TestHeapDump.java	Fri Nov 15 20:39:26 2019 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2018, Red Hat, Inc. All rights reserved.
+ * Copyright (c) 2017, 2019, Red Hat, Inc. All rights reserved.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
@@ -40,6 +40,8 @@
  * @run main/othervm/native/timeout=300 -agentlib:TestHeapDump -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -Xmx128m -XX:ShenandoahGCHeuristics=aggressive -XX:-UseCompressedOops TestHeapDump
  */
 
+import java.lang.ref.Reference;
+
 public class TestHeapDump {
 
     private static final int NUM_ITER = 10000;
@@ -86,6 +88,8 @@
                 throw new RuntimeException("Expected " + EXPECTED_OBJECTS + " objects, but got " + numObjs);
             }
         }
+        Reference.reachabilityFence(array);
+        Reference.reachabilityFence(localRoot);
     }
 
     // We look for the instances of this class during the heap scan