< prev index next >

test/compiler/jvmci/compilerToVM/ConstantPoolTestsHelper.java

Print this page


   1 /*
   2  * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 package compiler.jvmci.compilerToVM;
  25 

  26 import compiler.jvmci.common.testcases.MultipleImplementer2;
  27 import compiler.jvmci.common.testcases.MultipleImplementersInterface;


  28 import java.util.HashMap;
  29 import java.util.Map;




  30 
  31 /**
  32  * Class contains hard-coded constant pool tables for dummy classes used for
  33  * jdk.vm.ci.hotspot.CompilerToVM constant pool methods
  34  */
  35 public class ConstantPoolTestsHelper {
  36 
  37     public enum ConstantTypes {
  38         CONSTANT_CLASS,
  39         CONSTANT_FIELDREF,
  40         CONSTANT_METHODREF,
  41         CONSTANT_INTERFACEMETHODREF,
  42         CONSTANT_STRING,
  43         CONSTANT_INTEGER,
  44         CONSTANT_FLOAT,
  45         CONSTANT_LONG,
  46         CONSTANT_DOUBLE,
  47         CONSTANT_NAMEANDTYPE,
  48         CONSTANT_UTF8,
  49         CONSTANT_METHODHANDLE,
  50         CONSTANT_METHODTYPE,
  51         CONSTANT_INVOKEDYNAMIC;
  52     }
  53 
  54     public enum DummyClasses {
  55         DUMMY_CLASS(MultipleImplementer2.class, CP_MAP_FOR_CLASS),

  56         DUMMY_INTERFACE(MultipleImplementersInterface.class, CP_MAP_FOR_INTERFACE);
  57 

  58         public final Class<?> klass;
  59         public final Map<Integer, ConstantPoolEntry> cp;

  60 
  61         DummyClasses(Class<?> klass, Map<Integer, ConstantPoolEntry> cp) {
  62             this.klass = klass;
  63             this.cp = cp;
  64         }

  65     }
  66 
  67     public static class ConstantPoolEntry {
  68 
  69         public final ConstantTypes type;
  70         public final Object value;










  71 
  72         public ConstantPoolEntry(ConstantTypes type, Object value) {
  73             this.type = type;
  74             this.value = value;































































































































  75         }

  76     }
  77 
  78     private static final Map<Integer, ConstantPoolEntry> CP_MAP_FOR_CLASS
  79             = new HashMap<>();
  80     static {
  81         CP_MAP_FOR_CLASS.put(1, new ConstantPoolEntry(ConstantTypes.CONSTANT_METHODREF, new int[]{22, 68}));
  82         CP_MAP_FOR_CLASS.put(2, new ConstantPoolEntry(ConstantTypes.CONSTANT_CLASS, 69));
  83         CP_MAP_FOR_CLASS.put(3, new ConstantPoolEntry(ConstantTypes.CONSTANT_INTEGER, 2147483647));
  84         CP_MAP_FOR_CLASS.put(4, new ConstantPoolEntry(ConstantTypes.CONSTANT_FIELDREF, new int[]{35, 70}));
  85         CP_MAP_FOR_CLASS.put(5, new ConstantPoolEntry(ConstantTypes.CONSTANT_LONG, 9223372036854775807L));
  86         CP_MAP_FOR_CLASS.put(8, new ConstantPoolEntry(ConstantTypes.CONSTANT_FLOAT, 3.4028235E38F));
  87         CP_MAP_FOR_CLASS.put(10, new ConstantPoolEntry(ConstantTypes.CONSTANT_DOUBLE, 1.7976931348623157E308D));
  88         CP_MAP_FOR_CLASS.put(13, new ConstantPoolEntry(ConstantTypes.CONSTANT_STRING, 74));
  89         CP_MAP_FOR_CLASS.put(22, new ConstantPoolEntry(ConstantTypes.CONSTANT_CLASS, 83));
  90         CP_MAP_FOR_CLASS.put(23, new ConstantPoolEntry(ConstantTypes.CONSTANT_METHODREF, new int[]{22, 84}));
  91         CP_MAP_FOR_CLASS.put(24, new ConstantPoolEntry(ConstantTypes.CONSTANT_INTERFACEMETHODREF, new int[]{2, 85}));
  92         CP_MAP_FOR_CLASS.put(26, new ConstantPoolEntry(ConstantTypes.CONSTANT_INVOKEDYNAMIC, new int[]{0, 91}));
  93         CP_MAP_FOR_CLASS.put(29, new ConstantPoolEntry(ConstantTypes.CONSTANT_FIELDREF, new int[]{35, 94}));
  94         CP_MAP_FOR_CLASS.put(35, new ConstantPoolEntry(ConstantTypes.CONSTANT_CLASS, 100));
  95         CP_MAP_FOR_CLASS.put(68, new ConstantPoolEntry(ConstantTypes.CONSTANT_NAMEANDTYPE, new int[]{54, 55}));
  96         CP_MAP_FOR_CLASS.put(70, new ConstantPoolEntry(ConstantTypes.CONSTANT_NAMEANDTYPE, new int[]{48, 37}));
  97         CP_MAP_FOR_CLASS.put(84, new ConstantPoolEntry(ConstantTypes.CONSTANT_NAMEANDTYPE, new int[]{59, 55}));
  98         CP_MAP_FOR_CLASS.put(85, new ConstantPoolEntry(ConstantTypes.CONSTANT_NAMEANDTYPE, new int[]{103, 63}));
  99         CP_MAP_FOR_CLASS.put(91, new ConstantPoolEntry(ConstantTypes.CONSTANT_NAMEANDTYPE, new int[]{106, 107}));
 100         CP_MAP_FOR_CLASS.put(94, new ConstantPoolEntry(ConstantTypes.CONSTANT_NAMEANDTYPE, new int[]{36, 37}));
 101         CP_MAP_FOR_CLASS.put(104, new ConstantPoolEntry(ConstantTypes.CONSTANT_METHODREF, new int[]{110, 111}));
 102         CP_MAP_FOR_CLASS.put(105, new ConstantPoolEntry(ConstantTypes.CONSTANT_METHODREF, new int[]{35, 112}));
 103         CP_MAP_FOR_CLASS.put(110, new ConstantPoolEntry(ConstantTypes.CONSTANT_CLASS, 113));
 104         CP_MAP_FOR_CLASS.put(111, new ConstantPoolEntry(ConstantTypes.CONSTANT_NAMEANDTYPE, new int[]{114, 118}));
 105         CP_MAP_FOR_CLASS.put(112, new ConstantPoolEntry(ConstantTypes.CONSTANT_NAMEANDTYPE, new int[]{58, 55}));








































































































 106     }
 107 
 108     private static final Map<Integer, ConstantPoolEntry> CP_MAP_FOR_INTERFACE
 109             = new HashMap<>();
 110     static {
 111         CP_MAP_FOR_INTERFACE.put(1, new ConstantPoolEntry(ConstantTypes.CONSTANT_CLASS, 48));
 112         CP_MAP_FOR_INTERFACE.put(5, new ConstantPoolEntry(ConstantTypes.CONSTANT_INTERFACEMETHODREF, new int[]{13, 52}));
 113         CP_MAP_FOR_INTERFACE.put(6, new ConstantPoolEntry(ConstantTypes.CONSTANT_CLASS, 53));
 114         CP_MAP_FOR_INTERFACE.put(7, new ConstantPoolEntry(ConstantTypes.CONSTANT_INVOKEDYNAMIC, new int[]{0, 58}));
 115         CP_MAP_FOR_INTERFACE.put(8, new ConstantPoolEntry(ConstantTypes.CONSTANT_METHODREF, new int[]{6, 59}));
 116         CP_MAP_FOR_INTERFACE.put(9, new ConstantPoolEntry(ConstantTypes.CONSTANT_METHODREF, new int[]{6, 60}));
 117         CP_MAP_FOR_INTERFACE.put(12, new ConstantPoolEntry(ConstantTypes.CONSTANT_FIELDREF, new int[]{13, 63}));
 118         CP_MAP_FOR_INTERFACE.put(13, new ConstantPoolEntry(ConstantTypes.CONSTANT_CLASS, 64));
 119         CP_MAP_FOR_INTERFACE.put(17, new ConstantPoolEntry(ConstantTypes.CONSTANT_INTEGER, 2147483647));
 120         CP_MAP_FOR_INTERFACE.put(20, new ConstantPoolEntry(ConstantTypes.CONSTANT_LONG, 9223372036854775807l));
 121         CP_MAP_FOR_INTERFACE.put(24, new ConstantPoolEntry(ConstantTypes.CONSTANT_FLOAT, 3.4028235E38f));
 122         CP_MAP_FOR_INTERFACE.put(27, new ConstantPoolEntry(ConstantTypes.CONSTANT_DOUBLE, 1.7976931348623157E308d));
 123         CP_MAP_FOR_INTERFACE.put(31, new ConstantPoolEntry(ConstantTypes.CONSTANT_STRING, 65));
 124         CP_MAP_FOR_INTERFACE.put(52, new ConstantPoolEntry(ConstantTypes.CONSTANT_NAMEANDTYPE, new int[]{34, 35}));
 125         CP_MAP_FOR_INTERFACE.put(55, new ConstantPoolEntry(ConstantTypes.CONSTANT_METHODHANDLE, new int[]{6, 67}));
 126         CP_MAP_FOR_INTERFACE.put(56, new ConstantPoolEntry(ConstantTypes.CONSTANT_METHODTYPE, 35));
 127         CP_MAP_FOR_INTERFACE.put(57, new ConstantPoolEntry(ConstantTypes.CONSTANT_METHODHANDLE, new int[]{9, 5}));
 128         CP_MAP_FOR_INTERFACE.put(58, new ConstantPoolEntry(ConstantTypes.CONSTANT_NAMEANDTYPE, new int[]{68, 69}));
 129         CP_MAP_FOR_INTERFACE.put(59, new ConstantPoolEntry(ConstantTypes.CONSTANT_NAMEANDTYPE, new int[]{70, 71}));
 130         CP_MAP_FOR_INTERFACE.put(60, new ConstantPoolEntry(ConstantTypes.CONSTANT_NAMEANDTYPE, new int[]{72, 35}));
 131         CP_MAP_FOR_INTERFACE.put(63, new ConstantPoolEntry(ConstantTypes.CONSTANT_NAMEANDTYPE, new int[]{32, 33}));
 132         CP_MAP_FOR_INTERFACE.put(67, new ConstantPoolEntry(ConstantTypes.CONSTANT_METHODREF, new int[]{73, 74}));
 133         CP_MAP_FOR_INTERFACE.put(73, new ConstantPoolEntry(ConstantTypes.CONSTANT_CLASS, 75));
 134         CP_MAP_FOR_INTERFACE.put(74, new ConstantPoolEntry(ConstantTypes.CONSTANT_NAMEANDTYPE, new int[]{76, 80}));
 135         CP_MAP_FOR_INTERFACE.put(77, new ConstantPoolEntry(ConstantTypes.CONSTANT_CLASS, 82));





















































 136     }
 137 }
   1 /*
   2  * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 package compiler.jvmci.compilerToVM;
  25 
  26 import compiler.jvmci.common.testcases.MultipleAbstractImplementer;
  27 import compiler.jvmci.common.testcases.MultipleImplementer2;
  28 import compiler.jvmci.common.testcases.MultipleImplementersInterface;
  29 import compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes;
  30 import compiler.jvmci.compilerToVM.ConstantPoolTestCase.TestedCPEntry;
  31 import java.util.HashMap;
  32 import java.util.Map;
  33 import jdk.internal.misc.SharedSecrets;
  34 import jdk.internal.org.objectweb.asm.Opcodes;
  35 import sun.hotspot.WhiteBox;
  36 import sun.reflect.ConstantPool;
  37 
  38 /**
  39  * Class contains hard-coded constant pool tables for dummy classes used for
  40  * jdk.vm.ci.hotspot.CompilerToVM constant pool methods
  41  */
  42 public class ConstantPoolTestsHelper {
  43 
  44     public static final int NO_CP_CACHE_PRESENT = Integer.MAX_VALUE;















  45 
  46     public enum DummyClasses {
  47         DUMMY_CLASS(MultipleImplementer2.class, CP_MAP_FOR_CLASS),
  48         DUMMY_ABS_CLASS(MultipleAbstractImplementer.class, CP_MAP_FOR_ABS_CLASS),
  49         DUMMY_INTERFACE(MultipleImplementersInterface.class, CP_MAP_FOR_INTERFACE);
  50 
  51         private static final WhiteBox WB = WhiteBox.getWhiteBox();
  52         public final Class<?> klass;
  53         public final ConstantPool constantPoolSS;
  54         public final Map<ConstantTypes, TestedCPEntry[]> testedCP;
  55 
  56         DummyClasses(Class<?> klass, Map<ConstantTypes, TestedCPEntry[]> testedCP) {
  57             this.klass = klass;
  58             this.constantPoolSS = SharedSecrets.getJavaLangAccess().
  59                     getConstantPool(klass);
  60             this.testedCP = testedCP;
  61         }
  62 
  63         public int getCPCacheIndex(int cpi) {
  64             int cacheLength = WB.getConstantPoolCacheLength(this.klass);
  65             int indexTag = WB.getConstantPoolCacheIndexTag();
  66             for (int cpci = indexTag; cpci < cacheLength + indexTag; cpci++) {
  67                 if (WB.remapInstructionOperandFromCPCache(this.klass, cpci) == cpi) {
  68                     if (constantPoolSS.getTagAt(cpi).equals(ConstantPool.Tag.INVOKEDYNAMIC)) {
  69                         return WB.encodeConstantPoolIndyIndex(cpci) + indexTag;
  70                     }
  71                     return cpci;
  72                 }
  73             }
  74             return NO_CP_CACHE_PRESENT;
  75         }
  76     }
  77 
  78     private static final Map<ConstantTypes, TestedCPEntry[]> CP_MAP_FOR_CLASS
  79             = new HashMap<>();
  80     static {
  81         CP_MAP_FOR_CLASS.put(ConstantTypes.CONSTANT_CLASS,
  82                 new TestedCPEntry[] {
  83                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementersInterface", null, null),
  84                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementer2", null, null),
  85                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementer2$1", null, null),
  86                     new TestedCPEntry("java/lang/invoke/MethodHandles$Lookup", null, null),
  87                 }
  88         );
  89         CP_MAP_FOR_CLASS.put(ConstantTypes.CONSTANT_FIELDREF,
  90                 new TestedCPEntry[] {
  91                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementer2",
  92                             "intStaticField", "I",
  93                             new byte[] {(byte) Opcodes.PUTSTATIC, (byte) Opcodes.GETSTATIC},
  94                             Opcodes.ACC_PRIVATE | Opcodes.ACC_STATIC),
  95                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementer2",
  96                             "longStaticField", "J",
  97                             new byte[] {(byte) Opcodes.PUTSTATIC, (byte) Opcodes.GETSTATIC},
  98                             Opcodes.ACC_FINAL | Opcodes.ACC_STATIC),
  99                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementer2",
 100                             "floatStaticField", "F",
 101                             new byte[] {(byte) Opcodes.PUTSTATIC, (byte) Opcodes.GETSTATIC},
 102                             Opcodes.ACC_VOLATILE | Opcodes.ACC_STATIC),
 103                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementer2",
 104                             "doubleStaticField", "D",
 105                             new byte[] {(byte) Opcodes.PUTSTATIC, (byte) Opcodes.GETSTATIC},
 106                             Opcodes.ACC_STATIC),
 107                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementer2",
 108                             "stringStaticField", "Ljava/lang/String;",
 109                             new byte[] {(byte) Opcodes.PUTSTATIC, (byte) Opcodes.GETSTATIC},
 110                             Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC),
 111                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementer2",
 112                             "objectStaticField", "Ljava/lang/Object;",
 113                             new byte[] {(byte) Opcodes.PUTSTATIC, (byte) Opcodes.GETSTATIC},
 114                             Opcodes.ACC_PROTECTED | Opcodes.ACC_STATIC),
 115                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementer2",
 116                             "intField", "I",
 117                             new byte[] {(byte) Opcodes.PUTFIELD | (byte) Opcodes.GETFIELD},
 118                             Opcodes.ACC_PUBLIC),
 119                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementer2",
 120                             "longField", "J",
 121                             new byte[] {(byte) Opcodes.PUTFIELD | (byte) Opcodes.GETFIELD},
 122                             Opcodes.ACC_PRIVATE),
 123                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementer2",
 124                             "floatField", "F",
 125                             new byte[] {(byte) Opcodes.PUTFIELD | (byte) Opcodes.GETFIELD},
 126                             Opcodes.ACC_PROTECTED),
 127                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementer2",
 128                             "doubleField", "D",
 129                             new byte[] {(byte) Opcodes.PUTFIELD | (byte) Opcodes.GETFIELD},
 130                             Opcodes.ACC_TRANSIENT),
 131                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementer2",
 132                             "objectField", "Ljava/lang/Object;",
 133                             new byte[] {(byte) Opcodes.PUTFIELD | (byte) Opcodes.GETFIELD},
 134                             Opcodes.ACC_FINAL),
 135                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementer2",
 136                             "stringField", "Ljava/lang/String;",
 137                             new byte[] {(byte) Opcodes.PUTFIELD | (byte) Opcodes.GETFIELD},
 138                             Opcodes.ACC_VOLATILE),
 139                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementer2",
 140                             "stringFieldEmpty", "Ljava/lang/String;",
 141                             new byte[] {(byte) Opcodes.PUTFIELD | (byte) Opcodes.GETFIELD},
 142                             0L),
 143                 }
 144         );
 145         CP_MAP_FOR_CLASS.put(ConstantTypes.CONSTANT_METHODREF,
 146                 new TestedCPEntry[] {
 147                     new TestedCPEntry("java/lang/System",
 148                             "getProperties", "()Ljava/util/Properties;",
 149                             new byte[] {(byte) Opcodes.INVOKESTATIC}),
 150                     new TestedCPEntry("java/util/HashMap",
 151                             "<init>", "()V",
 152                             new byte[] {(byte) Opcodes.INVOKESPECIAL}),
 153                     new TestedCPEntry("java/lang/Object",
 154                             "toString", "()Ljava/lang/String;",
 155                             new byte[] {(byte) Opcodes.INVOKESPECIAL,
 156                                 (byte) Opcodes.INVOKEVIRTUAL}),
 157                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementer2$1",
 158                             "<init>", "(Lcompiler/jvmci/common/testcases/MultipleImplementer2;)V",
 159                             new byte[0]),
 160                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer$1",
 161                             "run", "()V",
 162                             new byte[0]),
 163                 }
 164         );
 165         CP_MAP_FOR_CLASS.put(ConstantTypes.CONSTANT_INTERFACEMETHODREF,
 166                 new TestedCPEntry[] {
 167                     new TestedCPEntry("java/util/Map",
 168                             "put",
 169                             "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;",
 170                             new byte[] {(byte) Opcodes.INVOKEINTERFACE}),
 171                     new TestedCPEntry("java/util/Map",
 172                             "remove",
 173                             "(Ljava/lang/Object;)Ljava/lang/Object;",
 174                             new byte[] {(byte) Opcodes.INVOKEINTERFACE}),
 175                 }
 176         );
 177         CP_MAP_FOR_CLASS.put(ConstantTypes.CONSTANT_STRING,
 178                 new TestedCPEntry[] {
 179                     new TestedCPEntry(null, "Message", null),
 180                     new TestedCPEntry(null, "", null),
 181                 }
 182         );
 183         CP_MAP_FOR_CLASS.put(ConstantTypes.CONSTANT_METHODHANDLE,
 184                 new TestedCPEntry[] {
 185                     new TestedCPEntry("java/lang/invoke/LambdaMetafactory",
 186                             "metafactory",
 187                             "(Ljava/lang/invoke/MethodHandles$Lookup;"
 188                                     + "Ljava/lang/String;"
 189                                     + "Ljava/lang/invoke/MethodType;"
 190                                     + "Ljava/lang/invoke/MethodType;"
 191                                     + "Ljava/lang/invoke/MethodHandle;"
 192                                     + "Ljava/lang/invoke/MethodType;)"
 193                                     + "Ljava/lang/invoke/CallSite;", null),
 194                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementer2",
 195                             "testMethod", "()V"),
 196                 }
 197         );
 198         CP_MAP_FOR_CLASS.put(ConstantTypes.CONSTANT_METHODTYPE,
 199                 new TestedCPEntry[] {
 200                     new TestedCPEntry(null, null, "()V"),
 201                 }
 202         );
 203         CP_MAP_FOR_CLASS.put(ConstantTypes.CONSTANT_INVOKEDYNAMIC,
 204                 new TestedCPEntry[] {
 205                     new TestedCPEntry(null, "run",
 206                             "(Lcompiler/jvmci/common/testcases/MultipleImplementer2;)"
 207                                     + "Ljava/lang/Runnable;"),
 208                 }
 209         );
 210     }
 211 
 212     private static final Map<ConstantTypes, TestedCPEntry[]> CP_MAP_FOR_ABS_CLASS
 213             = new HashMap<>();
 214     static {
 215         CP_MAP_FOR_ABS_CLASS.put(ConstantTypes.CONSTANT_CLASS,
 216                 new TestedCPEntry[] {
 217                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementersInterface", null, null),
 218                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer", null, null),
 219                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer$1", null, null),
 220                     new TestedCPEntry("java/lang/invoke/MethodHandles$Lookup", null, null),
 221                 }
 222         );
 223         CP_MAP_FOR_ABS_CLASS.put(ConstantTypes.CONSTANT_FIELDREF,
 224                 new TestedCPEntry[] {
 225                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer",
 226                             "intStaticField", "I",
 227                             new byte[] {(byte) Opcodes.PUTSTATIC, (byte) Opcodes.GETSTATIC},
 228                             Opcodes.ACC_PRIVATE | Opcodes.ACC_STATIC),
 229                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer",
 230                             "longStaticField", "J",
 231                             new byte[] {(byte) Opcodes.PUTSTATIC, (byte) Opcodes.GETSTATIC},
 232                             Opcodes.ACC_FINAL | Opcodes.ACC_STATIC),
 233                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer",
 234                             "floatStaticField", "F",
 235                             new byte[] {(byte) Opcodes.PUTSTATIC, (byte) Opcodes.GETSTATIC},
 236                             Opcodes.ACC_VOLATILE | Opcodes.ACC_STATIC),
 237                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer",
 238                             "doubleStaticField", "D",
 239                             new byte[] {(byte) Opcodes.PUTSTATIC, (byte) Opcodes.GETSTATIC},
 240                             Opcodes.ACC_STATIC),
 241                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer",
 242                             "stringStaticField", "Ljava/lang/String;",
 243                             new byte[] {(byte) Opcodes.PUTSTATIC, (byte) Opcodes.GETSTATIC},
 244                             Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC),
 245                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer",
 246                             "objectStaticField", "Ljava/lang/Object;",
 247                             new byte[] {(byte) Opcodes.PUTSTATIC, (byte) Opcodes.GETSTATIC},
 248                             Opcodes.ACC_PROTECTED | Opcodes.ACC_STATIC),
 249                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer",
 250                             "intField", "I",
 251                             new byte[] {(byte) Opcodes.PUTFIELD | (byte) Opcodes.GETFIELD},
 252                             Opcodes.ACC_PUBLIC),
 253                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer",
 254                             "longField", "J",
 255                             new byte[] {(byte) Opcodes.PUTFIELD | (byte) Opcodes.GETFIELD},
 256                             Opcodes.ACC_PRIVATE),
 257                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer",
 258                             "floatField", "F",
 259                             new byte[] {(byte) Opcodes.PUTFIELD | (byte) Opcodes.GETFIELD},
 260                             Opcodes.ACC_PROTECTED),
 261                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer",
 262                             "doubleField", "D",
 263                             new byte[] {(byte) Opcodes.PUTFIELD | (byte) Opcodes.GETFIELD},
 264                             Opcodes.ACC_TRANSIENT),
 265                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer",
 266                             "objectField", "Ljava/lang/Object;",
 267                             new byte[] {(byte) Opcodes.PUTFIELD | (byte) Opcodes.GETFIELD},
 268                             Opcodes.ACC_FINAL),
 269                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer",
 270                             "stringField", "Ljava/lang/String;",
 271                             new byte[] {(byte) Opcodes.PUTFIELD | (byte) Opcodes.GETFIELD},
 272                             Opcodes.ACC_VOLATILE),
 273                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer",
 274                             "stringFieldEmpty", "Ljava/lang/String;",
 275                             new byte[] {(byte) Opcodes.PUTFIELD | (byte) Opcodes.GETFIELD},
 276                             0L),
 277                 }
 278         );
 279         CP_MAP_FOR_ABS_CLASS.put(ConstantTypes.CONSTANT_METHODREF,
 280                 new TestedCPEntry[] {
 281                     new TestedCPEntry("java/lang/System",
 282                             "getProperties", "()Ljava/util/Properties;",
 283                             new byte[] {(byte) Opcodes.INVOKESTATIC}),
 284                     new TestedCPEntry("java/util/HashMap",
 285                             "<init>", "()V",
 286                             new byte[] {(byte) Opcodes.INVOKESPECIAL}),
 287                     new TestedCPEntry("java/lang/Object",
 288                             "toString", "()Ljava/lang/String;",
 289                             new byte[] {(byte) Opcodes.INVOKESPECIAL,
 290                                 (byte) Opcodes.INVOKEVIRTUAL}),
 291                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer$1",
 292                             "<init>", "(Lcompiler/jvmci/common/testcases/MultipleAbstractImplementer;)V",
 293                             new byte[0]),
 294                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer$1",
 295                             "run", "()V",
 296                             new byte[0]),
 297                 }
 298         );
 299         CP_MAP_FOR_ABS_CLASS.put(ConstantTypes.CONSTANT_INTERFACEMETHODREF,
 300                 new TestedCPEntry[] {
 301                     new TestedCPEntry("java/util/Map",
 302                             "put",
 303                             "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;",
 304                             new byte[] {(byte) Opcodes.INVOKEINTERFACE}),
 305                     new TestedCPEntry("java/util/Map",
 306                             "remove",
 307                             "(Ljava/lang/Object;)Ljava/lang/Object;",
 308                             new byte[] {(byte) Opcodes.INVOKEINTERFACE}),
 309                 }
 310         );
 311         CP_MAP_FOR_ABS_CLASS.put(ConstantTypes.CONSTANT_STRING,
 312                 new TestedCPEntry[] {
 313                     new TestedCPEntry(null, "Message", null),
 314                     new TestedCPEntry(null, "", null),
 315                 }
 316         );
 317         CP_MAP_FOR_ABS_CLASS.put(ConstantTypes.CONSTANT_METHODHANDLE,
 318                 new TestedCPEntry[] {
 319                     new TestedCPEntry("java/lang/invoke/LambdaMetafactory",
 320                             "metafactory",
 321                             "(Ljava/lang/invoke/MethodHandles$Lookup;"
 322                                     + "Ljava/lang/String;"
 323                                     + "Ljava/lang/invoke/MethodType;"
 324                                     + "Ljava/lang/invoke/MethodType;"
 325                                     + "Ljava/lang/invoke/MethodHandle;"
 326                                     + "Ljava/lang/invoke/MethodType;)"
 327                                     + "Ljava/lang/invoke/CallSite;", null),
 328                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer",
 329                             "testMethod", "()V"),
 330                 }
 331         );
 332         CP_MAP_FOR_ABS_CLASS.put(ConstantTypes.CONSTANT_METHODTYPE,
 333                 new TestedCPEntry[] {
 334                     new TestedCPEntry(null, null, "()V"),
 335                 }
 336         );
 337         CP_MAP_FOR_ABS_CLASS.put(ConstantTypes.CONSTANT_INVOKEDYNAMIC,
 338                 new TestedCPEntry[] {
 339                     new TestedCPEntry(null, "run",
 340                             "(Lcompiler/jvmci/common/testcases/MultipleAbstractImplementer;)"
 341                                     + "Ljava/lang/Runnable;"),
 342                 }
 343         );
 344     }
 345 
 346     private static final Map<ConstantTypes, TestedCPEntry[]> CP_MAP_FOR_INTERFACE
 347             = new HashMap<>();
 348     static {
 349         CP_MAP_FOR_INTERFACE.put(ConstantTypes.CONSTANT_CLASS,
 350                 new TestedCPEntry[] {
 351                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementersInterface", null, null),
 352                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementersInterface$1", null, null),
 353                     new TestedCPEntry("java/lang/Object", null, null),
 354                     new TestedCPEntry("java/lang/invoke/MethodHandles$Lookup", null, null),
 355                 }
 356         );
 357         CP_MAP_FOR_INTERFACE.put(ConstantTypes.CONSTANT_FIELDREF,
 358                 new TestedCPEntry[] {
 359                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementersInterface",
 360                             "OBJECT_CONSTANT", "Ljava/lang/Object;",
 361                             new byte[] {(byte) Opcodes.PUTSTATIC, (byte) Opcodes.GETSTATIC},
 362                             Opcodes.ACC_STATIC | Opcodes.ACC_FINAL | Opcodes.ACC_PUBLIC),
 363                 }
 364         );
 365         CP_MAP_FOR_INTERFACE.put(ConstantTypes.CONSTANT_METHODREF,
 366                 new TestedCPEntry[] {
 367                     new TestedCPEntry("java/lang/System",
 368                             "getProperties", "()Ljava/util/Properties;",
 369                             new byte[] {(byte) Opcodes.INVOKESTATIC}),
 370                     new TestedCPEntry("java/util/HashMap",
 371                             "<init>", "()V", new byte[] {(byte) Opcodes.INVOKESPECIAL}),
 372                     new TestedCPEntry("java/lang/Object",
 373                             "toString", "()Ljava/lang/String;",
 374                             new byte[] {(byte) Opcodes.INVOKEVIRTUAL}),
 375                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer$1",
 376                             "<init>", "(Lcompiler/jvmci/common/testcases/MultipleAbstractImplementer;)V",
 377                             new byte[0]),
 378                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer$1",
 379                             "run", "()V",
 380                             new byte[0]),
 381                 }
 382         );
 383         CP_MAP_FOR_INTERFACE.put(ConstantTypes.CONSTANT_INTERFACEMETHODREF,
 384                 new TestedCPEntry[] {
 385                     new TestedCPEntry("java/util/Map",
 386                             "put",
 387                             "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;",
 388                             new byte[] {(byte) Opcodes.INVOKEINTERFACE}),
 389                     new TestedCPEntry("java/util/Map",
 390                             "remove",
 391                             "(Ljava/lang/Object;)Ljava/lang/Object;",
 392                             new byte[] {(byte) Opcodes.INVOKEINTERFACE}),
 393                 }
 394         );
 395         CP_MAP_FOR_INTERFACE.put(ConstantTypes.CONSTANT_STRING,
 396                 new TestedCPEntry[] {
 397                     new TestedCPEntry(null, "Hello", null),
 398                     new TestedCPEntry(null, "", null),
 399                 }
 400         );
 401         CP_MAP_FOR_INTERFACE.put(ConstantTypes.CONSTANT_METHODHANDLE,
 402                 new TestedCPEntry[] {
 403                     new TestedCPEntry("java/lang/invoke/LambdaMetafactory",
 404                             "metafactory",
 405                             "(Ljava/lang/invoke/MethodHandles$Lookup;"
 406                                     + "Ljava/lang/String;Ljava/lang/invoke/MethodType;"
 407                                     + "Ljava/lang/invoke/MethodType;"
 408                                     + "Ljava/lang/invoke/MethodHandle;"
 409                                     + "Ljava/lang/invoke/MethodType;)"
 410                                     + "Ljava/lang/invoke/CallSite;"),
 411                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementersInterface",
 412                             "defaultMethod", "()V"),
 413                 }
 414         );
 415         CP_MAP_FOR_INTERFACE.put(ConstantTypes.CONSTANT_METHODTYPE,
 416                 new TestedCPEntry[] {
 417                     new TestedCPEntry(null, null, "()V"),
 418                 }
 419         );
 420         CP_MAP_FOR_INTERFACE.put(ConstantTypes.CONSTANT_INVOKEDYNAMIC,
 421                 new TestedCPEntry[] {
 422                     new TestedCPEntry(null, "run",
 423                             "(Lcompiler/jvmci/common/testcases/MultipleImplementersInterface;)"
 424                                     + "Ljava/lang/Runnable;"),
 425                 }
 426         );
 427     }
 428 }
< prev index next >