Skip to content

Commit 2623b0b

Browse files
committed
8268475: execute runtime/InvocationTests w/ -UseVtableBasedCHA
Reviewed-by: mseledtsov, kvn
1 parent f839308 commit 2623b0b

File tree

1 file changed

+81
-0
lines changed

1 file changed

+81
-0
lines changed
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
/*
2+
* Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation.
8+
*
9+
* This code is distributed in the hope that it will be useful, but WITHOUT
10+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12+
* version 2 for more details (a copy is included in the LICENSE file that
13+
* accompanied this code).
14+
*
15+
* You should have received a copy of the GNU General Public License version
16+
* 2 along with this work; if not, write to the Free Software Foundation,
17+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18+
*
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+
* @summary Run invocation tests with old CHA (-XX:-UseVtableBasedCHA)
28+
* @library /test/lib
29+
* @modules java.base/jdk.internal.org.objectweb.asm
30+
* java.base/jdk.internal.misc
31+
* @compile shared/AbstractGenerator.java shared/AccessCheck.java shared/AccessType.java
32+
* shared/Caller.java shared/ExecutorGenerator.java shared/Utils.java
33+
* shared/ByteArrayClassLoader.java shared/Checker.java shared/GenericClassGenerator.java
34+
* @compile invokespecial/Checker.java invokespecial/ClassGenerator.java invokespecial/Generator.java
35+
* invokevirtual/Checker.java invokevirtual/ClassGenerator.java invokevirtual/Generator.java
36+
* invokeinterface/Checker.java invokeinterface/ClassGenerator.java invokeinterface/Generator.java
37+
*
38+
* @run driver/timeout=1800 invocationOldCHATests
39+
*/
40+
41+
import jdk.test.lib.process.ProcessTools;
42+
import jdk.test.lib.process.OutputAnalyzer;
43+
import jdk.test.lib.compiler.InMemoryJavaCompiler;
44+
45+
public class invocationOldCHATests {
46+
47+
public static void runTest(String whichTests, String classFileVersion) throws Throwable {
48+
System.out.println("\nOld CHA invocation tests, Tests: " + whichTests +
49+
", class file version: " + classFileVersion);
50+
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xmx128M",
51+
"-Xcomp", "-XX:+UnlockDiagnosticVMOptions", "-XX:-UseVtableBasedCHA",
52+
"--add-exports", "java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED",
53+
whichTests, "--classfile_version=" + classFileVersion);
54+
OutputAnalyzer output = new OutputAnalyzer(pb.start());
55+
try {
56+
output.shouldContain("EXECUTION STATUS: PASSED");
57+
output.shouldHaveExitValue(0);
58+
} catch (Throwable e) {
59+
System.out.println(
60+
"\nNote that an entry such as 'B.m/C.m' in the failure chart means that" +
61+
" the test case failed because method B.m was invoked but the test " +
62+
"expected method C.m to be invoked. Similarly, a result such as 'AME/C.m'" +
63+
" means that an AbstractMethodError exception was thrown but the test" +
64+
" case expected method C.m to be invoked.");
65+
System.out.println(
66+
"\nAlso note that passing --dump to invoke*.Generator will" +
67+
" dump the generated classes (for debugging purposes).\n");
68+
69+
throw e;
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+
runTest("invokevirtual.Generator", String.valueOf(major_version));
80+
}
81+
}

0 commit comments

Comments
 (0)