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 static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.*;
  31 import compiler.jvmci.compilerToVM.ConstantPoolTestCase.TestedCPEntry;
  32 import java.util.HashMap;
  33 import java.util.Map;
  34 import jdk.vm.ci.meta.MetaAccessProvider;
  35 import jdk.vm.ci.meta.ResolvedJavaMethod;
  36 import jdk.vm.ci.meta.ResolvedJavaType;
  37 import jdk.vm.ci.runtime.JVMCI;
  38 import jdk.internal.misc.SharedSecrets;
  39 import jdk.internal.org.objectweb.asm.Opcodes;
  40 import sun.hotspot.WhiteBox;
  41 import jdk.internal.reflect.ConstantPool;
  42 import jdk.internal.reflect.ConstantPool.Tag;
  43 
  44 /**
  45  * Class contains hard-coded constant pool tables for dummy classes used for
  46  * jdk.vm.ci.hotspot.CompilerToVM constant pool methods
  47  */
  48 public class ConstantPoolTestsHelper {
  49 
  50     public static final int NO_CP_CACHE_PRESENT = Integer.MAX_VALUE;
  51     private static final MetaAccessProvider metaAccess = JVMCI.getRuntime().getHostJVMCIBackend().getMetaAccess();
  52 
  53     public enum DummyClasses {
  54         DUMMY_CLASS(MultipleImplementer2.class, CP_MAP_FOR_CLASS),
  55         DUMMY_ABS_CLASS(MultipleAbstractImplementer.class, CP_MAP_FOR_ABS_CLASS),
  56         DUMMY_INTERFACE(MultipleImplementersInterface.class, CP_MAP_FOR_INTERFACE);
  57 
  58         private static final WhiteBox WB = WhiteBox.getWhiteBox();
  59         public final Class<?> klass;
  60         public final ConstantPool constantPoolSS;
  61         public final Map<ConstantTypes, TestedCPEntry[]> testedCP;
  62 
  63         DummyClasses(Class<?> klass, Map<ConstantTypes, TestedCPEntry[]> testedCP) {
  64             this.klass = klass;
  65             this.constantPoolSS = SharedSecrets.getJavaLangAccess().getConstantPool(klass);
  66             this.testedCP = testedCP;
  67         }
  68 
  69         public int getCPCacheIndex(int cpi) {
  70             int cacheLength = WB.getConstantPoolCacheLength(this.klass);
  71             int indexTag = WB.getConstantPoolCacheIndexTag();
  72             for (int cpci = indexTag; cpci < cacheLength + indexTag; cpci++) {
  73                 if (WB.remapInstructionOperandFromCPCache(this.klass, cpci) == cpi) {
  74                     if (constantPoolSS.getTagAt(cpi).equals(Tag.INVOKEDYNAMIC)) {
  75                         return WB.encodeConstantPoolIndyIndex(cpci) + indexTag;
  76                     }
  77                     return cpci;
  78                 }
  79             }
  80             return NO_CP_CACHE_PRESENT;
  81         }
  82     }
  83 
  84     /**
  85      * Obtain a resolved Java method declared by a given type. 
  86      * 
  87      * @param type the declaring type
  88      * @param the method's name 
  89      *  
  90      * Currently, the lookup is based only on the method's name
  91      * but not on the method's signature (i.e., the first method
  92      * with a matching name declared on {@code type} is returned).
  93      */
  94     private static ResolvedJavaMethod getMethod(ResolvedJavaType type, String methodName) {
  95         if (methodName.equals("<clinit>")) {
  96             return type.getClassInitializer();
  97         }
  98 
  99         if (methodName.equals("<init>")) {
 100             ResolvedJavaMethod[] initializers = type.getDeclaredConstructors();
 101             if (initializers.length >= 0) {
 102                 return initializers[0];
 103             } else {
 104                 throw new IllegalArgumentException();
 105             }
 106         }
 107 
 108         for (ResolvedJavaMethod method : type.getDeclaredMethods()) {
 109             if (method.getName().equals(methodName)) {
 110                 return method;
 111             }
 112         }
 113 
 114         throw new IllegalArgumentException();
 115     }
 116 
 117     private static ResolvedJavaType getType(Class<?> clazz) {
 118         ResolvedJavaType type = metaAccess.lookupJavaType(clazz);
 119         type.initialize();
 120         return type;
 121     }
 122 
 123     private static final Map<ConstantTypes, TestedCPEntry[]> CP_MAP_FOR_CLASS = new HashMap<>();
 124     static {
 125         CP_MAP_FOR_CLASS.put(CONSTANT_CLASS,
 126                 new TestedCPEntry[] {
 127                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementersInterface", null, null),
 128                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementer2", null, null),
 129                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementer2$1", null, null),
 130                     new TestedCPEntry("java/lang/invoke/MethodHandles$Lookup", null, null),
 131                 }
 132         );
 133         CP_MAP_FOR_CLASS.put(CONSTANT_FIELDREF,
 134                 new TestedCPEntry[] {
 135                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementer2",
 136                                       "intStaticField",
 137                                       "I",
 138                                       new byte[] {(byte) Opcodes.PUTSTATIC, (byte) Opcodes.GETSTATIC},
 139                                       Opcodes.ACC_PRIVATE | Opcodes.ACC_STATIC),
 140                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementer2",
 141                                       "longStaticField",
 142                                       "J",
 143                                       new byte[] {(byte) Opcodes.PUTSTATIC, (byte) Opcodes.GETSTATIC},
 144                                       Opcodes.ACC_FINAL | Opcodes.ACC_STATIC),
 145                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementer2",
 146                                       "floatStaticField",
 147                                       "F",
 148                                       new byte[] {(byte) Opcodes.PUTSTATIC, (byte) Opcodes.GETSTATIC},
 149                                       Opcodes.ACC_VOLATILE | Opcodes.ACC_STATIC),
 150                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementer2",
 151                                       "doubleStaticField",
 152                                       "D",
 153                                       new byte[] {(byte) Opcodes.PUTSTATIC, (byte) Opcodes.GETSTATIC},
 154                                       Opcodes.ACC_STATIC),
 155                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementer2",
 156                                       "stringStaticField",
 157                                       "Ljava/lang/String;",
 158                                       new byte[] {(byte) Opcodes.PUTSTATIC, (byte) Opcodes.GETSTATIC},
 159                                       Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC),
 160                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementer2",
 161                                       "objectStaticField",
 162                                       "Ljava/lang/Object;",
 163                                       new byte[] {(byte) Opcodes.PUTSTATIC, (byte) Opcodes.GETSTATIC},
 164                                       Opcodes.ACC_PROTECTED | Opcodes.ACC_STATIC),
 165                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementer2",
 166                                       "intField",
 167                                       "I",
 168                                       new byte[] {(byte) Opcodes.PUTFIELD | (byte) Opcodes.GETFIELD},
 169                                       Opcodes.ACC_PUBLIC),
 170                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementer2",
 171                                       "longField",
 172                                       "J",
 173                                       new byte[] {(byte) Opcodes.PUTFIELD | (byte) Opcodes.GETFIELD},
 174                                       Opcodes.ACC_PRIVATE),
 175                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementer2",
 176                                       "floatField",
 177                                       "F",
 178                                       new byte[] {(byte) Opcodes.PUTFIELD | (byte) Opcodes.GETFIELD},
 179                                       Opcodes.ACC_PROTECTED),
 180                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementer2",
 181                                       "doubleField",
 182                                       "D",
 183                                       new byte[] {(byte) Opcodes.PUTFIELD | (byte) Opcodes.GETFIELD},
 184                                       Opcodes.ACC_TRANSIENT),
 185                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementer2",
 186                                       "objectField",
 187                                       "Ljava/lang/Object;",
 188                                       new ResolvedJavaMethod[] { getMethod(getType(MultipleImplementer2.class), "<init>"), null },
 189                                       new byte[] {(byte) Opcodes.PUTFIELD | (byte) Opcodes.GETFIELD},
 190                                       Opcodes.ACC_FINAL),
 191                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementer2",
 192                                       "stringField",
 193                                       "Ljava/lang/String;",
 194                                       new byte[] {(byte) Opcodes.PUTFIELD | (byte) Opcodes.GETFIELD},
 195                                       Opcodes.ACC_VOLATILE),
 196                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementer2",
 197                                       "stringFieldEmpty",
 198                                       "Ljava/lang/String;",
 199                                       new byte[] {(byte) Opcodes.PUTFIELD | (byte) Opcodes.GETFIELD},
 200                                       0L),
 201                 }
 202         );
 203         CP_MAP_FOR_CLASS.put(CONSTANT_METHODREF,
 204                 new TestedCPEntry[] {
 205                     new TestedCPEntry("java/lang/System",
 206                                       "getProperties",
 207                                       "()Ljava/util/Properties;",
 208                                       new byte[] {(byte) Opcodes.INVOKESTATIC}),
 209                     new TestedCPEntry("java/util/HashMap",
 210                                       "<init>",
 211                                       "()V",
 212                                       new byte[] {(byte) Opcodes.INVOKESPECIAL}),
 213                     new TestedCPEntry("java/lang/Object",
 214                                       "toString",
 215                                       "()Ljava/lang/String;",
 216                                       new byte[] {(byte) Opcodes.INVOKESPECIAL,
 217                                       (byte) Opcodes.INVOKEVIRTUAL}),
 218                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementer2$1",
 219                                       "<init>",
 220                                       "(Lcompiler/jvmci/common/testcases/MultipleImplementer2;)V",
 221                                       new byte[0]),
 222                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer$1",
 223                                       "run",
 224                                       "()V",
 225                                       new byte[0]),
 226                 }
 227         );
 228         CP_MAP_FOR_CLASS.put(CONSTANT_INTERFACEMETHODREF,
 229                 new TestedCPEntry[] {
 230                     new TestedCPEntry("java/util/Map",
 231                                       "put",
 232                                       "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;",
 233                                       new byte[] {(byte) Opcodes.INVOKEINTERFACE}),
 234                     new TestedCPEntry("java/util/Map",
 235                                       "remove",
 236                                       "(Ljava/lang/Object;)Ljava/lang/Object;",
 237                                       new byte[] {(byte) Opcodes.INVOKEINTERFACE}),
 238                 }
 239         );
 240         CP_MAP_FOR_CLASS.put(CONSTANT_STRING,
 241                 new TestedCPEntry[] {
 242                     new TestedCPEntry(null, "Message", null),
 243                     new TestedCPEntry(null, "", null),
 244                 }
 245         );
 246         CP_MAP_FOR_CLASS.put(CONSTANT_METHODHANDLE,
 247                 new TestedCPEntry[] {
 248                     new TestedCPEntry("java/lang/invoke/LambdaMetafactory",
 249                                       "metafactory",
 250                                       "(Ljava/lang/invoke/MethodHandles$Lookup;"
 251                                               + "Ljava/lang/String;"
 252                                               + "Ljava/lang/invoke/MethodType;"
 253                                               + "Ljava/lang/invoke/MethodType;"
 254                                               + "Ljava/lang/invoke/MethodHandle;"
 255                                               + "Ljava/lang/invoke/MethodType;)"
 256                                               + "Ljava/lang/invoke/CallSite;",
 257                                       null),
 258                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementer2",
 259                                       "testMethod",
 260                                       "()V"),
 261                 }
 262         );
 263         CP_MAP_FOR_CLASS.put(CONSTANT_METHODTYPE,
 264                 new TestedCPEntry[] {
 265                     new TestedCPEntry(null, null, "()V"),
 266                 }
 267         );
 268         CP_MAP_FOR_CLASS.put(CONSTANT_INVOKEDYNAMIC,
 269                 new TestedCPEntry[] {
 270                     new TestedCPEntry(null,
 271                                      "run",
 272                                      "(Lcompiler/jvmci/common/testcases/MultipleImplementer2;)"
 273                                              + "Ljava/lang/Runnable;"),
 274                 }
 275         );
 276     }
 277 
 278     private static final Map<ConstantTypes, TestedCPEntry[]> CP_MAP_FOR_ABS_CLASS
 279             = new HashMap<>();
 280     static {
 281         CP_MAP_FOR_ABS_CLASS.put(CONSTANT_CLASS,
 282                 new TestedCPEntry[] {
 283                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementersInterface", null, null),
 284                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer", null, null),
 285                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer$1", null, null),
 286                     new TestedCPEntry("java/lang/invoke/MethodHandles$Lookup", null, null),
 287                 }
 288         );
 289         CP_MAP_FOR_ABS_CLASS.put(CONSTANT_FIELDREF,
 290                 new TestedCPEntry[] {
 291                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer",
 292                                       "intStaticField",
 293                                       "I",
 294                                       new byte[] {(byte) Opcodes.PUTSTATIC, (byte) Opcodes.GETSTATIC},
 295                                       Opcodes.ACC_PRIVATE | Opcodes.ACC_STATIC),
 296                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer",
 297                                       "longStaticField",
 298                                       "J",
 299                                       new byte[] {(byte) Opcodes.PUTSTATIC, (byte) Opcodes.GETSTATIC},
 300                                       Opcodes.ACC_FINAL | Opcodes.ACC_STATIC),
 301                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer",
 302                                       "floatStaticField",
 303                                       "F",
 304                                       new byte[] {(byte) Opcodes.PUTSTATIC, (byte) Opcodes.GETSTATIC},
 305                                       Opcodes.ACC_VOLATILE | Opcodes.ACC_STATIC),
 306                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer",
 307                                       "doubleStaticField",
 308                                       "D",
 309                                       new byte[] {(byte) Opcodes.PUTSTATIC, (byte) Opcodes.GETSTATIC},
 310                                       Opcodes.ACC_STATIC),
 311                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer",
 312                                       "stringStaticField",
 313                                       "Ljava/lang/String;",
 314                                       new byte[] {(byte) Opcodes.PUTSTATIC, (byte) Opcodes.GETSTATIC},
 315                                       Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC),
 316                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer",
 317                                       "objectStaticField",
 318                                       "Ljava/lang/Object;",
 319                                       new byte[] {(byte) Opcodes.PUTSTATIC, (byte) Opcodes.GETSTATIC},
 320                                       Opcodes.ACC_PROTECTED | Opcodes.ACC_STATIC),
 321                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer",
 322                                       "intField",
 323                                       "I",
 324                                       new byte[] {(byte) Opcodes.PUTFIELD | (byte) Opcodes.GETFIELD},
 325                                       Opcodes.ACC_PUBLIC),
 326                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer",
 327                                       "longField",
 328                                       "J",
 329                                       new byte[] {(byte) Opcodes.PUTFIELD | (byte) Opcodes.GETFIELD},
 330                                       Opcodes.ACC_PRIVATE),
 331                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer",
 332                                       "floatField",
 333                                       "F",
 334                                       new byte[] {(byte) Opcodes.PUTFIELD | (byte) Opcodes.GETFIELD},
 335                                       Opcodes.ACC_PROTECTED),
 336                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer",
 337                                       "doubleField",
 338                                       "D",
 339                                       new byte[] {(byte) Opcodes.PUTFIELD | (byte) Opcodes.GETFIELD},
 340                                       Opcodes.ACC_TRANSIENT),
 341                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer",
 342                                       "objectField",
 343                                       "Ljava/lang/Object;",
 344                                       new ResolvedJavaMethod[] { getMethod(getType(MultipleAbstractImplementer.class), "<init>"), null },
 345                                       new byte[] {(byte) Opcodes.PUTFIELD | (byte) Opcodes.GETFIELD},
 346                                       Opcodes.ACC_FINAL),
 347                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer",
 348                                       "stringField",
 349                                       "Ljava/lang/String;",
 350                                       new byte[] {(byte) Opcodes.PUTFIELD | (byte) Opcodes.GETFIELD},
 351                                       Opcodes.ACC_VOLATILE),
 352                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer",
 353                                       "stringFieldEmpty",
 354                                       "Ljava/lang/String;",
 355                                       new byte[] {(byte) Opcodes.PUTFIELD | (byte) Opcodes.GETFIELD},
 356                                       0L),
 357                 }
 358         );
 359         CP_MAP_FOR_ABS_CLASS.put(CONSTANT_METHODREF,
 360                 new TestedCPEntry[] {
 361                     new TestedCPEntry("java/lang/System",
 362                                       "getProperties",
 363                                       "()Ljava/util/Properties;",
 364                                       new byte[] {(byte) Opcodes.INVOKESTATIC}),
 365                     new TestedCPEntry("java/util/HashMap",
 366                                       "<init>",
 367                                       "()V",
 368                                       new byte[] {(byte) Opcodes.INVOKESPECIAL}),
 369                     new TestedCPEntry("java/lang/Object",
 370                                       "toString",
 371                                       "()Ljava/lang/String;",
 372                                       new byte[] {(byte) Opcodes.INVOKESPECIAL,
 373                                       (byte) Opcodes.INVOKEVIRTUAL}),
 374                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer$1",
 375                                       "<init>",
 376                                       "(Lcompiler/jvmci/common/testcases/MultipleAbstractImplementer;)V",
 377                                       new byte[0]),
 378                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer$1",
 379                                       "run",
 380                                       "()V",
 381                                       new byte[0]),
 382                 }
 383         );
 384         CP_MAP_FOR_ABS_CLASS.put(CONSTANT_INTERFACEMETHODREF,
 385                 new TestedCPEntry[] {
 386                     new TestedCPEntry("java/util/Map",
 387                                       "put",
 388                                       "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;",
 389                                       new byte[] {(byte) Opcodes.INVOKEINTERFACE}),
 390                     new TestedCPEntry("java/util/Map",
 391                                       "remove",
 392                                       "(Ljava/lang/Object;)Ljava/lang/Object;",
 393                                       new byte[] {(byte) Opcodes.INVOKEINTERFACE}),
 394                 }
 395         );
 396         CP_MAP_FOR_ABS_CLASS.put(CONSTANT_STRING,
 397                 new TestedCPEntry[] {
 398                     new TestedCPEntry(null, "Message", null),
 399                     new TestedCPEntry(null, "", null),
 400                 }
 401         );
 402         CP_MAP_FOR_ABS_CLASS.put(CONSTANT_METHODHANDLE,
 403                 new TestedCPEntry[] {
 404                     new TestedCPEntry("java/lang/invoke/LambdaMetafactory",
 405                                       "metafactory",
 406                                       "(Ljava/lang/invoke/MethodHandles$Lookup;"
 407                                               + "Ljava/lang/String;"
 408                                               + "Ljava/lang/invoke/MethodType;"
 409                                               + "Ljava/lang/invoke/MethodType;"
 410                                               + "Ljava/lang/invoke/MethodHandle;"
 411                                               + "Ljava/lang/invoke/MethodType;)"
 412                                               + "Ljava/lang/invoke/CallSite;",
 413                                       null),
 414                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer",
 415                                       "testMethod",
 416                                       "()V"),
 417                 }
 418         );
 419         CP_MAP_FOR_ABS_CLASS.put(CONSTANT_METHODTYPE,
 420                 new TestedCPEntry[] {
 421                     new TestedCPEntry(null, null, "()V"),
 422                 }
 423         );
 424         CP_MAP_FOR_ABS_CLASS.put(CONSTANT_INVOKEDYNAMIC,
 425                 new TestedCPEntry[] {
 426                     new TestedCPEntry(null,
 427                                       "run",
 428                                       "(Lcompiler/jvmci/common/testcases/MultipleAbstractImplementer;)"
 429                                               + "Ljava/lang/Runnable;"),
 430                 }
 431         );
 432     }
 433 
 434     private static final Map<ConstantTypes, TestedCPEntry[]> CP_MAP_FOR_INTERFACE
 435             = new HashMap<>();
 436     static {
 437         CP_MAP_FOR_INTERFACE.put(CONSTANT_CLASS,
 438                 new TestedCPEntry[] {
 439                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementersInterface", null, null),
 440                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementersInterface$1", null, null),
 441                     new TestedCPEntry("java/lang/Object", null, null),
 442                     new TestedCPEntry("java/lang/invoke/MethodHandles$Lookup", null, null),
 443                 }
 444         );
 445         CP_MAP_FOR_INTERFACE.put(CONSTANT_FIELDREF,
 446                 new TestedCPEntry[] {
 447                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementersInterface",
 448                                       "OBJECT_CONSTANT",
 449                                       "Ljava/lang/Object;",
 450                                       new ResolvedJavaMethod[] { getMethod(getType(MultipleImplementersInterface.class), "<clinit>"), null },
 451                                       new byte[] {(byte) Opcodes.PUTSTATIC, (byte) Opcodes.GETSTATIC},
 452                                       Opcodes.ACC_STATIC | Opcodes.ACC_FINAL | Opcodes.ACC_PUBLIC),
 453                 }
 454         );
 455         CP_MAP_FOR_INTERFACE.put(CONSTANT_METHODREF,
 456                 new TestedCPEntry[] {
 457                     new TestedCPEntry("java/lang/System",
 458                                       "getProperties",
 459                                       "()Ljava/util/Properties;",
 460                                       new byte[] {(byte) Opcodes.INVOKESTATIC}),
 461                     new TestedCPEntry("java/util/HashMap",
 462                                       "<init>",
 463                                       "()V",
 464                                       new byte[] {(byte) Opcodes.INVOKESPECIAL}),
 465                     new TestedCPEntry("java/lang/Object",
 466                                       "toString",
 467                                       "()Ljava/lang/String;",
 468                                       new byte[] {(byte) Opcodes.INVOKEVIRTUAL}),
 469                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer$1",
 470                                       "<init>",
 471                                       "(Lcompiler/jvmci/common/testcases/MultipleAbstractImplementer;)V",
 472                                       new byte[0]),
 473                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer$1",
 474                                       "run",
 475                                       "()V",
 476                                       new byte[0]),
 477                 }
 478         );
 479         CP_MAP_FOR_INTERFACE.put(CONSTANT_INTERFACEMETHODREF,
 480                 new TestedCPEntry[] {
 481                     new TestedCPEntry("java/util/Map",
 482                                       "put",
 483                                       "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;",
 484                                       new byte[] {(byte) Opcodes.INVOKEINTERFACE}),
 485                     new TestedCPEntry("java/util/Map",
 486                                       "remove",
 487                                       "(Ljava/lang/Object;)Ljava/lang/Object;",
 488                                       new byte[] {(byte) Opcodes.INVOKEINTERFACE}),
 489                 }
 490         );
 491         CP_MAP_FOR_INTERFACE.put(CONSTANT_STRING,
 492                 new TestedCPEntry[] {
 493                     new TestedCPEntry(null, "Hello", null),
 494                     new TestedCPEntry(null, "", null),
 495                 }
 496         );
 497         CP_MAP_FOR_INTERFACE.put(CONSTANT_METHODHANDLE,
 498                 new TestedCPEntry[] {
 499                     new TestedCPEntry("java/lang/invoke/LambdaMetafactory",
 500                                       "metafactory",
 501                                       "(Ljava/lang/invoke/MethodHandles$Lookup;"
 502                                               + "Ljava/lang/String;Ljava/lang/invoke/MethodType;"
 503                                               + "Ljava/lang/invoke/MethodType;"
 504                                               + "Ljava/lang/invoke/MethodHandle;"
 505                                               + "Ljava/lang/invoke/MethodType;)"
 506                                               + "Ljava/lang/invoke/CallSite;"),
 507                     new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementersInterface",
 508                                       "defaultMethod",
 509                                       "()V"),
 510                 }
 511         );
 512         CP_MAP_FOR_INTERFACE.put(CONSTANT_METHODTYPE,
 513                 new TestedCPEntry[] {
 514                     new TestedCPEntry(null, null, "()V"),
 515                 }
 516         );
 517         CP_MAP_FOR_INTERFACE.put(CONSTANT_INVOKEDYNAMIC,
 518                 new TestedCPEntry[] {
 519                     new TestedCPEntry(null,
 520                                       "run",
 521                                       "(Lcompiler/jvmci/common/testcases/MultipleImplementersInterface;)"
 522                                               + "Ljava/lang/Runnable;"),
 523                 }
 524         );
 525     }
 526 }