< prev index next >

test/compiler/jvmci/compilerToVM/ConstantPoolTestsHelper.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.

@@ -21,117 +21,408 @@
  * questions.
  *
  */
 package compiler.jvmci.compilerToVM;
 
+import compiler.jvmci.common.testcases.MultipleAbstractImplementer;
 import compiler.jvmci.common.testcases.MultipleImplementer2;
 import compiler.jvmci.common.testcases.MultipleImplementersInterface;
+import compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes;
+import compiler.jvmci.compilerToVM.ConstantPoolTestCase.TestedCPEntry;
 import java.util.HashMap;
 import java.util.Map;
+import jdk.internal.misc.SharedSecrets;
+import jdk.internal.org.objectweb.asm.Opcodes;
+import sun.hotspot.WhiteBox;
+import sun.reflect.ConstantPool;
 
 /**
  * Class contains hard-coded constant pool tables for dummy classes used for
  * jdk.vm.ci.hotspot.CompilerToVM constant pool methods
  */
 public class ConstantPoolTestsHelper {
 
-    public enum ConstantTypes {
-        CONSTANT_CLASS,
-        CONSTANT_FIELDREF,
-        CONSTANT_METHODREF,
-        CONSTANT_INTERFACEMETHODREF,
-        CONSTANT_STRING,
-        CONSTANT_INTEGER,
-        CONSTANT_FLOAT,
-        CONSTANT_LONG,
-        CONSTANT_DOUBLE,
-        CONSTANT_NAMEANDTYPE,
-        CONSTANT_UTF8,
-        CONSTANT_METHODHANDLE,
-        CONSTANT_METHODTYPE,
-        CONSTANT_INVOKEDYNAMIC;
-    }
+    public static final int NO_CP_CACHE_PRESENT = Integer.MAX_VALUE;
 
     public enum DummyClasses {
         DUMMY_CLASS(MultipleImplementer2.class, CP_MAP_FOR_CLASS),
+        DUMMY_ABS_CLASS(MultipleAbstractImplementer.class, CP_MAP_FOR_ABS_CLASS),
         DUMMY_INTERFACE(MultipleImplementersInterface.class, CP_MAP_FOR_INTERFACE);
 
+        private static final WhiteBox WB = WhiteBox.getWhiteBox();
         public final Class<?> klass;
-        public final Map<Integer, ConstantPoolEntry> cp;
+        public final ConstantPool constantPoolSS;
+        public final Map<ConstantTypes, TestedCPEntry[]> testedCP;
 
-        DummyClasses(Class<?> klass, Map<Integer, ConstantPoolEntry> cp) {
+        DummyClasses(Class<?> klass, Map<ConstantTypes, TestedCPEntry[]> testedCP) {
             this.klass = klass;
-            this.cp = cp;
-        }
+            this.constantPoolSS = SharedSecrets.getJavaLangAccess().
+                    getConstantPool(klass);
+            this.testedCP = testedCP;
     }
 
-    public static class ConstantPoolEntry {
-
-        public final ConstantTypes type;
-        public final Object value;
+        public int getCPCacheIndex(int cpi) {
+            int cacheLength = WB.getConstantPoolCacheLength(this.klass);
+            int indexTag = WB.getConstantPoolCacheIndexTag();
+            for (int cpci = indexTag; cpci < cacheLength + indexTag; cpci++) {
+                if (WB.remapInstructionOperandFromCPCache(this.klass, cpci) == cpi) {
+                    if (constantPoolSS.getTagAt(cpi).equals(ConstantPool.Tag.INVOKEDYNAMIC)) {
+                        return WB.encodeConstantPoolIndyIndex(cpci) + indexTag;
+                    }
+                    return cpci;
+                }
+            }
+            return NO_CP_CACHE_PRESENT;
+        }
+    }
 
-        public ConstantPoolEntry(ConstantTypes type, Object value) {
-            this.type = type;
-            this.value = value;
+    private static final Map<ConstantTypes, TestedCPEntry[]> CP_MAP_FOR_CLASS
+            = new HashMap<>();
+    static {
+        CP_MAP_FOR_CLASS.put(ConstantTypes.CONSTANT_CLASS,
+                new TestedCPEntry[] {
+                    new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementersInterface", null, null),
+                    new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementer2", null, null),
+                    new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementer2$1", null, null),
+                    new TestedCPEntry("java/lang/invoke/MethodHandles$Lookup", null, null),
+                }
+        );
+        CP_MAP_FOR_CLASS.put(ConstantTypes.CONSTANT_FIELDREF,
+                new TestedCPEntry[] {
+                    new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementer2",
+                            "intStaticField", "I",
+                            new byte[] {(byte) Opcodes.PUTSTATIC, (byte) Opcodes.GETSTATIC},
+                            Opcodes.ACC_PRIVATE | Opcodes.ACC_STATIC),
+                    new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementer2",
+                            "longStaticField", "J",
+                            new byte[] {(byte) Opcodes.PUTSTATIC, (byte) Opcodes.GETSTATIC},
+                            Opcodes.ACC_FINAL | Opcodes.ACC_STATIC),
+                    new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementer2",
+                            "floatStaticField", "F",
+                            new byte[] {(byte) Opcodes.PUTSTATIC, (byte) Opcodes.GETSTATIC},
+                            Opcodes.ACC_VOLATILE | Opcodes.ACC_STATIC),
+                    new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementer2",
+                            "doubleStaticField", "D",
+                            new byte[] {(byte) Opcodes.PUTSTATIC, (byte) Opcodes.GETSTATIC},
+                            Opcodes.ACC_STATIC),
+                    new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementer2",
+                            "stringStaticField", "Ljava/lang/String;",
+                            new byte[] {(byte) Opcodes.PUTSTATIC, (byte) Opcodes.GETSTATIC},
+                            Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC),
+                    new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementer2",
+                            "objectStaticField", "Ljava/lang/Object;",
+                            new byte[] {(byte) Opcodes.PUTSTATIC, (byte) Opcodes.GETSTATIC},
+                            Opcodes.ACC_PROTECTED | Opcodes.ACC_STATIC),
+                    new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementer2",
+                            "intField", "I",
+                            new byte[] {(byte) Opcodes.PUTFIELD | (byte) Opcodes.GETFIELD},
+                            Opcodes.ACC_PUBLIC),
+                    new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementer2",
+                            "longField", "J",
+                            new byte[] {(byte) Opcodes.PUTFIELD | (byte) Opcodes.GETFIELD},
+                            Opcodes.ACC_PRIVATE),
+                    new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementer2",
+                            "floatField", "F",
+                            new byte[] {(byte) Opcodes.PUTFIELD | (byte) Opcodes.GETFIELD},
+                            Opcodes.ACC_PROTECTED),
+                    new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementer2",
+                            "doubleField", "D",
+                            new byte[] {(byte) Opcodes.PUTFIELD | (byte) Opcodes.GETFIELD},
+                            Opcodes.ACC_TRANSIENT),
+                    new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementer2",
+                            "objectField", "Ljava/lang/Object;",
+                            new byte[] {(byte) Opcodes.PUTFIELD | (byte) Opcodes.GETFIELD},
+                            Opcodes.ACC_FINAL),
+                    new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementer2",
+                            "stringField", "Ljava/lang/String;",
+                            new byte[] {(byte) Opcodes.PUTFIELD | (byte) Opcodes.GETFIELD},
+                            Opcodes.ACC_VOLATILE),
+                    new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementer2",
+                            "stringFieldEmpty", "Ljava/lang/String;",
+                            new byte[] {(byte) Opcodes.PUTFIELD | (byte) Opcodes.GETFIELD},
+                            0L),
+                }
+        );
+        CP_MAP_FOR_CLASS.put(ConstantTypes.CONSTANT_METHODREF,
+                new TestedCPEntry[] {
+                    new TestedCPEntry("java/lang/System",
+                            "getProperties", "()Ljava/util/Properties;",
+                            new byte[] {(byte) Opcodes.INVOKESTATIC}),
+                    new TestedCPEntry("java/util/HashMap",
+                            "<init>", "()V",
+                            new byte[] {(byte) Opcodes.INVOKESPECIAL}),
+                    new TestedCPEntry("java/lang/Object",
+                            "toString", "()Ljava/lang/String;",
+                            new byte[] {(byte) Opcodes.INVOKESPECIAL,
+                                (byte) Opcodes.INVOKEVIRTUAL}),
+                    new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementer2$1",
+                            "<init>", "(Lcompiler/jvmci/common/testcases/MultipleImplementer2;)V",
+                            new byte[0]),
+                    new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer$1",
+                            "run", "()V",
+                            new byte[0]),
+                }
+        );
+        CP_MAP_FOR_CLASS.put(ConstantTypes.CONSTANT_INTERFACEMETHODREF,
+                new TestedCPEntry[] {
+                    new TestedCPEntry("java/util/Map",
+                            "put",
+                            "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;",
+                            new byte[] {(byte) Opcodes.INVOKEINTERFACE}),
+                    new TestedCPEntry("java/util/Map",
+                            "remove",
+                            "(Ljava/lang/Object;)Ljava/lang/Object;",
+                            new byte[] {(byte) Opcodes.INVOKEINTERFACE}),
+                }
+        );
+        CP_MAP_FOR_CLASS.put(ConstantTypes.CONSTANT_STRING,
+                new TestedCPEntry[] {
+                    new TestedCPEntry(null, "Message", null),
+                    new TestedCPEntry(null, "", null),
+                }
+        );
+        CP_MAP_FOR_CLASS.put(ConstantTypes.CONSTANT_METHODHANDLE,
+                new TestedCPEntry[] {
+                    new TestedCPEntry("java/lang/invoke/LambdaMetafactory",
+                            "metafactory",
+                            "(Ljava/lang/invoke/MethodHandles$Lookup;"
+                                    + "Ljava/lang/String;"
+                                    + "Ljava/lang/invoke/MethodType;"
+                                    + "Ljava/lang/invoke/MethodType;"
+                                    + "Ljava/lang/invoke/MethodHandle;"
+                                    + "Ljava/lang/invoke/MethodType;)"
+                                    + "Ljava/lang/invoke/CallSite;", null),
+                    new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementer2",
+                            "testMethod", "()V"),
+                }
+        );
+        CP_MAP_FOR_CLASS.put(ConstantTypes.CONSTANT_METHODTYPE,
+                new TestedCPEntry[] {
+                    new TestedCPEntry(null, null, "()V"),
+                }
+        );
+        CP_MAP_FOR_CLASS.put(ConstantTypes.CONSTANT_INVOKEDYNAMIC,
+                new TestedCPEntry[] {
+                    new TestedCPEntry(null, "run",
+                            "(Lcompiler/jvmci/common/testcases/MultipleImplementer2;)"
+                                    + "Ljava/lang/Runnable;"),
         }
+        );
     }
 
