agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPool.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File
*** old/agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPool.java	Fri Jul  8 15:22:39 2011
--- new/agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPool.java	Fri Jul  8 15:22:39 2011

*** 210,228 **** --- 210,275 ---- } return new int[] { extractLowShortFromInt(i), extractHighShortFromInt(i) }; } public Symbol getNameRefAt(int which) { ! int nameIndex = getNameAndTypeAt(getNameAndTypeRefIndexAt(which))[0]; return getSymbolAt(nameIndex); ! return implGetNameRefAt(which, false); } + private Symbol implGetNameRefAt(int which, boolean uncached) { + int signatureIndex = getNameRefIndexAt(implNameAndTypeRefIndexAt(which, uncached)); + return getSymbolAt(signatureIndex); + } + public Symbol getSignatureRefAt(int which) { ! int sigIndex = getNameAndTypeAt(getNameAndTypeRefIndexAt(which))[1]; return getSymbolAt(sigIndex); ! return implGetSignatureRefAt(which, false); } + private Symbol implGetSignatureRefAt(int which, boolean uncached) { + int signatureIndex = getSignatureRefIndexAt(implNameAndTypeRefIndexAt(which, uncached)); + return getSymbolAt(signatureIndex); + } + + + private int implNameAndTypeRefIndexAt(int which, boolean uncached) { + int i = which; + if (!uncached && getCache() != null) { + if (ConstantPoolCache.isSecondaryIndex(which)) { + // Invokedynamic index. + int pool_index = getCache().getMainEntryAt(which).getConstantPoolIndex(); + pool_index = invokeDynamicNameAndTypeRefIndexAt(pool_index); + // assert(tagAt(pool_index).isNameAndType(), ""); + return pool_index; + } + // change byte-ordering and go via cache + i = remapInstructionOperandFromCache(which); + } else { + if (getTagAt(which).isInvokeDynamic()) { + int pool_index = invokeDynamicNameAndTypeRefIndexAt(which); + // assert(tag_at(pool_index).is_name_and_type(), ""); + return pool_index; + } + } + // assert(tag_at(i).is_field_or_method(), "Corrupted constant pool"); + // assert(!tag_at(i).is_invoke_dynamic(), "Must be handled above"); + int ref_index = getIntAt(i); + return extractHighShortFromInt(ref_index); + } + + private int remapInstructionOperandFromCache(int operand) { + int cpc_index = operand; + // DEBUG_ONLY(cpc_index -= CPCACHE_INDEX_TAG); + // assert((int)(u2)cpc_index == cpc_index, "clean u2"); + int member_index = getCache().getEntryAt(cpc_index).getConstantPoolIndex(); + return member_index; + } + + int invokeDynamicNameAndTypeRefIndexAt(int which) { + // assert(tag_at(which).is_invoke_dynamic(), "Corrupted constant pool"); + return extractHighShortFromInt(getIntAt(which)); + } + // returns null, if not resolved. public Klass getKlassRefAt(int which) { if( ! getTagAt(which).isKlass()) return null; return (Klass) getObjAtRaw(which); }
*** 251,270 **** --- 298,309 ---- Symbol sig = getSignatureRefAt(which); return klass.findField(name, sig); } public int getNameAndTypeRefIndexAt(int index) { ! int refIndex = getFieldOrMethodAt(index); if (DEBUG) { System.err.println("ConstantPool.getNameAndTypeRefIndexAt(" + index + "): refIndex = " + refIndex); ! return implNameAndTypeRefIndexAt(index, false); } int i = extractHighShortFromInt(refIndex); if (DEBUG) { System.err.println("ConstantPool.getNameAndTypeRefIndexAt(" + index + "): result = " + i); } return i; } /** Lookup for entries consisting of (name_index, signature_index) */ public int getNameRefIndexAt(int index) { int[] refIndex = getNameAndTypeAt(index); if (DEBUG) {

agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPool.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File