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

*** 25,58 **** --- 25,55 ---- package sun.jvm.hotspot.interpreter; import sun.jvm.hotspot.oops.*; import sun.jvm.hotspot.runtime.*; import sun.jvm.hotspot.utilities.*; + import sun.jvm.hotspot.ui.classbrowser.*; - public class BytecodeLoadConstant extends BytecodeWithCPIndex { BytecodeLoadConstant(Method method, int bci) { super(method, bci); } public boolean hasCacheIndex() { // normal ldc uses CP index, but fast_aldc uses swapped CP cache index ! return javaCode() != code(); ! return code() >= Bytecodes.number_of_java_codes; } ! public int index() { ! int i = javaCode() == Bytecodes._ldc ? (int) (0xFF & javaByteAt(1)) : (int) (0xFFFF & javaShortAt(1)); if (hasCacheIndex()) { return (0xFFFF & VM.getVM().getBytes().swapShort((short) i)); } else { return i; ! int rawIndex() { ! if (javaCode() == Bytecodes._ldc) + return getIndexU1(); + else + return getIndexU2(code(), false); } } public int poolIndex() { ! int i = index(); ! int i = rawIndex(); if (hasCacheIndex()) { ConstantPoolCache cpCache = method().getConstants().getCache(); return cpCache.getEntryAt(i).getConstantPoolIndex(); } else { return i;
*** 59,74 **** --- 56,77 ---- } } public int cacheIndex() { if (hasCacheIndex()) { ! return index(); ! return rawIndex(); } else { return -1; // no cache index } } + public BasicType resultType() { + int index = poolIndex(); + ConstantTag tag = method().getConstants().getTagAt(index); + return tag.basicType(); + } + private Oop getCachedConstant() { int i = cacheIndex(); if (i >= 0) { ConstantPoolCache cpCache = method().getConstants().getCache(); return cpCache.getEntryAt(i).getF1();
*** 81,104 **** --- 84,113 ---- Assert.that(isValid(), "check load constant"); } } public boolean isValid() { + method().printValueOn(System.out); + System.out.printf(" @ %d %d: %d", bci(), code(), hasCacheIndex() ? 1 : 0); + System.out.printf(" %d %d\n", poolIndex(), cacheIndex()); + int jcode = javaCode(); boolean codeOk = jcode == Bytecodes._ldc || jcode == Bytecodes._ldc_w || jcode == Bytecodes._ldc2_w; if (! codeOk) return false; ! ConstantTag ctag = method().getConstants().getTagAt(index()); ! ConstantTag ctag = method().getConstants().getTagAt(rawIndex()); + System.err.println(jcode + " " + ctag.value()); if (jcode == Bytecodes._ldc2_w) { // has to be double or long return (ctag.isDouble() || ctag.isLong()) ? true: false; } else { // has to be int or float or String or Klass return (ctag.isUnresolvedString() || ctag.isString() || ctag.isUnresolvedKlass() || ctag.isKlass() || ctag.isMethodHandle() || ctag.isMethodType() + || ctag.isMethod() || ctag.isInt() || ctag.isFloat())? true: false; } } public boolean isKlassConstant() {
*** 105,115 **** --- 114,124 ---- int jcode = javaCode(); if (jcode == Bytecodes._ldc2_w) { return false; } ! ConstantTag ctag = method().getConstants().getTagAt(index()); ! ConstantTag ctag = method().getConstants().getTagAt(poolIndex()); return ctag.isKlass() || ctag.isUnresolvedKlass(); } // return Symbol (if unresolved) or Klass (if resolved) public Object getKlass() {
*** 118,128 **** --- 127,137 ---- } // tag change from 'unresolved' to 'klass' does not happen atomically. // We just look at the object at the corresponding index and // decide based on the oop type. ConstantPool cpool = method().getConstants(); ! int cpIndex = index(); ! int cpIndex = poolIndex(); ConstantPool.CPSlot oop = cpool.getSlotAt(cpIndex); if (oop.isOop()) { return (Klass) oop.getOop(); } else if (oop.isMetaData()) { return oop.getSymbol();

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