Package proguard.classfile.instruction
Class SimpleInstruction
java.lang.Object
proguard.classfile.instruction.Instruction
proguard.classfile.instruction.SimpleInstruction
This
Instruction represents a simple instruction without variable arguments or constant
pool references.-
Field Summary
FieldsFields inherited from class proguard.classfile.instruction.Instruction
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 Summary
ConstructorsConstructorDescriptionCreates an uninitialized SimpleInstruction.SimpleInstruction(byte opcode) Creates a new SimpleInstruction with the given opcode.SimpleInstruction(byte opcode, int constant) Creates a new SimpleInstruction with the given opcode and constant. -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, InstructionVisitor instructionVisitor) Accepts the given visitor.byteReturns the canonical opcode of this instruction, i.e.copy(SimpleInstruction simpleInstruction) Copies the given instruction into this instruction.booleaninthashCode()intlength(int offset) Returns the length in bytes of the instruction.protected voidreadInfo(byte[] code, int offset) Reads the data following the instruction opcode.shrink()Shrinks this instruction to its shortest possible form.intstackEntryIndexBefore(Clazz clazz, int stackEntryIndexAfter) Returns the stack entry index from which the specified stack entry is copied by a dup/swap/checkcast instruction, or -1 otherwise.toString()protected voidwriteInfo(byte[] code, int offset) Writes data following the instruction opcode.Methods inherited from class proguard.classfile.instruction.Instruction
actualOpcode, getName, isCategory2, isWide, mayInstanceThrowExceptions, mayThrowExceptions, readByte, readInt, readShort, readSignedByte, readSignedShort, readSignedValue, readValue, stackPopCount, stackPushCount, toString, toString, write, write, writeByte, writeInt, writeShort, writeSignedByte, writeSignedShort, writeSignedValue, writeValue
-
Field Details
-
constant
public int constant
-
-
Constructor Details
-
SimpleInstruction
public SimpleInstruction()Creates an uninitialized SimpleInstruction. -
SimpleInstruction
public SimpleInstruction(byte opcode) Creates a new SimpleInstruction with the given opcode. Automatically extracts any embedded constant. -
SimpleInstruction
public SimpleInstruction(byte opcode, int constant) Creates a new SimpleInstruction with the given opcode and constant. Automatically adapts the opcode if it has an embedded constant and the constant lies within the supported range. If the constant doesn't lie within the supported range, it must be adapted before the instruction can be written out.
-
-
Method Details
-
copy
Copies the given instruction into this instruction.- Parameters:
simpleInstruction- the instruction to be copied.- Returns:
- this instruction.
-
canonicalOpcode
public byte canonicalOpcode()Description copied from class:InstructionReturns the canonical opcode of this instruction, i.e. typically the opcode whose extension has been removed.- Overrides:
canonicalOpcodein classInstruction
-
shrink
Description copied from class:InstructionShrinks this instruction to its shortest possible form.- Specified by:
shrinkin classInstruction- Returns:
- this instruction.
-
readInfo
protected void readInfo(byte[] code, int offset) Description copied from class:InstructionReads the data following the instruction opcode.- Specified by:
readInfoin classInstruction
-
writeInfo
protected void writeInfo(byte[] code, int offset) Description copied from class:InstructionWrites data following the instruction opcode.- Specified by:
writeInfoin classInstruction
-
length
public int length(int offset) Description copied from class:InstructionReturns the length in bytes of the instruction.- Specified by:
lengthin classInstruction
-
accept
public void accept(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, InstructionVisitor instructionVisitor) Description copied from class:InstructionAccepts the given visitor.- Specified by:
acceptin classInstruction
-
stackEntryIndexBefore
Description copied from class:InstructionReturns the stack entry index from which the specified stack entry is copied by a dup/swap/checkcast instruction, or -1 otherwise. Stack entry indices are counted from the top of the stack.- checkcast: after: 0 (before: 0 ) -- not anymore
- dup: after: 0 0 (before: 0 )
- dup_x1: after: 0 1 0 (before: 1 0 )
- dup_x2: after: 0 2 1 0 (before: 2 1 0 )
- dup2: after: 1 0 1 0 (before: 1 0 )
- dup2_x1: after: 1 0 2 1 0 (before: 2 1 0 )
- dup2_x2: after: 1 0 3 2 1 0 (before: 3 2 1 0)
- Overrides:
stackEntryIndexBeforein classInstruction
-
toString
-
equals
- Specified by:
equalsin classInstruction
-
hashCode
public int hashCode()- Specified by:
hashCodein classInstruction
-