comparison agent/src/share/classes/sun/jvm/hotspot/interpreter/Bytecode.java @ 3838:6a991dcb52bb

7012081: JSR 292: SA-JDI can't read MH/MT/Indy ConstantPool entries Reviewed-by: kvn, twisti, jrose
author never
date Thu, 21 Jul 2011 08:38:25 -0700
parents c18cbe5936b8
children
comparison
equal deleted inserted replaced
3837:43f9d800f276 3838:6a991dcb52bb
24 24
25 package sun.jvm.hotspot.interpreter; 25 package sun.jvm.hotspot.interpreter;
26 26
27 import sun.jvm.hotspot.oops.*; 27 import sun.jvm.hotspot.oops.*;
28 import sun.jvm.hotspot.utilities.*; 28 import sun.jvm.hotspot.utilities.*;
29 import sun.jvm.hotspot.runtime.VM;
29 30
30 public class Bytecode { 31 public class Bytecode {
31 Method method; 32 Method method;
32 int bci; 33 int bci;
33 static final int jintSize = 4; 34 static final int jintSize = 4;
41 42
42 // Address computation 43 // Address computation
43 // NOTE: assumes that the start of the method's bytecodes is 4-byte aligned 44 // NOTE: assumes that the start of the method's bytecodes is 4-byte aligned
44 int alignedOffset(int offset) { 45 int alignedOffset(int offset) {
45 return Bits.roundTo(bci + offset, jintSize) - bci; 46 return Bits.roundTo(bci + offset, jintSize) - bci;
47 }
48
49 public int getIndexU1() { return method.getBytecodeOrBPAt(bci() + 1) & 0xFF; }
50 public int getIndexU2(int bc, boolean isWide) {
51 if (can_use_native_byte_order(bc, isWide)) {
52 return method.getNativeShortArg(bci() + (isWide ? 2 : 1)) & 0xFFFF;
53 }
54 return method.getBytecodeShortArg(bci() + (isWide ? 2 : 1)) & 0xFFFF;
55 }
56 public int getIndexU4() { return method.getNativeIntArg(bci() + 1); }
57 public boolean hasIndexU4() { return code() == Bytecodes._invokedynamic; }
58
59 public int getIndexU1Cpcache() { return method.getBytecodeOrBPAt(bci() + 1) & 0xFF; }
60 public int getIndexU2Cpcache() { return method.getNativeShortArg(bci() + 1) & 0xFFFF; }
61
62 static boolean can_use_native_byte_order(int bc, boolean is_wide) {
63 return (VM.getVM().isBigEndian() || Bytecodes.native_byte_order(bc /*, is_wide*/));
46 } 64 }
47 65
48 int javaSignedWordAt(int offset) { 66 int javaSignedWordAt(int offset) {
49 return method.getBytecodeIntArg(bci + offset); 67 return method.getBytecodeIntArg(bci + offset);
50 } 68 }