Mercurial > hg > truffle
changeset 17394:f520089af480
made HotSpotConstantPool.loadReferencedType handle attempts to resolve constant pool indexes that do not refer to a type
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Thu, 09 Oct 2014 15:57:36 +0200 |
parents | a8186c7f73e9 |
children | c8bd29658465 |
files | graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotConstantPool.java |
diffstat | 1 files changed, 15 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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() + ">"; + } }