public class ConstantInstruction extends Instruction implements ConstantVisitor
Instruction represents an instruction that refers to an entry in the
constant pool.| Modifier and Type | Field and Description |
|---|---|
int |
constant |
int |
constantIndex |
ARRAY_T_BOOLEAN, ARRAY_T_BYTE, ARRAY_T_CHAR, ARRAY_T_DOUBLE, ARRAY_T_FLOAT, ARRAY_T_INT, ARRAY_T_LONG, ARRAY_T_SHORT, NAMES, OP_AALOAD, OP_AASTORE, OP_ACONST_NULL, OP_ALOAD, OP_ALOAD_0, OP_ALOAD_1, OP_ALOAD_2, OP_ALOAD_3, OP_ANEWARRAY, OP_ARETURN, OP_ARRAYLENGTH, OP_ASTORE, OP_ASTORE_0, OP_ASTORE_1, OP_ASTORE_2, OP_ASTORE_3, OP_ATHROW, OP_BALOAD, OP_BASTORE, OP_BIPUSH, OP_CALOAD, OP_CASTORE, OP_CHECKCAST, OP_D2F, OP_D2I, OP_D2L, OP_DADD, OP_DALOAD, OP_DASTORE, OP_DCMPG, OP_DCMPL, OP_DCONST_0, OP_DCONST_1, OP_DDIV, OP_DLOAD, OP_DLOAD_0, OP_DLOAD_1, OP_DLOAD_2, OP_DLOAD_3, OP_DMUL, OP_DNEG, OP_DREM, OP_DRETURN, OP_DSTORE, OP_DSTORE_0, OP_DSTORE_1, OP_DSTORE_2, OP_DSTORE_3, OP_DSUB, OP_DUP, OP_DUP_X1, OP_DUP_X2, OP_DUP2, OP_DUP2_X1, OP_DUP2_X2, OP_F2D, OP_F2I, OP_F2L, OP_FADD, OP_FALOAD, OP_FASTORE, OP_FCMPG, OP_FCMPL, OP_FCONST_0, OP_FCONST_1, OP_FCONST_2, OP_FDIV, OP_FLOAD, OP_FLOAD_0, OP_FLOAD_1, OP_FLOAD_2, OP_FLOAD_3, OP_FMUL, OP_FNEG, OP_FREM, OP_FRETURN, OP_FSTORE, OP_FSTORE_0, OP_FSTORE_1, OP_FSTORE_2, OP_FSTORE_3, OP_FSUB, OP_GETFIELD, OP_GETSTATIC, OP_GOTO, OP_GOTO_W, OP_I2B, OP_I2C, OP_I2D, OP_I2F, OP_I2L, OP_I2S, OP_IADD, OP_IALOAD, OP_IAND, OP_IASTORE, OP_ICONST_0, OP_ICONST_1, OP_ICONST_2, OP_ICONST_3, OP_ICONST_4, OP_ICONST_5, OP_ICONST_M1, OP_IDIV, OP_IFACMPEQ, OP_IFACMPNE, OP_IFEQ, OP_IFGE, OP_IFGT, OP_IFICMPEQ, OP_IFICMPGE, OP_IFICMPGT, OP_IFICMPLE, OP_IFICMPLT, OP_IFICMPNE, OP_IFLE, OP_IFLT, OP_IFNE, OP_IFNONNULL, OP_IFNULL, OP_IINC, OP_ILOAD, OP_ILOAD_0, OP_ILOAD_1, OP_ILOAD_2, OP_ILOAD_3, OP_IMUL, OP_INEG, OP_INSTANCEOF, OP_INVOKEDYNAMIC, OP_INVOKEINTERFACE, OP_INVOKESPECIAL, OP_INVOKESTATIC, OP_INVOKEVIRTUAL, OP_IOR, OP_IREM, OP_IRETURN, OP_ISHL, OP_ISHR, OP_ISTORE, OP_ISTORE_0, OP_ISTORE_1, OP_ISTORE_2, OP_ISTORE_3, OP_ISUB, OP_IUSHR, OP_IXOR, OP_JSR, OP_JSR_W, OP_L2D, OP_L2F, OP_L2I, OP_LADD, OP_LALOAD, OP_LAND, OP_LASTORE, OP_LCMP, OP_LCONST_0, OP_LCONST_1, OP_LDC, OP_LDC_W, OP_LDC2_W, OP_LDIV, OP_LLOAD, OP_LLOAD_0, OP_LLOAD_1, OP_LLOAD_2, OP_LLOAD_3, OP_LMUL, OP_LNEG, OP_LOOKUPSWITCH, OP_LOR, OP_LREM, OP_LRETURN, OP_LSHL, OP_LSHR, OP_LSTORE, OP_LSTORE_0, OP_LSTORE_1, OP_LSTORE_2, OP_LSTORE_3, OP_LSUB, OP_LUSHR, OP_LXOR, OP_MONITORENTER, OP_MONITOREXIT, OP_MULTIANEWARRAY, OP_NEW, OP_NEWARRAY, OP_NOP, OP_POP, OP_POP2, OP_PUTFIELD, OP_PUTSTATIC, OP_RET, OP_RETURN, OP_SALOAD, OP_SASTORE, OP_SIPUSH, OP_SWAP, OP_TABLESWITCH, OP_WIDE, opcode| Constructor and Description |
|---|
ConstantInstruction()
Creates an uninitialized ConstantInstruction.
|
ConstantInstruction(byte opcode,
int constantIndex)
Creates a new ConstantInstruction with the given opcode and constant pool
index.
|
ConstantInstruction(byte opcode,
int constantIndex,
int constant)
Creates a new ConstantInstruction with the given opcode, constant pool
index, and constant.
|
| Modifier and Type | Method and Description |
|---|---|
void |
accept(Clazz clazz,
Method method,
CodeAttribute codeAttribute,
int offset,
InstructionVisitor instructionVisitor)
Accepts the given visitor.
|
byte |
canonicalOpcode()
Returns the canonical opcode of this instruction, i.e.
|
ConstantInstruction |
copy(ConstantInstruction constantInstruction)
Copies the given instruction into this instruction.
|
boolean |
equals(java.lang.Object o) |
int |
hashCode() |
int |
length(int offset)
Returns the length in bytes of the instruction.
|
boolean |
mayInstanceThrowExceptions(Clazz clazz)
Returns whether a particular instance of an instruction may throw
an exception.
|
protected void |
readInfo(byte[] code,
int offset)
Reads the data following the instruction opcode.
|
Instruction |
shrink()
Shrinks this instruction to its shortest possible form.
|
int |
stackPopCount(Clazz clazz)
Returns the number of entries popped from the stack during the execution
of the instruction.
|
int |
stackPushCount(Clazz clazz)
Returns the number of entries pushed onto the stack during the execution
of the instruction.
|
java.lang.String |
toString() |
java.lang.String |
toString(Clazz clazz,
int offset)
Returns a description of the instruction, at the given offset.
|
void |
visitClassConstant(Clazz clazz,
ClassConstant classConstant) |
void |
visitDoubleConstant(Clazz clazz,
DoubleConstant doubleConstant) |
void |
visitDynamicConstant(Clazz clazz,
DynamicConstant dynamicConstant) |
void |
visitFieldrefConstant(Clazz clazz,
FieldrefConstant fieldrefConstant) |
void |
visitFloatConstant(Clazz clazz,
FloatConstant floatConstant) |
void |
visitIntegerConstant(Clazz clazz,
IntegerConstant integerConstant) |
void |
visitInterfaceMethodrefConstant(Clazz clazz,
InterfaceMethodrefConstant interfaceMethodrefConstant) |
void |
visitInvokeDynamicConstant(Clazz clazz,
InvokeDynamicConstant invokeDynamicConstant) |
void |
visitLongConstant(Clazz clazz,
LongConstant longConstant) |
void |
visitMethodHandleConstant(Clazz clazz,
MethodHandleConstant methodHandleConstant) |
void |
visitMethodrefConstant(Clazz clazz,
MethodrefConstant methodrefConstant) |
void |
visitMethodTypeConstant(Clazz clazz,
MethodTypeConstant methodTypeConstant) |
void |
visitModuleConstant(Clazz clazz,
ModuleConstant moduleConstant) |
void |
visitNameAndTypeConstant(Clazz clazz,
NameAndTypeConstant nameAndTypeConstant) |
void |
visitPackageConstant(Clazz clazz,
PackageConstant packageConstant) |
void |
visitPrimitiveArrayConstant(Clazz clazz,
PrimitiveArrayConstant primitiveArrayConstant) |
void |
visitStringConstant(Clazz clazz,
StringConstant stringConstant) |
void |
visitUtf8Constant(Clazz clazz,
Utf8Constant utf8Constant) |
protected void |
writeInfo(byte[] code,
int offset)
Writes data following the instruction opcode.
|
actualOpcode, getName, isCategory2, isWide, mayThrowExceptions, readByte, readInt, readShort, readSignedByte, readSignedShort, readSignedValue, readValue, stackEntryIndexBefore, toString, write, write, writeByte, writeInt, writeShort, writeSignedByte, writeSignedShort, writeSignedValue, writeValueclone, finalize, getClass, notify, notifyAll, wait, wait, waitvisitAnyConstant, visitAnyMethodrefConstant, visitAnyRefConstantpublic ConstantInstruction()
public ConstantInstruction(byte opcode,
int constantIndex)
public ConstantInstruction(byte opcode,
int constantIndex,
int constant)
public ConstantInstruction copy(ConstantInstruction constantInstruction)
constantInstruction - the instruction to be copied.public boolean mayInstanceThrowExceptions(Clazz clazz)
mayInstanceThrowExceptions in class Instructionpublic byte canonicalOpcode()
InstructioncanonicalOpcode in class Instructionpublic Instruction shrink()
Instructionshrink in class Instructionprotected void readInfo(byte[] code,
int offset)
InstructionreadInfo in class Instructionprotected void writeInfo(byte[] code,
int offset)
InstructionwriteInfo in class Instructionpublic int length(int offset)
Instructionlength in class Instructionpublic void accept(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, InstructionVisitor instructionVisitor)
Instructionaccept in class Instructionpublic java.lang.String toString(Clazz clazz, int offset)
InstructiontoString in class Instructionpublic int stackPopCount(Clazz clazz)
InstructionstackPopCount in class Instructionpublic int stackPushCount(Clazz clazz)
InstructionstackPushCount in class Instructionpublic void visitIntegerConstant(Clazz clazz, IntegerConstant integerConstant)
visitIntegerConstant in interface ConstantVisitorpublic void visitLongConstant(Clazz clazz, LongConstant longConstant)
visitLongConstant in interface ConstantVisitorpublic void visitFloatConstant(Clazz clazz, FloatConstant floatConstant)
visitFloatConstant in interface ConstantVisitorpublic void visitDoubleConstant(Clazz clazz, DoubleConstant doubleConstant)
visitDoubleConstant in interface ConstantVisitorpublic void visitPrimitiveArrayConstant(Clazz clazz, PrimitiveArrayConstant primitiveArrayConstant)
visitPrimitiveArrayConstant in interface ConstantVisitorpublic void visitStringConstant(Clazz clazz, StringConstant stringConstant)
visitStringConstant in interface ConstantVisitorpublic void visitUtf8Constant(Clazz clazz, Utf8Constant utf8Constant)
visitUtf8Constant in interface ConstantVisitorpublic void visitMethodHandleConstant(Clazz clazz, MethodHandleConstant methodHandleConstant)
visitMethodHandleConstant in interface ConstantVisitorpublic void visitClassConstant(Clazz clazz, ClassConstant classConstant)
visitClassConstant in interface ConstantVisitorpublic void visitMethodTypeConstant(Clazz clazz, MethodTypeConstant methodTypeConstant)
visitMethodTypeConstant in interface ConstantVisitorpublic void visitModuleConstant(Clazz clazz, ModuleConstant moduleConstant)
visitModuleConstant in interface ConstantVisitorpublic void visitPackageConstant(Clazz clazz, PackageConstant packageConstant)
visitPackageConstant in interface ConstantVisitorpublic void visitFieldrefConstant(Clazz clazz, FieldrefConstant fieldrefConstant)
visitFieldrefConstant in interface ConstantVisitorpublic void visitDynamicConstant(Clazz clazz, DynamicConstant dynamicConstant)
visitDynamicConstant in interface ConstantVisitorpublic void visitInvokeDynamicConstant(Clazz clazz, InvokeDynamicConstant invokeDynamicConstant)
visitInvokeDynamicConstant in interface ConstantVisitorpublic void visitInterfaceMethodrefConstant(Clazz clazz, InterfaceMethodrefConstant interfaceMethodrefConstant)
visitInterfaceMethodrefConstant in interface ConstantVisitorpublic void visitMethodrefConstant(Clazz clazz, MethodrefConstant methodrefConstant)
visitMethodrefConstant in interface ConstantVisitorpublic void visitNameAndTypeConstant(Clazz clazz, NameAndTypeConstant nameAndTypeConstant)
visitNameAndTypeConstant in interface ConstantVisitorpublic java.lang.String toString()
toString in class java.lang.Objectpublic boolean equals(java.lang.Object o)
equals in class Instructionpublic int hashCode()
hashCode in class Instruction