19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 /*
26 * @test
27 * @bug 8226956
28 * @summary Run invocation tests against C1 compiler
29 * @library /test/lib
30 * @modules java.base/jdk.internal.org.objectweb.asm
31 * java.base/jdk.internal.misc
32 * @compile shared/AbstractGenerator.java shared/AccessCheck.java shared/AccessType.java
33 * shared/Caller.java shared/ExecutorGenerator.java shared/Utils.java
34 * shared/ByteArrayClassLoader.java shared/Checker.java shared/GenericClassGenerator.java
35 * @compile invokespecial/Checker.java invokespecial/ClassGenerator.java invokespecial/Generator.java
36 * invokevirtual/Checker.java invokevirtual/ClassGenerator.java invokevirtual/Generator.java
37 * invokeinterface/Checker.java invokeinterface/ClassGenerator.java invokeinterface/Generator.java
38 *
39 * @run main/othervm/timeout=1800 invocationC1Tests
40 */
41
42 import jdk.test.lib.process.ProcessTools;
43 import jdk.test.lib.process.OutputAnalyzer;
44 import jdk.test.lib.compiler.InMemoryJavaCompiler;
45
46 public class invocationC1Tests {
47
48 public static void runTest(String whichTests, String classFileVersion) throws Exception {
49 System.out.println("\nC1 invocation tests, Tests: " + whichTests +
50 ", class file version: " + classFileVersion);
51 ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(false, "-Xmx128M",
52 "-Xcomp", "-XX:TieredStopAtLevel=1",
53 "--add-exports", "java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED",
54 whichTests, "--classfile_version=" + classFileVersion);
55 OutputAnalyzer output = new OutputAnalyzer(pb.start());
56 try {
57 output.shouldContain("EXECUTION STATUS: PASSED");
58 output.shouldHaveExitValue(0);
59 } catch (Throwable e) {
60 System.out.println(
61 "\nNote that an entry such as 'B.m/C.m' in the failure chart means that" +
62 " the test case failed because method B.m was invoked but the test " +
63 "expected method C.m to be invoked. Similarly, a result such as 'AME/C.m'" +
64 " means that an AbstractMethodError exception was thrown but the test" +
65 " case expected method C.m to be invoked.");
66 System.out.println(
67 "\nAlso note that passing --dump to invoke*.Generator will" +
68 " dump the generated classes (for debugging purposes).\n");
69 System.exit(1);
70 }
71 }
72
73 public static void main(String args[]) throws Throwable {
74 // Get current major class file version and test with it.
75 byte klassbuf[] = InMemoryJavaCompiler.compile("blah", "public class blah { }");
76 int major_version = klassbuf[6] << 8 | klassbuf[7];
77 runTest("invokespecial.Generator", String.valueOf(major_version));
78 runTest("invokeinterface.Generator", String.valueOf(major_version));
79
80 // Uncomment this test once JDK-8226588 is fixed
81 // runTest("invokevirtual.Generator", String.valueOf(major_version));
82 }
83 }
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 /*
26 * @test
27 * @bug 8226956
28 * @summary Run invocation tests against C1 compiler
29 * @library /test/lib
30 * @modules java.base/jdk.internal.org.objectweb.asm
31 * java.base/jdk.internal.misc
32 * @compile shared/AbstractGenerator.java shared/AccessCheck.java shared/AccessType.java
33 * shared/Caller.java shared/ExecutorGenerator.java shared/Utils.java
34 * shared/ByteArrayClassLoader.java shared/Checker.java shared/GenericClassGenerator.java
35 * @compile invokespecial/Checker.java invokespecial/ClassGenerator.java invokespecial/Generator.java
36 * invokevirtual/Checker.java invokevirtual/ClassGenerator.java invokevirtual/Generator.java
37 * invokeinterface/Checker.java invokeinterface/ClassGenerator.java invokeinterface/Generator.java
38 *
39 * @run driver/timeout=1800 invocationC1Tests
40 */
41
42 import jdk.test.lib.process.ProcessTools;
43 import jdk.test.lib.process.OutputAnalyzer;
44 import jdk.test.lib.compiler.InMemoryJavaCompiler;
45
46 public class invocationC1Tests {
47
48 public static void runTest(String whichTests, String classFileVersion) throws Throwable {
49 System.out.println("\nC1 invocation tests, Tests: " + whichTests +
50 ", class file version: " + classFileVersion);
51 ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(false, "-Xmx128M",
52 "-Xcomp", "-XX:TieredStopAtLevel=1",
53 "--add-exports", "java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED",
54 whichTests, "--classfile_version=" + classFileVersion);
55 OutputAnalyzer output = new OutputAnalyzer(pb.start());
56 try {
57 output.shouldContain("EXECUTION STATUS: PASSED");
58 output.shouldHaveExitValue(0);
59 } catch (Throwable e) {
60 System.out.println(
61 "\nNote that an entry such as 'B.m/C.m' in the failure chart means that" +
62 " the test case failed because method B.m was invoked but the test " +
63 "expected method C.m to be invoked. Similarly, a result such as 'AME/C.m'" +
64 " means that an AbstractMethodError exception was thrown but the test" +
65 " case expected method C.m to be invoked.");
66 System.out.println(
67 "\nAlso note that passing --dump to invoke*.Generator will" +
68 " dump the generated classes (for debugging purposes).\n");
69
70 throw e;
71 }
72 }
73
74 public static void main(String args[]) throws Throwable {
75 // Get current major class file version and test with it.
76 byte klassbuf[] = InMemoryJavaCompiler.compile("blah", "public class blah { }");
77 int major_version = klassbuf[6] << 8 | klassbuf[7];
78 runTest("invokespecial.Generator", String.valueOf(major_version));
79 runTest("invokeinterface.Generator", String.valueOf(major_version));
80
81 // Uncomment this test once JDK-8226588 is fixed
82 // runTest("invokevirtual.Generator", String.valueOf(major_version));
83 }
84 }
|