# HG changeset patch # User iignatyev # Date 1573671565 28800 # Node ID 058d299b22b66fe0351b7759d61cb0fa1144979e # Parent 6530de931b8e94b5e40379c5669bf1e10a5017df 8225756: [testbug] compiler/loopstripmining/CheckLoopStripMining.java sets too short a SafepointTimeoutDelay Reviewed-by: kvn, epavlova, roland, mdoerr diff -r 6530de931b8e -r 058d299b22b6 test/hotspot/jtreg/compiler/loopstripmining/CheckLoopStripMining.java --- a/test/hotspot/jtreg/compiler/loopstripmining/CheckLoopStripMining.java Wed Nov 13 10:51:41 2019 -0800 +++ b/test/hotspot/jtreg/compiler/loopstripmining/CheckLoopStripMining.java Wed Nov 13 10:59:25 2019 -0800 @@ -27,16 +27,38 @@ * @summary C2: LoopStripMining doesn't strip as expected * @requires vm.compiler2.enabled * - * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+SafepointTimeout -XX:+SafepointALot - * -XX:+AbortVMOnSafepointTimeout -XX:SafepointTimeoutDelay=500 -XX:GuaranteedSafepointInterval=500 - * -XX:-TieredCompilation -XX:+UseCountedLoopSafepoints -XX:LoopStripMiningIter=1000 - * -XX:LoopUnrollLimit=0 -XX:CompileCommand=compileonly,CheckLoopStripMining::test_loop -Xcomp CheckLoopStripMining - * + * @library /test/lib + * @run driver compiler.loopstripmining.CheckLoopStripMining */ -public class CheckLoopStripMining { +package compiler.loopstripmining; + +import jdk.test.lib.Utils; +import jdk.test.lib.process.ProcessTools; - public static int test_loop(int x) { +public class CheckLoopStripMining { + public static void main(String args[]) throws Exception { + ProcessTools.executeTestJvm( + "-XX:+UnlockDiagnosticVMOptions", + // to prevent biased locking handshakes from changing the timing of this test + "-XX:-UseBiasedLocking", + "-XX:+SafepointTimeout", + "-XX:+SafepointALot", + "-XX:+AbortVMOnSafepointTimeout", + "-XX:SafepointTimeoutDelay=" + Utils.adjustTimeout(500), + "-XX:GuaranteedSafepointInterval=" + Utils.adjustTimeout(500), + "-XX:-TieredCompilation", + "-XX:+UseCountedLoopSafepoints", + "-XX:LoopStripMiningIter=1000", + "-XX:LoopUnrollLimit=0", + "-XX:CompileCommand=compileonly,compiler.loopstripmining.CheckLoopStripMining$Test::test_loop", + "-Xcomp", + Test.class.getName()).shouldHaveExitValue(0) + .stdoutShouldContain("sum: 715827882"); + } + + public static class Test { + public static int test_loop(int x) { int sum = 0; if (x != 0) { for (int y = 1; y < Integer.MAX_VALUE; ++y) { @@ -44,10 +66,11 @@ } } return sum; - } + } - public static void main(String args[]) { - int sum = test_loop(3); - System.out.println("sum: " + sum); + public static void main(String args[]) { + int sum = test_loop(3); + System.out.println("sum: " + sum); + } } }