hotspot/agent/src/share/classes/sun/jvm/hotspot/interpreter/Bytecode.java
changeset 10251 71b8938a2821
parent 5547 f4b087cbb361
equal deleted inserted replaced
10250:0794cd144834 10251:71b8938a2821
    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   }