Class InstructionConst
java.lang.Object
org.apache.bcel.generic.InstructionConst
Contains shareable instruction objects.
In order to save memory you can use some instructions multiply, since they have an immutable state and are directly derived from Instruction. I.e. they have no instance fields that could be changed. Since some of these instructions like ICONST_0 occur very frequently this can save a lot of time and space. This feature is an adaptation of the FlyWeight design pattern, we just use an array instead of a factory.
The Instructions can also accessed directly under their names, so it's possible to write il.append(Instruction.ICONST_0);
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ArrayInstructionAALOAD instruction.static final ArrayInstructionAASTORE instruction.static final InstructionACONST_NULL instruction.static final LocalVariableInstructionALOAD_0 instruction (same as THIS).static final LocalVariableInstructionALOAD_1 instruction.static final LocalVariableInstructionALOAD_2 instruction.static final ReturnInstructionARETURN instruction.static final InstructionARRAYLENGTH instruction.static final LocalVariableInstructionASTORE_0 instruction.static final LocalVariableInstructionASTORE_1 instruction.static final LocalVariableInstructionASTORE_2 instruction.static final InstructionATHROW instruction.static final ArrayInstructionBALOAD instruction.static final ArrayInstructionBASTORE instruction.static final ArrayInstructionCALOAD instruction.static final ArrayInstructionCASTORE instruction.static final ConversionInstructionD2F instruction.static final ConversionInstructionD2I instruction.static final ConversionInstructionD2L instruction.static final ArithmeticInstructionDADD instruction.static final ArrayInstructionDALOAD instruction.static final ArrayInstructionDASTORE instruction.static final InstructionDCMPG instruction.static final InstructionDCMPL instruction.static final InstructionDCONST_0 instruction.static final InstructionDCONST_1 instruction.static final ArithmeticInstructionDDIV instruction.static final ArithmeticInstructionDMUL instruction.static final ArithmeticInstructionDNEG instruction.static final ArithmeticInstructionDREM instruction.static final ReturnInstructionDRETURN instruction.static final ArithmeticInstructionDSUB instruction.static final StackInstructionDUP instruction.static final StackInstructionDUP_X1 instruction.static final StackInstructionDUP_X2 instruction.static final StackInstructionDUP2 instruction.static final StackInstructionDUP2_X1 instruction.static final StackInstructionDUP2_X2 instruction.static final ConversionInstructionF2D instruction.static final ConversionInstructionF2I instruction.static final ConversionInstructionF2L instruction.static final ArithmeticInstructionFADD instruction.static final ArrayInstructionFALOAD instruction.static final ArrayInstructionFASTORE instruction.static final InstructionFCMPG instruction.static final InstructionFCMPL instruction.static final InstructionFCONST_0 instruction.static final InstructionFCONST_1 instruction.static final InstructionFCONST_2 instruction.static final ArithmeticInstructionFDIV instruction.static final ArithmeticInstructionFMUL instruction.static final ArithmeticInstructionFNEG instruction.static final ArithmeticInstructionFREM instruction.static final ReturnInstructionFRETURN instruction.static final ArithmeticInstructionFSUB instruction.static final ConversionInstructionI2B instruction.static final ConversionInstructionI2C instruction.static final ConversionInstructionI2D instruction.static final ConversionInstructionI2F instruction.static final ConversionInstructionI2L instruction.static final ConversionInstructionI2S instruction.static final ArithmeticInstructionIADD instruction.static final ArrayInstructionIALOAD instruction.static final ArithmeticInstructionIAND instruction.static final ArrayInstructionIASTORE instruction.static final InstructionICONST_0 instruction.static final InstructionICONST_1 instruction.static final InstructionICONST_2 instruction.static final InstructionICONST_3 instruction.static final InstructionICONST_4 instruction.static final InstructionICONST_5 instruction.static final InstructionICONST_M1 instruction.static final ArithmeticInstructionIDIV instruction.static final LocalVariableInstructionILOAD_0 instruction.static final LocalVariableInstructionILOAD_1 instruction.static final LocalVariableInstructionILOAD_2 instruction.static final ArithmeticInstructionIMUL instruction.static final ArithmeticInstructionINEG instruction.static final ArithmeticInstructionIOR instruction.static final ArithmeticInstructionIREM instruction.static final ReturnInstructionIRETURN instruction.static final ArithmeticInstructionISHL instruction.static final ArithmeticInstructionISHR instruction.static final LocalVariableInstructionISTORE_0 instruction.static final LocalVariableInstructionISTORE_1 instruction.static final LocalVariableInstructionISTORE_2 instruction.static final ArithmeticInstructionISUB instruction.static final ArithmeticInstructionIUSHR instruction.static final ArithmeticInstructionIXOR instruction.static final ConversionInstructionL2D instruction.static final ConversionInstructionL2F instruction.static final ConversionInstructionL2I instruction.static final ArithmeticInstructionLADD instruction.static final ArrayInstructionLALOAD instruction.static final ArithmeticInstructionLAND instruction.static final ArrayInstructionLASTORE instruction.static final InstructionLCMP instruction.static final InstructionLCONST_0 instruction.static final InstructionLCONST_1 instruction.static final ArithmeticInstructionLDIV instruction.static final ArithmeticInstructionLMUL instruction.static final ArithmeticInstructionLNEG instruction.static final ArithmeticInstructionLOR instruction.static final ArithmeticInstructionLREM instruction.static final ReturnInstructionLRETURN instruction.static final ArithmeticInstructionLSHL instruction.static final ArithmeticInstructionLSHR instruction.static final ArithmeticInstructionLSUB instruction.static final ArithmeticInstructionLUSHR instruction.static final ArithmeticInstructionLXOR instruction.static final InstructionMONITORENTER instruction.static final InstructionMONITOREXIT instruction.static final InstructionNOP instruction.static final StackInstructionPOP instruction.static final StackInstructionPOP2 instruction.static final ReturnInstructionRETURN instruction.static final ArrayInstructionSALOAD instruction.static final ArrayInstructionSASTORE instruction.static final StackInstructionSWAP instruction.static final LocalVariableInstructionYou can use these constants in multiple places safely, if you can guarantee that you will never alter their internal values, for example call setIndex(). -
Method Summary
Modifier and TypeMethodDescriptionstatic InstructiongetInstruction(int index) Gets the Instruction.
-
Field Details
-
NOP
NOP instruction. -
ACONST_NULL
ACONST_NULL instruction. -
ICONST_M1
ICONST_M1 instruction. -
ICONST_0
ICONST_0 instruction. -
ICONST_1
ICONST_1 instruction. -
ICONST_2
ICONST_2 instruction. -
ICONST_3
ICONST_3 instruction. -
ICONST_4
ICONST_4 instruction. -
ICONST_5
ICONST_5 instruction. -
LCONST_0
LCONST_0 instruction. -
LCONST_1
LCONST_1 instruction. -
FCONST_0
FCONST_0 instruction. -
FCONST_1
FCONST_1 instruction. -
FCONST_2
FCONST_2 instruction. -
DCONST_0
DCONST_0 instruction. -
DCONST_1
DCONST_1 instruction. -
IALOAD
IALOAD instruction. -
LALOAD
LALOAD instruction. -
FALOAD
FALOAD instruction. -
DALOAD
DALOAD instruction. -
AALOAD
AALOAD instruction. -
BALOAD
BALOAD instruction. -
CALOAD
CALOAD instruction. -
SALOAD
SALOAD instruction. -
IASTORE
IASTORE instruction. -
LASTORE
LASTORE instruction. -
FASTORE
FASTORE instruction. -
DASTORE
DASTORE instruction. -
AASTORE
AASTORE instruction. -
BASTORE
BASTORE instruction. -
CASTORE
CASTORE instruction. -
SASTORE
SASTORE instruction. -
POP
POP instruction. -
POP2
POP2 instruction. -
DUP
DUP instruction. -
DUP_X1
DUP_X1 instruction. -
DUP_X2
DUP_X2 instruction. -
DUP2
DUP2 instruction. -
DUP2_X1
DUP2_X1 instruction. -
DUP2_X2
DUP2_X2 instruction. -
SWAP
SWAP instruction. -
IADD
IADD instruction. -
LADD
LADD instruction. -
FADD
FADD instruction. -
DADD
DADD instruction. -
ISUB
ISUB instruction. -
LSUB
LSUB instruction. -
FSUB
FSUB instruction. -
DSUB
DSUB instruction. -
IMUL
IMUL instruction. -
LMUL
LMUL instruction. -
FMUL
FMUL instruction. -
DMUL
DMUL instruction. -
IDIV
IDIV instruction. -
LDIV
LDIV instruction. -
FDIV
FDIV instruction. -
DDIV
DDIV instruction. -
IREM
IREM instruction. -
LREM
LREM instruction. -
FREM
FREM instruction. -
DREM
DREM instruction. -
INEG
INEG instruction. -
LNEG
LNEG instruction. -
FNEG
FNEG instruction. -
DNEG
DNEG instruction. -
ISHL
ISHL instruction. -
LSHL
LSHL instruction. -
ISHR
ISHR instruction. -
LSHR
LSHR instruction. -
IUSHR
IUSHR instruction. -
LUSHR
LUSHR instruction. -
IAND
IAND instruction. -
LAND
LAND instruction. -
IOR
IOR instruction. -
LOR
LOR instruction. -
IXOR
IXOR instruction. -
LXOR
LXOR instruction. -
I2L
I2L instruction. -
I2F
I2F instruction. -
I2D
I2D instruction. -
L2I
L2I instruction. -
L2F
L2F instruction. -
L2D
L2D instruction. -
F2I
F2I instruction. -
F2L
F2L instruction. -
F2D
F2D instruction. -
D2I
D2I instruction. -
D2L
D2L instruction. -
D2F
D2F instruction. -
I2B
I2B instruction. -
I2C
I2C instruction. -
I2S
I2S instruction. -
LCMP
LCMP instruction. -
FCMPL
FCMPL instruction. -
FCMPG
FCMPG instruction. -
DCMPL
DCMPL instruction. -
DCMPG
DCMPG instruction. -
IRETURN
IRETURN instruction. -
LRETURN
LRETURN instruction. -
FRETURN
FRETURN instruction. -
DRETURN
DRETURN instruction. -
ARETURN
ARETURN instruction. -
RETURN
RETURN instruction. -
ARRAYLENGTH
ARRAYLENGTH instruction. -
ATHROW
ATHROW instruction. -
MONITORENTER
MONITORENTER instruction. -
MONITOREXIT
MONITOREXIT instruction. -
THIS
You can use these constants in multiple places safely, if you can guarantee that you will never alter their internal values, for example call setIndex(). THIS instruction (ALOAD_0) -
ALOAD_0
ALOAD_0 instruction (same as THIS). -
ALOAD_1
ALOAD_1 instruction. -
ALOAD_2
ALOAD_2 instruction. -
ILOAD_0
ILOAD_0 instruction. -
ILOAD_1
ILOAD_1 instruction. -
ILOAD_2
ILOAD_2 instruction. -
ASTORE_0
ASTORE_0 instruction. -
ASTORE_1
ASTORE_1 instruction. -
ASTORE_2
ASTORE_2 instruction. -
ISTORE_0
ISTORE_0 instruction. -
ISTORE_1
ISTORE_1 instruction. -
ISTORE_2
ISTORE_2 instruction.
-
-
Method Details
-
getInstruction
Gets the Instruction.- Parameters:
index- the index, for exampleConst.RETURN.- Returns:
- the entry from the private INSTRUCTIONS table.
-