Thu, 11 Sep 2014 11:55:30 -0700
8032247: SA: Constantpool lookup for invokedynamic is not implemented
Summary: implement constant pool lookup for invokedynamic
Reviewed-by: sla, sspitsyn
1.1 --- a/agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPool.java Thu Sep 11 15:41:43 2014 +0000 1.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPool.java Thu Sep 11 11:55:30 2014 -0700 1.3 @@ -152,7 +152,7 @@ 1.4 1.5 private long indexOffset(long index) { 1.6 if (Assert.ASSERTS_ENABLED) { 1.7 - Assert.that(index > 0 && index < getLength(), "invalid cp index " + index + " " + getLength()); 1.8 + Assert.that(index >= 0 && index < getLength(), "invalid cp index " + index + " " + getLength()); 1.9 } 1.10 return (index * getElementSize()) + headerSize; 1.11 }
2.1 --- a/agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ByteCodeRewriter.java Thu Sep 11 15:41:43 2014 +0000 2.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ByteCodeRewriter.java Thu Sep 11 11:55:30 2014 -0700 2.3 @@ -98,11 +98,14 @@ 2.4 break; 2.5 default: throw new IllegalArgumentException(); 2.6 } 2.7 + 2.8 if (cpCache == null) { 2.9 return (short) cpCacheIndex; 2.10 } else if (fmt.indexOf("JJJJ") >= 0) { 2.11 - // change byte-ordering and go via secondary cache entry 2.12 - throw new InternalError("unimplemented"); 2.13 + // Invokedynamic require special handling 2.14 + cpCacheIndex = ~cpCacheIndex; 2.15 + cpCacheIndex = bytes.swapInt(cpCacheIndex); 2.16 + return (short) cpCache.getEntryAt(cpCacheIndex).getConstantPoolIndex(); 2.17 } else if (fmt.indexOf("JJ") >= 0) { 2.18 // change byte-ordering and go via cache 2.19 return (short) cpCache.getEntryAt((int) (0xFFFF & bytes.swapShort((short)cpCacheIndex))).getConstantPoolIndex();