< prev index next >

test/compiler/jvmci/compilerToVM/LookupKlassRefIndexInPoolTest.java

Print this page
rev 11557 : 8132919: use package in compiler tests
Reviewed-by: duke


  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.LookupKlassRefIndexInPoolTest
  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.LookupKlassRefIndexInPoolTest
  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.lookupKlassRefIndexInPool} method
  63  */
  64 public class LookupKlassRefIndexInPoolTest {
  65 
  66     public static void main(String[] args) throws Exception {
  67         Map<ConstantTypes, Validator> typeTests = new HashMap<>();
  68         typeTests.put(CONSTANT_METHODREF, LookupKlassRefIndexInPoolTest::validate);
  69         typeTests.put(CONSTANT_INTERFACEMETHODREF, LookupKlassRefIndexInPoolTest::validate);
  70         typeTests.put(CONSTANT_FIELDREF, LookupKlassRefIndexInPoolTest::validate);
  71         ConstantPoolTestCase testCase = new ConstantPoolTestCase(typeTests);
  72         testCase.test();
  73         // The next "Class.forName" and repeating "testCase.test()"
  74         // are here for the following reason.
  75         // The first test run is without dummy class initialization,
  76         // which means no constant pool cache exists.
  77         // The second run is with initialized class (with constant pool cache available).
  78         // Some CompilerToVM methods require different input
  79         // depending on whether CP cache exists or not.
  80         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.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.LookupKlassRefIndexInPoolTest
  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.LookupKlassRefIndexInPoolTest
  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_METHODREF;
  64 
  65 /**
  66  * Test for {@code jdk.vm.ci.hotspot.CompilerToVM.lookupKlassRefIndexInPool} method
  67  */
  68 public class LookupKlassRefIndexInPoolTest {
  69 
  70     public static void main(String[] args) throws Exception {
  71         Map<ConstantTypes, Validator> typeTests = new HashMap<>();
  72         typeTests.put(CONSTANT_METHODREF, LookupKlassRefIndexInPoolTest::validate);
  73         typeTests.put(CONSTANT_INTERFACEMETHODREF, LookupKlassRefIndexInPoolTest::validate);
  74         typeTests.put(CONSTANT_FIELDREF, LookupKlassRefIndexInPoolTest::validate);
  75         ConstantPoolTestCase testCase = new ConstantPoolTestCase(typeTests);
  76         testCase.test();
  77         // The next "Class.forName" and repeating "testCase.test()"
  78         // are here for the following reason.
  79         // The first test run is without dummy class initialization,
  80         // which means no constant pool cache exists.
  81         // The second run is with initialized class (with constant pool cache available).
  82         // Some CompilerToVM methods require different input
  83         // depending on whether CP cache exists or not.
  84         for (DummyClasses dummy : DummyClasses.values()) {


< prev index next >