# HG changeset patch # User Doug Simon # Date 1412863056 -7200 # Node ID f520089af480e0397304eba07143144e8d41fa1f # Parent a8186c7f73e992f10129395b054bef01dc8e66d8 made HotSpotConstantPool.loadReferencedType handle attempts to resolve constant pool indexes that do not refer to a type diff -r a8186c7f73e9 -r f520089af480 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotConstantPool.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotConstantPool.java Thu Oct 09 15:54:53 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotConstantPool.java Thu Oct 09 15:57:36 2014 +0200 @@ -198,6 +198,9 @@ HotSpotVMConfig config = runtime().getConfig(); final long metaspaceConstantPoolTags = unsafe.getAddress(metaspaceConstantPool + config.constantPoolTagsOffset); final int tag = unsafe.getByteVolatile(null, metaspaceConstantPoolTags + config.arrayU1DataOffset + index); + if (tag == 0) { + return null; + } return JVM_CONSTANT.getEnum(tag); } @@ -535,6 +538,10 @@ } JVM_CONSTANT tag = getTagAt(index); + if (tag == null) { + assert getTagAt(index - 1) == JVM_CONSTANT.Double || getTagAt(index - 1) == JVM_CONSTANT.Long; + return; + } switch (tag) { case Fieldref: case MethodRef: @@ -554,14 +561,19 @@ } break; case InvokeDynamic: - if (!isInvokedynamicIndex(cpi)) { - throw new IllegalArgumentException("InvokeDynamic entries must be accessed"); + if (isInvokedynamicIndex(cpi)) { + runtime().getCompilerToVM().resolveInvokeDynamic(metaspaceConstantPool, cpi); } - runtime().getCompilerToVM().resolveInvokeDynamic(metaspaceConstantPool, cpi); break; default: // nothing break; } } + + @Override + public String toString() { + HotSpotResolvedObjectType holder = getHolder(); + return "HotSpotConstantPool<" + holder.toJavaName() + ">"; + } }