< prev index next >

test/hotspot/jtreg/compiler/c2/unloaded/TestInlineUnloaded.java

Print this page

170 
171             Class<?> testClass = Class.forName(THIS_CLASS + "$Parent$TestCase", false, parentCL);
172             Class<?> invClass  = Class.forName(THIS_CLASS + "$Parent$Invoker",  false, parentCL);
173             Class<?> test      = Class.forName(THIS_CLASS + "$Parent$" + testName, false, parentCL);
174             Runnable r = (Runnable) test.getDeclaredConstructor(testClass, invClass)
175                                        .newInstance(caller, callee);
176 
177             for (int i = 0; i < 20_000; i ++) {
178                 r.run();
179             }
180         }
181     }
182 
183     static void run(String testCaseName, Consumer<OutputAnalyzer> processor) throws Exception {
184         ProcessBuilder pb = new ProcessBuilder();
185 
186         pb.command(JDKToolFinder.getJDKTool("java"),
187             "-cp", "launcher.jar",
188             "-XX:+IgnoreUnrecognizedVMOptions", "-showversion",
189             "-XX:-TieredCompilation", "-Xbatch",

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 = ProcessTools.executeProcess(pb);
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 -> {

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