public class Instruction extends java.lang.Object implements Opcode
IncOperand,
Switch,
MultiArrayOperandopc_aaload, opc_aastore, opc_aconst_null, opc_aload, opc_aload_0, opc_aload_1, opc_aload_2, opc_aload_3, opc_anewarray, opc_areturn, opc_arraylength, opc_astore, opc_astore_0, opc_astore_1, opc_astore_2, opc_astore_3, opc_aswizzle, opc_aswrange, opc_athrow, opc_aupdate, opc_baload, opc_bastore, opc_bipush, opc_breakpoint, opc_caload, opc_castore, opc_checkcast, opc_d2f, opc_d2i, opc_d2l, opc_dadd, opc_daload, opc_dastore, opc_dcmpg, opc_dcmpl, opc_dconst_0, opc_dconst_1, opc_ddiv, opc_dload, opc_dload_0, opc_dload_1, opc_dload_2, opc_dload_3, opc_dmul, opc_dneg, opc_drem, opc_dreturn, opc_dstore, opc_dstore_0, opc_dstore_1, opc_dstore_2, opc_dstore_3, opc_dsub, opc_dup, opc_dup_x1, opc_dup_x2, opc_dup2, opc_dup2_x1, opc_dup2_x2, opc_f2d, opc_f2i, opc_f2l, opc_fadd, opc_faload, opc_fastore, opc_fcmpg, opc_fcmpl, opc_fconst_0, opc_fconst_1, opc_fconst_2, opc_fdiv, opc_fload, opc_fload_0, opc_fload_1, opc_fload_2, opc_fload_3, opc_fmul, opc_fneg, opc_frem, opc_freturn, opc_fstore, opc_fstore_0, opc_fstore_1, opc_fstore_2, opc_fstore_3, opc_fsub, opc_getfield, opc_getstatic, opc_goto, opc_goto_w, opc_i2b, opc_i2c, opc_i2d, opc_i2f, opc_i2l, opc_i2s, opc_iadd, opc_iaload, opc_iand, opc_iastore, opc_iconst_0, opc_iconst_1, opc_iconst_2, opc_iconst_3, opc_iconst_4, opc_iconst_5, opc_iconst_m1, opc_idiv, opc_if_acmpeq, opc_if_acmpne, opc_if_icmpeq, opc_if_icmpge, opc_if_icmpgt, opc_if_icmple, opc_if_icmplt, opc_if_icmpne, opc_ifeq, opc_ifge, opc_ifgt, opc_ifle, opc_iflt, opc_ifne, opc_ifnonnull, opc_ifnull, opc_iinc, opc_iload, opc_iload_0, opc_iload_1, opc_iload_2, opc_iload_3, opc_imul, opc_ineg, opc_instanceof, opc_invokeinterface, opc_invokespecial, opc_invokestatic, opc_invokevirtual, opc_ior, opc_irem, opc_ireturn, opc_ishl, opc_ishr, opc_istore, opc_istore_0, opc_istore_1, opc_istore_2, opc_istore_3, opc_isub, opc_iushr, opc_ixor, opc_jsr, opc_jsr_w, opc_l2d, opc_l2f, opc_l2i, opc_ladd, opc_laload, opc_land, opc_lastore, opc_lcmp, opc_lconst_0, opc_lconst_1, opc_ldc, opc_ldc_w, opc_ldc2_w, opc_ldiv, opc_lload, opc_lload_0, opc_lload_1, opc_lload_2, opc_lload_3, opc_lmul, opc_lneg, opc_lookupswitch, opc_lor, opc_lrem, opc_lreturn, opc_lshl, opc_lshr, opc_lstore, opc_lstore_0, opc_lstore_1, opc_lstore_2, opc_lstore_3, opc_lsub, opc_lushr, opc_lxor, opc_monitorenter, opc_monitorexit, opc_multianewarray, opc_new, opc_newarray, opc_nop, opc_pop, opc_pop2, opc_putfield, opc_putfield_nowb, opc_putstatic, opc_putstatic_nowb, opc_rc, opc_ret, opc_return, opc_saload, opc_sastore, opc_sipush, opc_supdate, opc_swap, opc_tableswitch, opc_wide, opc_xxxunusedxxx, opcNames, opcSize, opcx_aaload, opcx_aastore, opcx_aload, opcx_areturn, opcx_arraylength, opcx_astore, opcx_aswizzle, opcx_aswrange, opcx_athrow, opcx_aupdate, opcx_baload, opcx_bastore, opcx_caload, opcx_castore, opcx_checkcast, opcx_d2f, opcx_d2i, opcx_d2l, opcx_dadd, opcx_daload, opcx_dastore, opcx_dcmpg, opcx_dcmpl, opcx_ddiv, opcx_dload, opcx_dmul, opcx_dneg, opcx_drem, opcx_dreturn, opcx_dstore, opcx_dsub, opcx_dup, opcx_dup_x1, opcx_dup_x2, opcx_dup2, opcx_dup2_x1, opcx_dup2_x2, opcx_f2d, opcx_f2i, opcx_f2l, opcx_fadd, opcx_faload, opcx_fastore, opcx_fcmpg, opcx_fcmpl, opcx_fdiv, opcx_fload, opcx_fmul, opcx_fneg, opcx_frem, opcx_freturn, opcx_fstore, opcx_fsub, opcx_getfield, opcx_getstatic, opcx_goto, opcx_i2b, opcx_i2c, opcx_i2d, opcx_i2f, opcx_i2l, opcx_i2s, opcx_iadd, opcx_iaload, opcx_iand, opcx_iastore, opcx_idiv, opcx_if_acmpeq, opcx_if_acmpne, opcx_if_icmpeq, opcx_if_icmpge, opcx_if_icmpgt, opcx_if_icmple, opcx_if_icmplt, opcx_if_icmpne, opcx_ifeq, opcx_ifge, opcx_ifgt, opcx_ifle, opcx_iflt, opcx_ifne, opcx_ifnonnull, opcx_ifnull, opcx_iinc, opcx_iload, opcx_imul, opcx_ineg, opcx_instanceof, opcx_invokeinterface, opcx_invokespecial, opcx_invokestatic, opcx_invokevirtual, opcx_ior, opcx_irem, opcx_ireturn, opcx_ishl, opcx_ishr, opcx_istore, opcx_isub, opcx_iushr, opcx_ixor, opcx_jsr, opcx_l2d, opcx_l2f, opcx_l2i, opcx_ladd, opcx_laload, opcx_land, opcx_lastore, opcx_lcmp, opcx_ldc, opcx_ldiv, opcx_lload, opcx_lmul, opcx_lneg, opcx_lor, opcx_lrem, opcx_lreturn, opcx_lshl, opcx_lshr, opcx_lstore, opcx_lsub, opcx_lushr, opcx_lxor, opcx_monitorenter, opcx_monitorexit, opcx_multianewarray, opcx_new, opcx_newarray, opcx_nop, opcx_pop, opcx_pop2, opcx_putfield, opcx_putfield_nowb, opcx_putstatic, opcx_putstatic_nowb, opcx_rc, opcx_ret, opcx_return, opcx_saload, opcx_sastore, opcx_supdate, opcx_swap, opcx_switch, opcXMap, VARIABLE| Constructor and Description |
|---|
Instruction(byte[] code,
int index,
int[] targets,
int[] lookups,
LocalVariable[] locals,
ConstantPool constants)
Constructor.
|
Instruction(int opcode)
Constructor.
|
Instruction(int opcode,
java.lang.Object operand)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
int |
category()
Returns the category of this instruction.
|
boolean |
isConditionalJump()
Check if the instruction is a conditional jump.
|
boolean |
isGoto()
Check if the instruction is a goto.
|
boolean |
isInc()
Check if the instruction is an increment.
|
boolean |
isInvoke()
Returns true if this instruction invokes a method.
|
boolean |
isJsr()
Check if the instruction is a jsr.
|
boolean |
isJump()
Check if the instruction is a jump.
|
boolean |
isLoad()
Check if the instruction is a load.
|
boolean |
isRet()
Check if the instruction is a subroutine return instruction.
|
boolean |
isReturn()
Returns true if the instruction returns from a method.
|
boolean |
isStore()
Check if the instruction is a store.
|
boolean |
isSwitch()
Check if the instruction is a switch.
|
boolean |
isThrow()
Check if the instruction is an exception throw instruction.
|
int |
opcodeClass()
Get the opcode class of the instruction.
|
java.lang.Object |
operand()
Get the operand of the instruction.
|
int |
origOpcode()
Returns the original (non-mapped) opcode used to create this Instruction.
|
void |
setOpcodeClass(int opcode)
Set the opcode class of the instruction.
|
void |
setOperand(java.lang.Object operand)
Set the operand of the instruction.
|
void |
setUseSlow(boolean useSlow)
Sets a flag that determines whether or not the "slow" version of the
instruction should be generated.
|
protected static int |
toInt(byte b1,
byte b2,
byte b3,
byte b4)
Utility function to join 4 bytes into an signed int.
|
protected static short |
toShort(byte b1,
byte b2)
Utility function to join 2 bytes into an signed short.
|
java.lang.String |
toString()
Convert the instruction to a string.
|
protected static int |
toUByte(byte b)
Utility function to convert a byte into an unsigned byte.
|
protected static int |
toUShort(byte b1,
byte b2)
Utility function to join 2 bytes into an unsigned short.
|
boolean |
useSlow()
Returns whether or not the "slow" version of this instruction is
generated.
|
void |
visit(InstructionVisitor visitor)
Big switch statement to call the appropriate method of an instruction
visitor.
|
public Instruction(int opcode)
opcode - The opcode class of the instruction.public Instruction(int opcode,
java.lang.Object operand)
opcode - The opcode class of the instruction.operand - The operand of the instruction, or null.public Instruction(byte[] code,
int index,
int[] targets,
int[] lookups,
LocalVariable[] locals,
ConstantPool constants)
code - The raw byte code array of the method.index - This index into the byte array of the instruction.targets - Indices of the branch targets of the instruction.lookups - Values of the switch lookups of the instruction.locals - The local variables defined at this index.constants - The constant pool for the class.public int origOpcode()
public void setUseSlow(boolean useSlow)
public boolean useSlow()
public boolean isLoad()
public boolean isStore()
public boolean isInc()
public boolean isThrow()
public boolean isInvoke()
public boolean isRet()
public boolean isReturn()
public boolean isSwitch()
public boolean isJump()
public boolean isJsr()
public boolean isGoto()
public boolean isConditionalJump()
public int opcodeClass()
public void setOpcodeClass(int opcode)
opcode - The opcode class of the instruction.public void setOperand(java.lang.Object operand)
operand - The operand of the instruction.public java.lang.Object operand()
public java.lang.String toString()
toString in class java.lang.Objectprotected static int toUShort(byte b1,
byte b2)
b1 - The upper byte.b2 - The lower byte.protected static short toShort(byte b1,
byte b2)
b1 - The upper byte.b2 - The lower byte.protected static int toInt(byte b1,
byte b2,
byte b3,
byte b4)
b1 - The upper byte.b2 - The next-to-upper byte.b3 - The next-to-lower byte.b4 - The lower byte.protected static int toUByte(byte b)
b - The byte.public int category()
public void visit(InstructionVisitor visitor)
visitor - The instruction visitor.