-    private static final Map<Integer, ConstantPoolEntry> CP_MAP_FOR_CLASS
+    private static final Map<ConstantTypes, TestedCPEntry[]> CP_MAP_FOR_ABS_CLASS
             = new HashMap<>();
     static {
-        CP_MAP_FOR_CLASS.put(1, new ConstantPoolEntry(ConstantTypes.CONSTANT_METHODREF, new int[]{22, 68}));
-        CP_MAP_FOR_CLASS.put(2, new ConstantPoolEntry(ConstantTypes.CONSTANT_CLASS, 69));
-        CP_MAP_FOR_CLASS.put(3, new ConstantPoolEntry(ConstantTypes.CONSTANT_INTEGER, 2147483647));
-        CP_MAP_FOR_CLASS.put(4, new ConstantPoolEntry(ConstantTypes.CONSTANT_FIELDREF, new int[]{35, 70}));
-        CP_MAP_FOR_CLASS.put(5, new ConstantPoolEntry(ConstantTypes.CONSTANT_LONG, 9223372036854775807L));
-        CP_MAP_FOR_CLASS.put(8, new ConstantPoolEntry(ConstantTypes.CONSTANT_FLOAT, 3.4028235E38F));
-        CP_MAP_FOR_CLASS.put(10, new ConstantPoolEntry(ConstantTypes.CONSTANT_DOUBLE, 1.7976931348623157E308D));
-        CP_MAP_FOR_CLASS.put(13, new ConstantPoolEntry(ConstantTypes.CONSTANT_STRING, 74));
-        CP_MAP_FOR_CLASS.put(22, new ConstantPoolEntry(ConstantTypes.CONSTANT_CLASS, 83));
-        CP_MAP_FOR_CLASS.put(23, new ConstantPoolEntry(ConstantTypes.CONSTANT_METHODREF, new int[]{22, 84}));
-        CP_MAP_FOR_CLASS.put(24, new ConstantPoolEntry(ConstantTypes.CONSTANT_INTERFACEMETHODREF, new int[]{2, 85}));
-        CP_MAP_FOR_CLASS.put(26, new ConstantPoolEntry(ConstantTypes.CONSTANT_INVOKEDYNAMIC, new int[]{0, 91}));
-        CP_MAP_FOR_CLASS.put(29, new ConstantPoolEntry(ConstantTypes.CONSTANT_FIELDREF, new int[]{35, 94}));
-        CP_MAP_FOR_CLASS.put(35, new ConstantPoolEntry(ConstantTypes.CONSTANT_CLASS, 100));
-        CP_MAP_FOR_CLASS.put(68, new ConstantPoolEntry(ConstantTypes.CONSTANT_NAMEANDTYPE, new int[]{54, 55}));
-        CP_MAP_FOR_CLASS.put(70, new ConstantPoolEntry(ConstantTypes.CONSTANT_NAMEANDTYPE, new int[]{48, 37}));
-        CP_MAP_FOR_CLASS.put(84, new ConstantPoolEntry(ConstantTypes.CONSTANT_NAMEANDTYPE, new int[]{59, 55}));
-        CP_MAP_FOR_CLASS.put(85, new ConstantPoolEntry(ConstantTypes.CONSTANT_NAMEANDTYPE, new int[]{103, 63}));
-        CP_MAP_FOR_CLASS.put(91, new ConstantPoolEntry(ConstantTypes.CONSTANT_NAMEANDTYPE, new int[]{106, 107}));
-        CP_MAP_FOR_CLASS.put(94, new ConstantPoolEntry(ConstantTypes.CONSTANT_NAMEANDTYPE, new int[]{36, 37}));
-        CP_MAP_FOR_CLASS.put(104, new ConstantPoolEntry(ConstantTypes.CONSTANT_METHODREF, new int[]{110, 111}));
-        CP_MAP_FOR_CLASS.put(105, new ConstantPoolEntry(ConstantTypes.CONSTANT_METHODREF, new int[]{35, 112}));
-        CP_MAP_FOR_CLASS.put(110, new ConstantPoolEntry(ConstantTypes.CONSTANT_CLASS, 113));
-        CP_MAP_FOR_CLASS.put(111, new ConstantPoolEntry(ConstantTypes.CONSTANT_NAMEANDTYPE, new int[]{114, 118}));
-        CP_MAP_FOR_CLASS.put(112, new ConstantPoolEntry(ConstantTypes.CONSTANT_NAMEANDTYPE, new int[]{58, 55}));
+        CP_MAP_FOR_ABS_CLASS.put(ConstantTypes.CONSTANT_CLASS,
+                new TestedCPEntry[] {
+                    new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementersInterface", null, null),
+                    new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer", null, null),
+                    new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer$1", null, null),
+                    new TestedCPEntry("java/lang/invoke/MethodHandles$Lookup", null, null),
+                }
+        );
+        CP_MAP_FOR_ABS_CLASS.put(ConstantTypes.CONSTANT_FIELDREF,
+                new TestedCPEntry[] {
+                    new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer",
+                            "intStaticField", "I",
+                            new byte[] {(byte) Opcodes.PUTSTATIC, (byte) Opcodes.GETSTATIC},
+                            Opcodes.ACC_PRIVATE | Opcodes.ACC_STATIC),
+                    new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer",
+                            "longStaticField", "J",
+                            new byte[] {(byte) Opcodes.PUTSTATIC, (byte) Opcodes.GETSTATIC},
+                            Opcodes.ACC_FINAL | Opcodes.ACC_STATIC),
+                    new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer",
+                            "floatStaticField", "F",
+                            new byte[] {(byte) Opcodes.PUTSTATIC, (byte) Opcodes.GETSTATIC},
+                            Opcodes.ACC_VOLATILE | Opcodes.ACC_STATIC),
+                    new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer",
+                            "doubleStaticField", "D",
+                            new byte[] {(byte) Opcodes.PUTSTATIC, (byte) Opcodes.GETSTATIC},
+                            Opcodes.ACC_STATIC),
+                    new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer",
+                            "stringStaticField", "Ljava/lang/String;",
+                            new byte[] {(byte) Opcodes.PUTSTATIC, (byte) Opcodes.GETSTATIC},
+                            Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC),
+                    new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer",
+                            "objectStaticField", "Ljava/lang/Object;",
+                            new byte[] {(byte) Opcodes.PUTSTATIC, (byte) Opcodes.GETSTATIC},
+                            Opcodes.ACC_PROTECTED | Opcodes.ACC_STATIC),
+                    new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer",
+                            "intField", "I",
+                            new byte[] {(byte) Opcodes.PUTFIELD | (byte) Opcodes.GETFIELD},
+                            Opcodes.ACC_PUBLIC),
+                    new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer",
+                            "longField", "J",
+                            new byte[] {(byte) Opcodes.PUTFIELD | (byte) Opcodes.GETFIELD},
+                            Opcodes.ACC_PRIVATE),
+                    new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer",
+                            "floatField", "F",
+                            new byte[] {(byte) Opcodes.PUTFIELD | (byte) Opcodes.GETFIELD},
+                            Opcodes.ACC_PROTECTED),
+                    new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer",
+                            "doubleField", "D",
+                            new byte[] {(byte) Opcodes.PUTFIELD | (byte) Opcodes.GETFIELD},
+                            Opcodes.ACC_TRANSIENT),
+                    new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer",
+                            "objectField", "Ljava/lang/Object;",
+                            new byte[] {(byte) Opcodes.PUTFIELD | (byte) Opcodes.GETFIELD},
+                            Opcodes.ACC_FINAL),
+                    new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer",
+                            "stringField", "Ljava/lang/String;",
+                            new byte[] {(byte) Opcodes.PUTFIELD | (byte) Opcodes.GETFIELD},
+                            Opcodes.ACC_VOLATILE),
+                    new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer",
+                            "stringFieldEmpty", "Ljava/lang/String;",
+                            new byte[] {(byte) Opcodes.PUTFIELD | (byte) Opcodes.GETFIELD},
+                            0L),
+                }
+        );
+        CP_MAP_FOR_ABS_CLASS.put(ConstantTypes.CONSTANT_METHODREF,
+                new TestedCPEntry[] {
+                    new TestedCPEntry("java/lang/System",
+                            "getProperties", "()Ljava/util/Properties;",
+                            new byte[] {(byte) Opcodes.INVOKESTATIC}),
+                    new TestedCPEntry("java/util/HashMap",
+                            "<init>", "()V",
+                            new byte[] {(byte) Opcodes.INVOKESPECIAL}),
+                    new TestedCPEntry("java/lang/Object",
+                            "toString", "()Ljava/lang/String;",
+                            new byte[] {(byte) Opcodes.INVOKESPECIAL,
+                                (byte) Opcodes.INVOKEVIRTUAL}),
+                    new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer$1",
+                            "<init>", "(Lcompiler/jvmci/common/testcases/MultipleAbstractImplementer;)V",
+                            new byte[0]),
+                    new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer$1",
+                            "run", "()V",
+                            new byte[0]),
+                }
+        );
+        CP_MAP_FOR_ABS_CLASS.put(ConstantTypes.CONSTANT_INTERFACEMETHODREF,
+                new TestedCPEntry[] {
+                    new TestedCPEntry("java/util/Map",
+                            "put",
+                            "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;",
+                            new byte[] {(byte) Opcodes.INVOKEINTERFACE}),
+                    new TestedCPEntry("java/util/Map",
+                            "remove",
+                            "(Ljava/lang/Object;)Ljava/lang/Object;",
+                            new byte[] {(byte) Opcodes.INVOKEINTERFACE}),
+                }
+        );
+        CP_MAP_FOR_ABS_CLASS.put(ConstantTypes.CONSTANT_STRING,
+                new TestedCPEntry[] {
+                    new TestedCPEntry(null, "Message", null),
+                    new TestedCPEntry(null, "", null),
+                }
+        );
+        CP_MAP_FOR_ABS_CLASS.put(ConstantTypes.CONSTANT_METHODHANDLE,
+                new TestedCPEntry[] {
+                    new TestedCPEntry("java/lang/invoke/LambdaMetafactory",
+                            "metafactory",
+                            "(Ljava/lang/invoke/MethodHandles$Lookup;"
+                                    + "Ljava/lang/String;"
+                                    + "Ljava/lang/invoke/MethodType;"
+                                    + "Ljava/lang/invoke/MethodType;"
+                                    + "Ljava/lang/invoke/MethodHandle;"
+                                    + "Ljava/lang/invoke/MethodType;)"
+                                    + "Ljava/lang/invoke/CallSite;", null),
+                    new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer",
+                            "testMethod", "()V"),
+                }
+        );
+        CP_MAP_FOR_ABS_CLASS.put(ConstantTypes.CONSTANT_METHODTYPE,
+                new TestedCPEntry[] {
+                    new TestedCPEntry(null, null, "()V"),
+                }
+        );
+        CP_MAP_FOR_ABS_CLASS.put(ConstantTypes.CONSTANT_INVOKEDYNAMIC,
+                new TestedCPEntry[] {
+                    new TestedCPEntry(null, "run",
+                            "(Lcompiler/jvmci/common/testcases/MultipleAbstractImplementer;)"
+                                    + "Ljava/lang/Runnable;"),
+                }
+        );
     }
 
