30 * @library ../common/patches
31 * @modules java.base/jdk.internal.misc
32 * java.base/jdk.internal.reflect
33 * java.base/jdk.internal.org.objectweb.asm
34 * java.base/jdk.internal.org.objectweb.asm.tree
35 * jdk.vm.ci/jdk.vm.ci.hotspot
36 * jdk.vm.ci/jdk.vm.ci.runtime
37 * jdk.vm.ci/jdk.vm.ci.meta
38 * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
39 * @build sun.hotspot.WhiteBox
40 * compiler.jvmci.compilerToVM.LookupSignatureInPoolTest
41 * @run main ClassFileInstaller sun.hotspot.WhiteBox
42 * sun.hotspot.WhiteBox$WhiteBoxPermission
43 * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
44 * -XX:+WhiteBoxAPI -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
45 * compiler.jvmci.compilerToVM.LookupSignatureInPoolTest
46 */
47
48 package compiler.jvmci.compilerToVM;
49
50 import compiler.jvmci.compilerToVM.ConstantPoolTestsHelper.DummyClasses;
51 import compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes;
52 import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.*;
53 import compiler.jvmci.compilerToVM.ConstantPoolTestCase.TestedCPEntry;
54 import compiler.jvmci.compilerToVM.ConstantPoolTestCase.Validator;
55 import java.util.HashMap;
56 import java.util.Map;
57 import jdk.test.lib.Asserts;
58 import jdk.vm.ci.hotspot.CompilerToVMHelper;
59 import jdk.vm.ci.meta.ConstantPool;
60
61 /**
62 * Test for {@code jdk.vm.ci.hotspot.CompilerToVM.lookupSignatureInPool} method
63 */
64 public class LookupSignatureInPoolTest {
65
66 public static void main(String[] args) throws Exception {
67 Map<ConstantTypes, Validator> typeTests = new HashMap<>();
68 typeTests.put(CONSTANT_METHODREF, LookupSignatureInPoolTest::validate);
69 typeTests.put(CONSTANT_INTERFACEMETHODREF, LookupSignatureInPoolTest::validate);
70 typeTests.put(CONSTANT_FIELDREF, LookupSignatureInPoolTest::validate);
71 typeTests.put(CONSTANT_INVOKEDYNAMIC, LookupSignatureInPoolTest::validate);
72 ConstantPoolTestCase testCase = new ConstantPoolTestCase(typeTests);
73 testCase.test();
74 // The next "Class.forName" and repeating "testCase.test()"
75 // are here for the following reason.
76 // The first test run is without dummy class initialization,
77 // which means no constant pool cache exists.
78 // The second run is with initialized class (with constant pool cache available).
79 // Some CompilerToVM methods require different input
80 // depending on whether CP cache exists or not.
|
30 * @library ../common/patches
31 * @modules java.base/jdk.internal.misc
32 * java.base/jdk.internal.reflect
33 * java.base/jdk.internal.org.objectweb.asm
34 * java.base/jdk.internal.org.objectweb.asm.tree
35 * jdk.vm.ci/jdk.vm.ci.hotspot
36 * jdk.vm.ci/jdk.vm.ci.runtime
37 * jdk.vm.ci/jdk.vm.ci.meta
38 * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
39 * @build sun.hotspot.WhiteBox
40 * compiler.jvmci.compilerToVM.LookupSignatureInPoolTest
41 * @run main ClassFileInstaller sun.hotspot.WhiteBox
42 * sun.hotspot.WhiteBox$WhiteBoxPermission
43 * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
44 * -XX:+WhiteBoxAPI -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
45 * compiler.jvmci.compilerToVM.LookupSignatureInPoolTest
46 */
47
48 package compiler.jvmci.compilerToVM;
49
50 import compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes;
51 import compiler.jvmci.compilerToVM.ConstantPoolTestCase.TestedCPEntry;
52 import compiler.jvmci.compilerToVM.ConstantPoolTestCase.Validator;
53 import compiler.jvmci.compilerToVM.ConstantPoolTestsHelper.DummyClasses;
54 import jdk.test.lib.Asserts;
55 import jdk.vm.ci.hotspot.CompilerToVMHelper;
56 import jdk.vm.ci.meta.ConstantPool;
57
58 import java.util.HashMap;
59 import java.util.Map;
60
61 import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_FIELDREF;
62 import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_INTERFACEMETHODREF;
63 import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_INVOKEDYNAMIC;
64 import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_METHODREF;
65
66 /**
67 * Test for {@code jdk.vm.ci.hotspot.CompilerToVM.lookupSignatureInPool} method
68 */
69 public class LookupSignatureInPoolTest {
70
71 public static void main(String[] args) throws Exception {
72 Map<ConstantTypes, Validator> typeTests = new HashMap<>();
73 typeTests.put(CONSTANT_METHODREF, LookupSignatureInPoolTest::validate);
74 typeTests.put(CONSTANT_INTERFACEMETHODREF, LookupSignatureInPoolTest::validate);
75 typeTests.put(CONSTANT_FIELDREF, LookupSignatureInPoolTest::validate);
76 typeTests.put(CONSTANT_INVOKEDYNAMIC, LookupSignatureInPoolTest::validate);
77 ConstantPoolTestCase testCase = new ConstantPoolTestCase(typeTests);
78 testCase.test();
79 // The next "Class.forName" and repeating "testCase.test()"
80 // are here for the following reason.
81 // The first test run is without dummy class initialization,
82 // which means no constant pool cache exists.
83 // The second run is with initialized class (with constant pool cache available).
84 // Some CompilerToVM methods require different input
85 // depending on whether CP cache exists or not.
|