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 * jdk.vm.ci/jdk.vm.ci.hotspot
35 * jdk.vm.ci/jdk.vm.ci.runtime
36 * jdk.vm.ci/jdk.vm.ci.meta
37 * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
38 * @build sun.hotspot.WhiteBox
39 * compiler.jvmci.compilerToVM.ResolveConstantInPoolTest
40 * @run main ClassFileInstaller sun.hotspot.WhiteBox
41 * sun.hotspot.WhiteBox$WhiteBoxPermission
42 * @run main/othervm -Xbootclasspath/a:.
43 * -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
44 * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
45 * compiler.jvmci.compilerToVM.ResolveConstantInPoolTest
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.Validator;
54 import java.lang.invoke.MethodHandle;
55 import java.lang.invoke.MethodType;
56 import java.util.HashMap;
57 import java.util.Map;
58 import jdk.test.lib.Asserts;
59 import jdk.vm.ci.hotspot.CompilerToVMHelper;
60 import jdk.vm.ci.meta.ConstantPool;
61
62 /**
63 * Test for {@code jdk.vm.ci.hotspot.CompilerToVM.resolveConstantInPool} method
64 */
65 public class ResolveConstantInPoolTest {
66
67 private static final String NOT_NULL_MSG
68 = "Object returned by resolveConstantInPool method should not be null";
69
70 public static void main(String[] args) throws Exception {
71 Map<ConstantTypes, Validator> typeTests = new HashMap<>();
72 typeTests.put(CONSTANT_METHODHANDLE, ResolveConstantInPoolTest::validateMethodHandle);
73 typeTests.put(CONSTANT_METHODTYPE, ResolveConstantInPoolTest::validateMethodType);
74 ConstantPoolTestCase testCase = new ConstantPoolTestCase(typeTests);
75 testCase.test();
76 // The next "Class.forName" and repeating "testCase.test()"
77 // are here for the following reason.
78 // The first test run is without dummy class initialization,
79 // which means no constant pool cache exists.
80 // The second run is with initialized class (with constant pool cache available).
81 // Some CompilerToVM methods require different input
|
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 * jdk.vm.ci/jdk.vm.ci.hotspot
35 * jdk.vm.ci/jdk.vm.ci.runtime
36 * jdk.vm.ci/jdk.vm.ci.meta
37 * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
38 * @build sun.hotspot.WhiteBox
39 * compiler.jvmci.compilerToVM.ResolveConstantInPoolTest
40 * @run main ClassFileInstaller sun.hotspot.WhiteBox
41 * sun.hotspot.WhiteBox$WhiteBoxPermission
42 * @run main/othervm -Xbootclasspath/a:.
43 * -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
44 * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
45 * compiler.jvmci.compilerToVM.ResolveConstantInPoolTest
46 */
47
48 package compiler.jvmci.compilerToVM;
49
50 import compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes;
51 import compiler.jvmci.compilerToVM.ConstantPoolTestCase.Validator;
52 import compiler.jvmci.compilerToVM.ConstantPoolTestsHelper.DummyClasses;
53 import jdk.test.lib.Asserts;
54 import jdk.vm.ci.hotspot.CompilerToVMHelper;
55 import jdk.vm.ci.meta.ConstantPool;
56
57 import java.lang.invoke.MethodHandle;
58 import java.lang.invoke.MethodType;
59 import java.util.HashMap;
60 import java.util.Map;
61
62 import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_METHODHANDLE;
63 import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_METHODTYPE;
64
65 /**
66 * Test for {@code jdk.vm.ci.hotspot.CompilerToVM.resolveConstantInPool} method
67 */
68 public class ResolveConstantInPoolTest {
69
70 private static final String NOT_NULL_MSG
71 = "Object returned by resolveConstantInPool method should not be null";
72
73 public static void main(String[] args) throws Exception {
74 Map<ConstantTypes, Validator> typeTests = new HashMap<>();
75 typeTests.put(CONSTANT_METHODHANDLE, ResolveConstantInPoolTest::validateMethodHandle);
76 typeTests.put(CONSTANT_METHODTYPE, ResolveConstantInPoolTest::validateMethodType);
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
|