Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8314248

Remove HotSpotConstantPool::isResolvedDynamicInvoke

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 22
    • 22
    • hotspot
    • b11

      This function is not in the JVMCI ConstantPool API. It's not tested at all inside the JDK repo. It's not used by graal.

      https://github.com/openjdk/jdk/blob/37c6b23f5b82311c82f5fe981f104824f87e3e54/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotConstantPool.java#L962

      It's implementation is wrong:

          /**
           * Check for a resolved dynamic adapter method at the specified index, resulting from either a
           * resolved invokedynamic or invokevirtual on a signature polymorphic MethodHandle method
           * (HotSpot invokehandle).
           *
           * @param cpi the constant pool index
           * @param opcode the opcode of the instruction for which the lookup is being performed
           * @return {@code true} if a signature polymorphic method reference was found, otherwise
           * {@code false}
           */
          public boolean isResolvedDynamicInvoke(int cpi, int opcode) {
              if (Bytecodes.isInvokeHandleAlias(opcode)) {
                  final int methodRefCacheIndex = rawIndexToConstantPoolCacheIndex(cpi, opcode);
                  checkTag(compilerToVM().constantPoolRemapInstructionOperandFromCache(this, methodRefCacheIndex), constants.jvmMethodref);
                  int op = compilerToVM().isResolvedInvokeHandleInPool(this, methodRefCacheIndex);
                  return op == opcode;
              }
              return false;
          }

      If the opcode is invokedynamic, it won't be associated with any cpcache entry, so you can't find a valid methodRefCacheIndex for it.

      Thus this code should be removed.

            iklam Ioi Lam
            iklam Ioi Lam
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: