169
170 Class<?> testClass = Class.forName(THIS_CLASS + "$Parent$TestCase", false, parentCL);
171 Class<?> invClass = Class.forName(THIS_CLASS + "$Parent$Invoker", false, parentCL);
172 Class<?> test = Class.forName(THIS_CLASS + "$Parent$" + testName, false, parentCL);
173 Runnable r = (Runnable) test.getDeclaredConstructor(testClass, invClass)
174 .newInstance(caller, callee);
175
176 for (int i = 0; i < 20_000; i ++) {
177 r.run();
178 }
179 }
180 }
181
182 static void run(String testCaseName, Consumer<OutputAnalyzer> processor) throws IOException {
183 ProcessBuilder pb = new ProcessBuilder();
184
185 pb.command(JDKToolFinder.getJDKTool("java"),
186 "-cp", "launcher.jar",
187 "-XX:+IgnoreUnrecognizedVMOptions", "-showversion",
188 "-XX:-TieredCompilation", "-Xbatch",
189 "-XX:+PrintCompilation", "-XX:+UnlockDiagnosticVMOptions", "-XX:+PrintInlining",
190 "-XX:CompileCommand=quiet", "-XX:CompileCommand=compileonly,*TestNull::run",
191 Launcher.class.getName(), testCaseName);
192
193 System.out.println("Command line: [" + pb.command() + "]");
194
195 OutputAnalyzer analyzer = new OutputAnalyzer(pb.start());
196
197 analyzer.shouldHaveExitValue(0);
198
199 // The test is applicable only to C2 (present in Server VM).
200 analyzer.stderrShouldContain("Server VM");
201
202 analyzer.shouldContain("TestNull::run"); // ensure that relevant method is compiled
203
204 processor.accept(analyzer); // test-specific checks
205 }
206
207 public static void main(String[] args) throws Exception {
208 run("TestUnloaded", output -> {
|
169
170 Class<?> testClass = Class.forName(THIS_CLASS + "$Parent$TestCase", false, parentCL);
171 Class<?> invClass = Class.forName(THIS_CLASS + "$Parent$Invoker", false, parentCL);
172 Class<?> test = Class.forName(THIS_CLASS + "$Parent$" + testName, false, parentCL);
173 Runnable r = (Runnable) test.getDeclaredConstructor(testClass, invClass)
174 .newInstance(caller, callee);
175
176 for (int i = 0; i < 20_000; i ++) {
177 r.run();
178 }
179 }
180 }
181
182 static void run(String testCaseName, Consumer<OutputAnalyzer> processor) throws IOException {
183 ProcessBuilder pb = new ProcessBuilder();
184
185 pb.command(JDKToolFinder.getJDKTool("java"),
186 "-cp", "launcher.jar",
187 "-XX:+IgnoreUnrecognizedVMOptions", "-showversion",
188 "-XX:-TieredCompilation", "-Xbatch",
189 "-XX:-InlineTypeReturnedAsFields", // TODO Remove this once 8284443 fixed handling of unloaded return types
190 "-XX:+PrintCompilation", "-XX:+UnlockDiagnosticVMOptions", "-XX:+PrintInlining",
191 "-XX:CompileCommand=quiet", "-XX:CompileCommand=compileonly,*TestNull::run",
192 Launcher.class.getName(), testCaseName);
193
194 System.out.println("Command line: [" + pb.command() + "]");
195
196 OutputAnalyzer analyzer = new OutputAnalyzer(pb.start());
197
198 analyzer.shouldHaveExitValue(0);
199
200 // The test is applicable only to C2 (present in Server VM).
201 analyzer.stderrShouldContain("Server VM");
202
203 analyzer.shouldContain("TestNull::run"); // ensure that relevant method is compiled
204
205 processor.accept(analyzer); // test-specific checks
206 }
207
208 public static void main(String[] args) throws Exception {
209 run("TestUnloaded", output -> {
|