< prev index next >

test/hotspot/jtreg/runtime/cds/appcds/aotProfile/AOTProfileFlags.java

Print this page

 57                                "-XX:" + (j == 0 ? "-" : "+") + "AOTReplayTraining")
 58                     .classpath("app.jar")
 59                     .appCommandLine("JavacBenchApp", "10")
 60                     .runAOTWorkflow();
 61             }
 62         }
 63     }
 64     static void trainAndRun(String testName, String trainingFlags, String productionFlags, String errorPattern) throws Exception {
 65         printTestCase("Flags mismatch " + testName);
 66 
 67         String appJar = ClassFileInstaller.getJarPath("hello.jar");
 68         String aotConfigFile = "hello.aotconfig";
 69         String aotCacheFile = "hello.aot";
 70         String helloClass = "Hello";
 71 
 72         ProcessBuilder pb;
 73         OutputAnalyzer out;
 74 
 75         // first make sure we have a valid aotConfigFile with default value of TypeProfileLevel
 76         pb = ProcessTools.createLimitedTestJavaProcessBuilder(

 77             "-XX:AOTMode=record",
 78             "-XX:AOTConfiguration=" + aotConfigFile,
 79             "-XX:+UnlockExperimentalVMOptions",
 80             trainingFlags,
 81             "-cp", appJar, helloClass);
 82 
 83         out = CDSTestUtils.executeAndLog(pb, "train");
 84         out.shouldHaveExitValue(0);
 85 
 86         pb = ProcessTools.createLimitedTestJavaProcessBuilder(

 87             "-XX:AOTMode=create",
 88             "-XX:AOTConfiguration=" + aotConfigFile,
 89             "-XX:AOTCache=" + aotCacheFile,
 90             "-XX:+UnlockExperimentalVMOptions",
 91             trainingFlags,
 92             "-cp", appJar);
 93 
 94         out = CDSTestUtils.executeAndLog(pb, "assemble");
 95         out.shouldHaveExitValue(0);
 96 
 97         pb = ProcessTools.createLimitedTestJavaProcessBuilder(

 98             "-XX:AOTCache=" + aotCacheFile,
 99             "-XX:+UnlockExperimentalVMOptions",
100             trainingFlags,
101             "-cp", appJar, helloClass);
102 
103         out = CDSTestUtils.executeAndLog(pb, "production_success");
104         out.shouldNotMatch(errorPattern);
105         out.shouldHaveExitValue(0);
106 
107         pb = ProcessTools.createLimitedTestJavaProcessBuilder(

108             "-XX:AOTCache=" + aotCacheFile,
109             "-XX:+UnlockExperimentalVMOptions",
110             productionFlags,
111             "-cp", appJar, helloClass);
112 
113         out = CDSTestUtils.executeAndLog(pb, "production_failure");
114         out.shouldMatch(errorPattern);
115         out.shouldHaveExitValue(0);
116     }
117 
118     public static void testFlagsMismatch() throws Exception {
119         String errorPattern = ".*Profile.* setting .* does not equal the current .*Profile.* setting.*";
120         trainAndRun("TypeProfileLevel", "-XX:TypeProfileLevel=222", "-XX:TypeProfileLevel=111", errorPattern);
121         trainAndRun("TypeProfileArgsLimit", "-XX:TypeProfileArgsLimit=2", "-XX:TypeProfileArgsLimit=3", errorPattern);
122         trainAndRun("TypeProfileParamsLimit", "-XX:TypeProfileParmsLimit=2", "-XX:TypeProfileParmsLimit=3", errorPattern);
123         trainAndRun("TypeProfileWidth", "-XX:TypeProfileWidth=2", "-XX:TypeProfileWidth=3", errorPattern);
124         if (Platform.isDebugBuild()) {
125           trainAndRun("ProfileTraps", "-XX:+ProfileTraps", "-XX:-ProfileTraps", errorPattern);
126           trainAndRun("TypeProfileCasts", "-XX:+TypeProfileCasts", "-XX:-TypeProfileCasts", errorPattern);
127         }

 57                                "-XX:" + (j == 0 ? "-" : "+") + "AOTReplayTraining")
 58                     .classpath("app.jar")
 59                     .appCommandLine("JavacBenchApp", "10")
 60                     .runAOTWorkflow();
 61             }
 62         }
 63     }
 64     static void trainAndRun(String testName, String trainingFlags, String productionFlags, String errorPattern) throws Exception {
 65         printTestCase("Flags mismatch " + testName);
 66 
 67         String appJar = ClassFileInstaller.getJarPath("hello.jar");
 68         String aotConfigFile = "hello.aotconfig";
 69         String aotCacheFile = "hello.aot";
 70         String helloClass = "Hello";
 71 
 72         ProcessBuilder pb;
 73         OutputAnalyzer out;
 74 
 75         // first make sure we have a valid aotConfigFile with default value of TypeProfileLevel
 76         pb = ProcessTools.createLimitedTestJavaProcessBuilder(
 77             "-Xlog:aot",
 78             "-XX:AOTMode=record",
 79             "-XX:AOTConfiguration=" + aotConfigFile,
 80             "-XX:+UnlockExperimentalVMOptions",
 81             trainingFlags,
 82             "-cp", appJar, helloClass);
 83 
 84         out = CDSTestUtils.executeAndLog(pb, "train");
 85         out.shouldHaveExitValue(0);
 86 
 87         pb = ProcessTools.createLimitedTestJavaProcessBuilder(
 88             "-Xlog:aot",
 89             "-XX:AOTMode=create",
 90             "-XX:AOTConfiguration=" + aotConfigFile,
 91             "-XX:AOTCache=" + aotCacheFile,
 92             "-XX:+UnlockExperimentalVMOptions",
 93             trainingFlags,
 94             "-cp", appJar);
 95 
 96         out = CDSTestUtils.executeAndLog(pb, "assemble");
 97         out.shouldHaveExitValue(0);
 98 
 99         pb = ProcessTools.createLimitedTestJavaProcessBuilder(
100             "-Xlog:aot",
101             "-XX:AOTCache=" + aotCacheFile,
102             "-XX:+UnlockExperimentalVMOptions",
103             trainingFlags,
104             "-cp", appJar, helloClass);
105 
106         out = CDSTestUtils.executeAndLog(pb, "production_success");
107         out.shouldNotMatch(errorPattern);
108         out.shouldHaveExitValue(0);
109 
110         pb = ProcessTools.createLimitedTestJavaProcessBuilder(
111             "-Xlog:aot",
112             "-XX:AOTCache=" + aotCacheFile,
113             "-XX:+UnlockExperimentalVMOptions",
114             productionFlags,
115             "-cp", appJar, helloClass);
116 
117         out = CDSTestUtils.executeAndLog(pb, "production_failure");
118         out.shouldMatch(errorPattern);
119         out.shouldHaveExitValue(0);
120     }
121 
122     public static void testFlagsMismatch() throws Exception {
123         String errorPattern = ".*Profile.* setting .* does not equal the current .*Profile.* setting.*";
124         trainAndRun("TypeProfileLevel", "-XX:TypeProfileLevel=222", "-XX:TypeProfileLevel=111", errorPattern);
125         trainAndRun("TypeProfileArgsLimit", "-XX:TypeProfileArgsLimit=2", "-XX:TypeProfileArgsLimit=3", errorPattern);
126         trainAndRun("TypeProfileParamsLimit", "-XX:TypeProfileParmsLimit=2", "-XX:TypeProfileParmsLimit=3", errorPattern);
127         trainAndRun("TypeProfileWidth", "-XX:TypeProfileWidth=2", "-XX:TypeProfileWidth=3", errorPattern);
128         if (Platform.isDebugBuild()) {
129           trainAndRun("ProfileTraps", "-XX:+ProfileTraps", "-XX:-ProfileTraps", errorPattern);
130           trainAndRun("TypeProfileCasts", "-XX:+TypeProfileCasts", "-XX:-TypeProfileCasts", errorPattern);
131         }
< prev index next >