-    private static final Map<Integer, ConstantPoolEntry> CP_MAP_FOR_INTERFACE
+    private static final Map<ConstantTypes, TestedCPEntry[]> CP_MAP_FOR_INTERFACE
             = new HashMap<>();
     static {
-        CP_MAP_FOR_INTERFACE.put(1, new ConstantPoolEntry(ConstantTypes.CONSTANT_CLASS, 48));
-        CP_MAP_FOR_INTERFACE.put(5, new ConstantPoolEntry(ConstantTypes.CONSTANT_INTERFACEMETHODREF, new int[]{13, 52}));
-        CP_MAP_FOR_INTERFACE.put(6, new ConstantPoolEntry(ConstantTypes.CONSTANT_CLASS, 53));
-        CP_MAP_FOR_INTERFACE.put(7, new ConstantPoolEntry(ConstantTypes.CONSTANT_INVOKEDYNAMIC, new int[]{0, 58}));
-        CP_MAP_FOR_INTERFACE.put(8, new ConstantPoolEntry(ConstantTypes.CONSTANT_METHODREF, new int[]{6, 59}));
-        CP_MAP_FOR_INTERFACE.put(9, new ConstantPoolEntry(ConstantTypes.CONSTANT_METHODREF, new int[]{6, 60}));
-        CP_MAP_FOR_INTERFACE.put(12, new ConstantPoolEntry(ConstantTypes.CONSTANT_FIELDREF, new int[]{13, 63}));
-        CP_MAP_FOR_INTERFACE.put(13, new ConstantPoolEntry(ConstantTypes.CONSTANT_CLASS, 64));
-        CP_MAP_FOR_INTERFACE.put(17, new ConstantPoolEntry(ConstantTypes.CONSTANT_INTEGER, 2147483647));
-        CP_MAP_FOR_INTERFACE.put(20, new ConstantPoolEntry(ConstantTypes.CONSTANT_LONG, 9223372036854775807l));
-        CP_MAP_FOR_INTERFACE.put(24, new ConstantPoolEntry(ConstantTypes.CONSTANT_FLOAT, 3.4028235E38f));
-        CP_MAP_FOR_INTERFACE.put(27, new ConstantPoolEntry(ConstantTypes.CONSTANT_DOUBLE, 1.7976931348623157E308d));
-        CP_MAP_FOR_INTERFACE.put(31, new ConstantPoolEntry(ConstantTypes.CONSTANT_STRING, 65));
-        CP_MAP_FOR_INTERFACE.put(52, new ConstantPoolEntry(ConstantTypes.CONSTANT_NAMEANDTYPE, new int[]{34, 35}));
-        CP_MAP_FOR_INTERFACE.put(55, new ConstantPoolEntry(ConstantTypes.CONSTANT_METHODHANDLE, new int[]{6, 67}));
-        CP_MAP_FOR_INTERFACE.put(56, new ConstantPoolEntry(ConstantTypes.CONSTANT_METHODTYPE, 35));
-        CP_MAP_FOR_INTERFACE.put(57, new ConstantPoolEntry(ConstantTypes.CONSTANT_METHODHANDLE, new int[]{9, 5}));
-        CP_MAP_FOR_INTERFACE.put(58, new ConstantPoolEntry(ConstantTypes.CONSTANT_NAMEANDTYPE, new int[]{68, 69}));
-        CP_MAP_FOR_INTERFACE.put(59, new ConstantPoolEntry(ConstantTypes.CONSTANT_NAMEANDTYPE, new int[]{70, 71}));
-        CP_MAP_FOR_INTERFACE.put(60, new ConstantPoolEntry(ConstantTypes.CONSTANT_NAMEANDTYPE, new int[]{72, 35}));
-        CP_MAP_FOR_INTERFACE.put(63, new ConstantPoolEntry(ConstantTypes.CONSTANT_NAMEANDTYPE, new int[]{32, 33}));
-        CP_MAP_FOR_INTERFACE.put(67, new ConstantPoolEntry(ConstantTypes.CONSTANT_METHODREF, new int[]{73, 74}));
-        CP_MAP_FOR_INTERFACE.put(73, new ConstantPoolEntry(ConstantTypes.CONSTANT_CLASS, 75));
-        CP_MAP_FOR_INTERFACE.put(74, new ConstantPoolEntry(ConstantTypes.CONSTANT_NAMEANDTYPE, new int[]{76, 80}));
-        CP_MAP_FOR_INTERFACE.put(77, new ConstantPoolEntry(ConstantTypes.CONSTANT_CLASS, 82));
+        CP_MAP_FOR_INTERFACE.put(ConstantTypes.CONSTANT_CLASS,
+                new TestedCPEntry[] {
+                    new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementersInterface", null, null),
+                    new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementersInterface$1", null, null),
+                    new TestedCPEntry("java/lang/Object", null, null),
+                    new TestedCPEntry("java/lang/invoke/MethodHandles$Lookup", null, null),
+                }
+        );
+        CP_MAP_FOR_INTERFACE.put(ConstantTypes.CONSTANT_FIELDREF,
+                new TestedCPEntry[] {
+                    new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementersInterface",
+                            "OBJECT_CONSTANT", "Ljava/lang/Object;",
+                            new byte[] {(byte) Opcodes.PUTSTATIC, (byte) Opcodes.GETSTATIC},
+                            Opcodes.ACC_STATIC | Opcodes.ACC_FINAL | Opcodes.ACC_PUBLIC),
+                }
+        );
+        CP_MAP_FOR_INTERFACE.put(ConstantTypes.CONSTANT_METHODREF,
+                new TestedCPEntry[] {
+                    new TestedCPEntry("java/lang/System",
+                            "getProperties", "()Ljava/util/Properties;",
+                            new byte[] {(byte) Opcodes.INVOKESTATIC}),
+                    new TestedCPEntry("java/util/HashMap",
+                            "<init>", "()V", new byte[] {(byte) Opcodes.INVOKESPECIAL}),
+                    new TestedCPEntry("java/lang/Object",
+                            "toString", "()Ljava/lang/String;",
+                            new byte[] {(byte) Opcodes.INVOKEVIRTUAL}),
+                    new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer$1",
+                            "<init>", "(Lcompiler/jvmci/common/testcases/MultipleAbstractImplementer;)V",
+                            new byte[0]),
+                    new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer$1",
+                            "run", "()V",
+                            new byte[0]),
+                }
+        );
+        CP_MAP_FOR_INTERFACE.put(ConstantTypes.CONSTANT_INTERFACEMETHODREF,
+                new TestedCPEntry[] {
+                    new TestedCPEntry("java/util/Map",
+                            "put",
+                            "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;",
+                            new byte[] {(byte) Opcodes.INVOKEINTERFACE}),
+                    new TestedCPEntry("java/util/Map",
+                            "remove",
+                            "(Ljava/lang/Object;)Ljava/lang/Object;",
+                            new byte[] {(byte) Opcodes.INVOKEINTERFACE}),
+                }
+        );
+        CP_MAP_FOR_INTERFACE.put(ConstantTypes.CONSTANT_STRING,
+                new TestedCPEntry[] {
+                    new TestedCPEntry(null, "Hello", null),
+                    new TestedCPEntry(null, "", null),
+                }
+        );
+        CP_MAP_FOR_INTERFACE.put(ConstantTypes.CONSTANT_METHODHANDLE,
+                new TestedCPEntry[] {
+                    new TestedCPEntry("java/lang/invoke/LambdaMetafactory",
+                            "metafactory",
+                            "(Ljava/lang/invoke/MethodHandles$Lookup;"
+                                    + "Ljava/lang/String;Ljava/lang/invoke/MethodType;"
+                                    + "Ljava/lang/invoke/MethodType;"
+                                    + "Ljava/lang/invoke/MethodHandle;"
+                                    + "Ljava/lang/invoke/MethodType;)"
+                                    + "Ljava/lang/invoke/CallSite;"),
+                    new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementersInterface",
+                            "defaultMethod", "()V"),
+                }
+        );
+        CP_MAP_FOR_INTERFACE.put(ConstantTypes.CONSTANT_METHODTYPE,
+                new TestedCPEntry[] {
+                    new TestedCPEntry(null, null, "()V"),
+                }
+        );
+        CP_MAP_FOR_INTERFACE.put(ConstantTypes.CONSTANT_INVOKEDYNAMIC,
+                new TestedCPEntry[] {
+                    new TestedCPEntry(null, "run",
+                            "(Lcompiler/jvmci/common/testcases/MultipleImplementersInterface;)"
+                                    + "Ljava/lang/Runnable;"),
+                }
+        );
     }
 }
< prev index next >