# HG changeset patch # User iveresov # Date 1410468964 0 # Node ID a98dd542cd25a58c26f5d8adbe57f26d4145fc82 # Parent 64156d22e49d98199c2e8f4ec9133ee9be869dac# Parent 0d78074d2444aaa1a27b8034beb901762ef2cf8a Merge diff -r 0d78074d2444 -r a98dd542cd25 agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPool.java --- a/agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPool.java Wed Sep 10 19:08:17 2014 -0700 +++ b/agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPool.java Thu Sep 11 20:56:04 2014 +0000 @@ -152,7 +152,7 @@ private long indexOffset(long index) { if (Assert.ASSERTS_ENABLED) { - Assert.that(index > 0 && index < getLength(), "invalid cp index " + index + " " + getLength()); + Assert.that(index >= 0 && index < getLength(), "invalid cp index " + index + " " + getLength()); } return (index * getElementSize()) + headerSize; } diff -r 0d78074d2444 -r a98dd542cd25 agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ByteCodeRewriter.java --- a/agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ByteCodeRewriter.java Wed Sep 10 19:08:17 2014 -0700 +++ b/agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ByteCodeRewriter.java Thu Sep 11 20:56:04 2014 +0000 @@ -98,11 +98,14 @@ break; default: throw new IllegalArgumentException(); } + if (cpCache == null) { return (short) cpCacheIndex; } else if (fmt.indexOf("JJJJ") >= 0) { - // change byte-ordering and go via secondary cache entry - throw new InternalError("unimplemented"); + // Invokedynamic require special handling + cpCacheIndex = ~cpCacheIndex; + cpCacheIndex = bytes.swapInt(cpCacheIndex); + return (short) cpCache.getEntryAt(cpCacheIndex).getConstantPoolIndex(); } else if (fmt.indexOf("JJ") >= 0) { // change byte-ordering and go via cache return (short) cpCache.getEntryAt((int) (0xFFFF & bytes.swapShort((short)cpCacheIndex))).getConstantPoolIndex();