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.meta
37 * jdk.vm.ci/jdk.vm.ci.runtime
38 * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
39 * @build sun.hotspot.WhiteBox
40 * compiler.jvmci.compilerToVM.ResolveFieldInPoolTest
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.ResolveFieldInPoolTest
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.lang.reflect.Field;
56 import java.util.HashMap;
57 import java.util.Map;
58 import jdk.internal.org.objectweb.asm.Opcodes;
59 import jdk.vm.ci.hotspot.CompilerToVMHelper;
60 import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
61 import jdk.vm.ci.meta.ConstantPool;
62 import jdk.test.lib.Asserts;
63 import jdk.test.lib.Utils;
64 import jdk.internal.misc.Unsafe;
65
66 /**
67 * Test for {@code jdk.vm.ci.hotspot.CompilerToVM.resolveFieldInPool} method
68 */
69 public class ResolveFieldInPoolTest {
70
71 private static final Unsafe UNSAFE = Utils.getUnsafe();
72
73 public static void main(String[] args) throws Exception {
74 Map<ConstantTypes, Validator> typeTests = new HashMap<>();
75 typeTests.put(CONSTANT_FIELDREF, ResolveFieldInPoolTest::validate);
76 ConstantPoolTestCase testCase = new ConstantPoolTestCase(typeTests);
77 testCase.test();
78 // The next "Class.forName" and repeating "testCase.test()"
79 // are here for the following reason.
80 // The first test run is without dummy class initialization,
81 // which means no constant pool cache exists.
82 // The second run is with initialized class (with constant pool cache available).
83 // Some CompilerToVM methods require different input
84 // depending on whether CP cache exists or not.
85 for (DummyClasses dummy : DummyClasses.values()) {
|
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.meta
37 * jdk.vm.ci/jdk.vm.ci.runtime
38 * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
39 * @build sun.hotspot.WhiteBox
40 * compiler.jvmci.compilerToVM.ResolveFieldInPoolTest
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.ResolveFieldInPoolTest
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.internal.misc.Unsafe;
55 import jdk.internal.org.objectweb.asm.Opcodes;
56 import jdk.test.lib.Asserts;
57 import jdk.test.lib.Utils;
58 import jdk.vm.ci.hotspot.CompilerToVMHelper;
59 import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
60 import jdk.vm.ci.meta.ConstantPool;
61
62 import java.lang.reflect.Field;
63 import java.util.HashMap;
64 import java.util.Map;
65
66 import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_FIELDREF;
67
68 /**
69 * Test for {@code jdk.vm.ci.hotspot.CompilerToVM.resolveFieldInPool} method
70 */
71 public class ResolveFieldInPoolTest {
72
73 private static final Unsafe UNSAFE = Utils.getUnsafe();
74
75 public static void main(String[] args) throws Exception {
76 Map<ConstantTypes, Validator> typeTests = new HashMap<>();
77 typeTests.put(CONSTANT_FIELDREF, ResolveFieldInPoolTest::validate);
78 ConstantPoolTestCase testCase = new ConstantPoolTestCase(typeTests);
79 testCase.test();
80 // The next "Class.forName" and repeating "testCase.test()"
81 // are here for the following reason.
82 // The first test run is without dummy class initialization,
83 // which means no constant pool cache exists.
84 // The second run is with initialized class (with constant pool cache available).
85 // Some CompilerToVM methods require different input
86 // depending on whether CP cache exists or not.
87 for (DummyClasses dummy : DummyClasses.values()) {
|