8225450: use @file in CtwRunner
authoriignatyev
Thu, 06 Jun 2019 13:42:41 -0700
changeset 55270 759acbfb9fde
parent 55269 098fa5ddb308
child 55271 5c7c3662c386
8225450: use @file in CtwRunner Reviewed-by: kvn
test/hotspot/jtreg/testlibrary/ctw/src/sun/hotspot/tools/ctw/CtwRunner.java
--- a/test/hotspot/jtreg/testlibrary/ctw/src/sun/hotspot/tools/ctw/CtwRunner.java	Thu Jun 06 22:31:13 2019 +0200
+++ b/test/hotspot/jtreg/testlibrary/ctw/src/sun/hotspot/tools/ctw/CtwRunner.java	Thu Jun 06 13:42:41 2019 -0700
@@ -258,35 +258,40 @@
 
     private String[] cmd(long classStart, long classStop) {
         String phase = phaseName(classStart);
-        return new String[] {
-                "-Xbatch",
-                "-XX:-UseCounterDecay",
-                "-XX:-ShowMessageBoxOnError",
-                "-XX:+UnlockDiagnosticVMOptions",
-                // redirect VM output to cerr so it won't collide w/ ctw output
-                "-XX:+DisplayVMOutputToStderr",
-                // define phase start
-                "-DCompileTheWorldStartAt=" + classStart,
-                "-DCompileTheWorldStopAt=" + classStop,
-                // CTW library uses WhiteBox API
-                "-XX:+WhiteBoxAPI", "-Xbootclasspath/a:.",
-                // export jdk.internal packages used by CTW library
-                "--add-exports", "java.base/jdk.internal.jimage=ALL-UNNAMED",
-                "--add-exports", "java.base/jdk.internal.misc=ALL-UNNAMED",
-                "--add-exports", "java.base/jdk.internal.reflect=ALL-UNNAMED",
-                "--add-exports", "java.base/jdk.internal.access=ALL-UNNAMED",
-                // enable diagnostic logging
-                "-XX:+LogCompilation",
-                // use phase specific log, hs_err and ciReplay files
-                String.format("-XX:LogFile=hotspot_%s_%%p.log", phase),
-                String.format("-XX:ErrorFile=hs_err_%s_%%p.log", phase),
-                String.format("-XX:ReplayDataFile=replay_%s_%%p.log", phase),
-                // MethodHandle MUST NOT be compiled
-                "-XX:CompileCommand=exclude,java/lang/invoke/MethodHandle.*",
-                // CTW entry point
-                CompileTheWorld.class.getName(),
-                target,
-        };
+        Path file = Paths.get(phase + ".cmd");
+        try {
+            Files.write(file, List.of(
+                    "-Xbatch",
+                    "-XX:-UseCounterDecay",
+                    "-XX:-ShowMessageBoxOnError",
+                    "-XX:+UnlockDiagnosticVMOptions",
+                    // redirect VM output to cerr so it won't collide w/ ctw output
+                    "-XX:+DisplayVMOutputToStderr",
+                    // define phase start
+                    "-DCompileTheWorldStartAt=" + classStart,
+                    "-DCompileTheWorldStopAt=" + classStop,
+                    // CTW library uses WhiteBox API
+                    "-XX:+WhiteBoxAPI", "-Xbootclasspath/a:.",
+                    // export jdk.internal packages used by CTW library
+                    "--add-exports", "java.base/jdk.internal.jimage=ALL-UNNAMED",
+                    "--add-exports", "java.base/jdk.internal.misc=ALL-UNNAMED",
+                    "--add-exports", "java.base/jdk.internal.reflect=ALL-UNNAMED",
+                    "--add-exports", "java.base/jdk.internal.access=ALL-UNNAMED",
+                    // enable diagnostic logging
+                    "-XX:+LogCompilation",
+                    // use phase specific log, hs_err and ciReplay files
+                    String.format("-XX:LogFile=hotspot_%s_%%p.log", phase),
+                    String.format("-XX:ErrorFile=hs_err_%s_%%p.log", phase),
+                    String.format("-XX:ReplayDataFile=replay_%s_%%p.log", phase),
+                    // MethodHandle MUST NOT be compiled
+                    "-XX:CompileCommand=exclude,java/lang/invoke/MethodHandle.*",
+                    // CTW entry point
+                    CompileTheWorld.class.getName(),
+                    target));
+        } catch (IOException e) {
+            throw new Error("can't create " + file, e);
+        }
+        return new String[]{ "@" + file.toAbsolutePath() };
     }
 
     private String phaseName(long classStart) {