diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotConstantPool.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotConstantPool.java index d4bb97f03c4..1d32211f1a0 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotConstantPool.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotConstantPool.java @@ -719,7 +719,15 @@ private static JavaType getJavaType(final Object type) { @Override public JavaMethod lookupMethod(int rawIndex, int opcode, ResolvedJavaMethod caller) { - final int cpci = rawIndexToConstantPoolCacheIndex(rawIndex, opcode); + final int cpci; + if (opcode == jdk.vm.ci.hotspot.HotSpotConstantPool.Bytecodes.INVOKEDYNAMIC) { + if (!isInvokedynamicIndex(rawIndex)) { + throw new IllegalArgumentException("expected a raw index for INVOKEDYNAMIC but got " + rawIndex); + } + cpci = rawIndex; + } else { + cpci = rawIndexToConstantPoolCacheIndex(rawIndex, opcode); + } final HotSpotResolvedJavaMethod method = compilerToVM().lookupMethodInPool(this, cpci, (byte) opcode, (HotSpotResolvedJavaMethodImpl) caller); if (method != null) { return method;