Package org.apache.bcel.generic
Class InstructionConst
- java.lang.Object
-
- org.apache.bcel.generic.InstructionConst
-
public final class InstructionConst extends java.lang.ObjectContains 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
Fields Modifier and Type Field Description static ArrayInstructionAALOADAALOAD instruction.static ArrayInstructionAASTOREAASTORE instruction.static InstructionACONST_NULLACONST_NULL instruction.static LocalVariableInstructionALOAD_0ALOAD_0 instruction (same as THIS).static LocalVariableInstructionALOAD_1ALOAD_1 instruction.static LocalVariableInstructionALOAD_2ALOAD_2 instruction.static ReturnInstructionARETURNARETURN instruction.static InstructionARRAYLENGTHARRAYLENGTH instruction.static LocalVariableInstructionASTORE_0ASTORE_0 instruction.static LocalVariableInstructionASTORE_1ASTORE_1 instruction.static LocalVariableInstructionASTORE_2ASTORE_2 instruction.static InstructionATHROWATHROW instruction.static ArrayInstructionBALOADBALOAD instruction.static ArrayInstructionBASTOREBASTORE instruction.static ArrayInstructionCALOADCALOAD instruction.static ArrayInstructionCASTORECASTORE instruction.static ConversionInstructionD2FD2F instruction.static ConversionInstructionD2ID2I instruction.static ConversionInstructionD2LD2L instruction.static ArithmeticInstructionDADDDADD instruction.static ArrayInstructionDALOADDALOAD instruction.static ArrayInstructionDASTOREDASTORE instruction.static InstructionDCMPGDCMPG instruction.static InstructionDCMPLDCMPL instruction.static InstructionDCONST_0DCONST_0 instruction.static InstructionDCONST_1DCONST_1 instruction.static ArithmeticInstructionDDIVDDIV instruction.static ArithmeticInstructionDMULDMUL instruction.static ArithmeticInstructionDNEGDNEG instruction.static ArithmeticInstructionDREMDREM instruction.static ReturnInstructionDRETURNDRETURN instruction.static ArithmeticInstructionDSUBDSUB instruction.static StackInstructionDUPDUP instruction.static StackInstructionDUP_X1DUP_X1 instruction.static StackInstructionDUP_X2DUP_X2 instruction.static StackInstructionDUP2DUP2 instruction.static StackInstructionDUP2_X1DUP2_X1 instruction.static StackInstructionDUP2_X2DUP2_X2 instruction.static ConversionInstructionF2DF2D instruction.static ConversionInstructionF2IF2I instruction.static ConversionInstructionF2LF2L instruction.static ArithmeticInstructionFADDFADD instruction.static ArrayInstructionFALOADFALOAD instruction.static ArrayInstructionFASTOREFASTORE instruction.static InstructionFCMPGFCMPG instruction.static InstructionFCMPLFCMPL instruction.static InstructionFCONST_0FCONST_0 instruction.static InstructionFCONST_1FCONST_1 instruction.static InstructionFCONST_2FCONST_2 instruction.static ArithmeticInstructionFDIVFDIV instruction.static ArithmeticInstructionFMULFMUL instruction.static ArithmeticInstructionFNEGFNEG instruction.static ArithmeticInstructionFREMFREM instruction.static ReturnInstructionFRETURNFRETURN instruction.static ArithmeticInstructionFSUBFSUB instruction.static ConversionInstructionI2BI2B instruction.static ConversionInstructionI2CI2C instruction.static ConversionInstructionI2DI2D instruction.static ConversionInstructionI2FI2F instruction.static ConversionInstructionI2LI2L instruction.static ConversionInstructionI2SI2S instruction.static ArithmeticInstructionIADDIADD instruction.static ArrayInstructionIALOADIALOAD instruction.static ArithmeticInstructionIANDIAND instruction.static ArrayInstructionIASTOREIASTORE instruction.static InstructionICONST_0ICONST_0 instruction.static InstructionICONST_1ICONST_1 instruction.static InstructionICONST_2ICONST_2 instruction.static InstructionICONST_3ICONST_3 instruction.static InstructionICONST_4ICONST_4 instruction.static InstructionICONST_5ICONST_5 instruction.static InstructionICONST_M1ICONST_M1 instruction.static ArithmeticInstructionIDIVIDIV instruction.static LocalVariableInstructionILOAD_0ILOAD_0 instruction.static LocalVariableInstructionILOAD_1ILOAD_1 instruction.static LocalVariableInstructionILOAD_2ILOAD_2 instruction.static ArithmeticInstructionIMULIMUL instruction.static ArithmeticInstructionINEGINEG instruction.(package private) static Instruction[]INSTRUCTIONSGets object via its opcode, for immutable instructions like branch instructions entries are set to null.static ArithmeticInstructionIORIOR instruction.static ArithmeticInstructionIREMIREM instruction.static ReturnInstructionIRETURNIRETURN instruction.static ArithmeticInstructionISHLISHL instruction.static ArithmeticInstructionISHRISHR instruction.static LocalVariableInstructionISTORE_0ISTORE_0 instruction.static LocalVariableInstructionISTORE_1ISTORE_1 instruction.static LocalVariableInstructionISTORE_2ISTORE_2 instruction.static ArithmeticInstructionISUBISUB instruction.static ArithmeticInstructionIUSHRIUSHR instruction.static ArithmeticInstructionIXORIXOR instruction.static ConversionInstructionL2DL2D instruction.static ConversionInstructionL2FL2F instruction.static ConversionInstructionL2IL2I instruction.static ArithmeticInstructionLADDLADD instruction.static ArrayInstructionLALOADLALOAD instruction.static ArithmeticInstructionLANDLAND instruction.static ArrayInstructionLASTORELASTORE instruction.static InstructionLCMPLCMP instruction.static InstructionLCONST_0LCONST_0 instruction.static InstructionLCONST_1LCONST_1 instruction.static ArithmeticInstructionLDIVLDIV instruction.static ArithmeticInstructionLMULLMUL instruction.static ArithmeticInstructionLNEGLNEG instruction.static ArithmeticInstructionLORLOR instruction.static ArithmeticInstructionLREMLREM instruction.static ReturnInstructionLRETURNLRETURN instruction.static ArithmeticInstructionLSHLLSHL instruction.static ArithmeticInstructionLSHRLSHR instruction.static ArithmeticInstructionLSUBLSUB instruction.static ArithmeticInstructionLUSHRLUSHR instruction.static ArithmeticInstructionLXORLXOR instruction.static InstructionMONITORENTERMONITORENTER instruction.static InstructionMONITOREXITMONITOREXIT instruction.static InstructionNOPNOP instruction.static StackInstructionPOPPOP instruction.static StackInstructionPOP2POP2 instruction.static ReturnInstructionRETURNRETURN instruction.static ArrayInstructionSALOADSALOAD instruction.static ArrayInstructionSASTORESASTORE instruction.static StackInstructionSWAPSWAP instruction.static LocalVariableInstructionTHISYou can use these constants in multiple places safely, if you can guarantee that you will never alter their internal values, for example call setIndex().
-
Constructor Summary
Constructors Modifier Constructor Description privateInstructionConst()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static InstructiongetInstruction(int index)Gets the Instruction.
-
-
-
Field Detail
-
NOP
public static final Instruction NOP
NOP instruction.
-
ACONST_NULL
public static final Instruction ACONST_NULL
ACONST_NULL instruction.
-
ICONST_M1
public static final Instruction ICONST_M1
ICONST_M1 instruction.
-
ICONST_0
public static final Instruction ICONST_0
ICONST_0 instruction.
-
ICONST_1
public static final Instruction ICONST_1
ICONST_1 instruction.
-
ICONST_2
public static final Instruction ICONST_2
ICONST_2 instruction.
-
ICONST_3
public static final Instruction ICONST_3
ICONST_3 instruction.
-
ICONST_4
public static final Instruction ICONST_4
ICONST_4 instruction.
-
ICONST_5
public static final Instruction ICONST_5
ICONST_5 instruction.
-
LCONST_0
public static final Instruction LCONST_0
LCONST_0 instruction.
-
LCONST_1
public static final Instruction LCONST_1
LCONST_1 instruction.
-
FCONST_0
public static final Instruction FCONST_0
FCONST_0 instruction.
-
FCONST_1
public static final Instruction FCONST_1
FCONST_1 instruction.
-
FCONST_2
public static final Instruction FCONST_2
FCONST_2 instruction.
-
DCONST_0
public static final Instruction DCONST_0
DCONST_0 instruction.
-
DCONST_1
public static final Instruction DCONST_1
DCONST_1 instruction.
-
IALOAD
public static final ArrayInstruction IALOAD
IALOAD instruction.
-
LALOAD
public static final ArrayInstruction LALOAD
LALOAD instruction.
-
FALOAD
public static final ArrayInstruction FALOAD
FALOAD instruction.
-
DALOAD
public static final ArrayInstruction DALOAD
DALOAD instruction.
-
AALOAD
public static final ArrayInstruction AALOAD
AALOAD instruction.
-
BALOAD
public static final ArrayInstruction BALOAD
BALOAD instruction.
-
CALOAD
public static final ArrayInstruction CALOAD
CALOAD instruction.
-
SALOAD
public static final ArrayInstruction SALOAD
SALOAD instruction.
-
IASTORE
public static final ArrayInstruction IASTORE
IASTORE instruction.
-
LASTORE
public static final ArrayInstruction LASTORE
LASTORE instruction.
-
FASTORE
public static final ArrayInstruction FASTORE
FASTORE instruction.
-
DASTORE
public static final ArrayInstruction DASTORE
DASTORE instruction.
-
AASTORE
public static final ArrayInstruction AASTORE
AASTORE instruction.
-
BASTORE
public static final ArrayInstruction BASTORE
BASTORE instruction.
-
CASTORE
public static final ArrayInstruction CASTORE
CASTORE instruction.
-
SASTORE
public static final ArrayInstruction SASTORE
SASTORE instruction.
-
POP
public static final StackInstruction POP
POP instruction.
-
POP2
public static final StackInstruction POP2
POP2 instruction.
-
DUP
public static final StackInstruction DUP
DUP instruction.
-
DUP_X1
public static final StackInstruction DUP_X1
DUP_X1 instruction.
-
DUP_X2
public static final StackInstruction DUP_X2
DUP_X2 instruction.
-
DUP2
public static final StackInstruction DUP2
DUP2 instruction.
-
DUP2_X1
public static final StackInstruction DUP2_X1
DUP2_X1 instruction.
-
DUP2_X2
public static final StackInstruction DUP2_X2
DUP2_X2 instruction.
-
SWAP
public static final StackInstruction SWAP
SWAP instruction.
-
IADD
public static final ArithmeticInstruction IADD
IADD instruction.
-
LADD
public static final ArithmeticInstruction LADD
LADD instruction.
-
FADD
public static final ArithmeticInstruction FADD
FADD instruction.
-
DADD
public static final ArithmeticInstruction DADD
DADD instruction.
-
ISUB
public static final ArithmeticInstruction ISUB
ISUB instruction.
-
LSUB
public static final ArithmeticInstruction LSUB
LSUB instruction.
-
FSUB
public static final ArithmeticInstruction FSUB
FSUB instruction.
-
DSUB
public static final ArithmeticInstruction DSUB
DSUB instruction.
-
IMUL
public static final ArithmeticInstruction IMUL
IMUL instruction.
-
LMUL
public static final ArithmeticInstruction LMUL
LMUL instruction.
-
FMUL
public static final ArithmeticInstruction FMUL
FMUL instruction.
-
DMUL
public static final ArithmeticInstruction DMUL
DMUL instruction.
-
IDIV
public static final ArithmeticInstruction IDIV
IDIV instruction.
-
LDIV
public static final ArithmeticInstruction LDIV
LDIV instruction.
-
FDIV
public static final ArithmeticInstruction FDIV
FDIV instruction.
-
DDIV
public static final ArithmeticInstruction DDIV
DDIV instruction.
-
IREM
public static final ArithmeticInstruction IREM
IREM instruction.
-
LREM
public static final ArithmeticInstruction LREM
LREM instruction.
-
FREM
public static final ArithmeticInstruction FREM
FREM instruction.
-
DREM
public static final ArithmeticInstruction DREM
DREM instruction.
-
INEG
public static final ArithmeticInstruction INEG
INEG instruction.
-
LNEG
public static final ArithmeticInstruction LNEG
LNEG instruction.
-
FNEG
public static final ArithmeticInstruction FNEG
FNEG instruction.
-
DNEG
public static final ArithmeticInstruction DNEG
DNEG instruction.
-
ISHL
public static final ArithmeticInstruction ISHL
ISHL instruction.
-
LSHL
public static final ArithmeticInstruction LSHL
LSHL instruction.
-
ISHR
public static final ArithmeticInstruction ISHR
ISHR instruction.
-
LSHR
public static final ArithmeticInstruction LSHR
LSHR instruction.
-
IUSHR
public static final ArithmeticInstruction IUSHR
IUSHR instruction.
-
LUSHR
public static final ArithmeticInstruction LUSHR
LUSHR instruction.
-
IAND
public static final ArithmeticInstruction IAND
IAND instruction.
-
LAND
public static final ArithmeticInstruction LAND
LAND instruction.
-
IOR
public static final ArithmeticInstruction IOR
IOR instruction.
-
LOR
public static final ArithmeticInstruction LOR
LOR instruction.
-
IXOR
public static final ArithmeticInstruction IXOR
IXOR instruction.
-
LXOR
public static final ArithmeticInstruction LXOR
LXOR instruction.
-
I2L
public static final ConversionInstruction I2L
I2L instruction.
-
I2F
public static final ConversionInstruction I2F
I2F instruction.
-
I2D
public static final ConversionInstruction I2D
I2D instruction.
-
L2I
public static final ConversionInstruction L2I
L2I instruction.
-
L2F
public static final ConversionInstruction L2F
L2F instruction.
-
L2D
public static final ConversionInstruction L2D
L2D instruction.
-
F2I
public static final ConversionInstruction F2I
F2I instruction.
-
F2L
public static final ConversionInstruction F2L
F2L instruction.
-
F2D
public static final ConversionInstruction F2D
F2D instruction.
-
D2I
public static final ConversionInstruction D2I
D2I instruction.
-
D2L
public static final ConversionInstruction D2L
D2L instruction.
-
D2F
public static final ConversionInstruction D2F
D2F instruction.
-
I2B
public static final ConversionInstruction I2B
I2B instruction.
-
I2C
public static final ConversionInstruction I2C
I2C instruction.
-
I2S
public static final ConversionInstruction I2S
I2S instruction.
-
LCMP
public static final Instruction LCMP
LCMP instruction.
-
FCMPL
public static final Instruction FCMPL
FCMPL instruction.
-
FCMPG
public static final Instruction FCMPG
FCMPG instruction.
-
DCMPL
public static final Instruction DCMPL
DCMPL instruction.
-
DCMPG
public static final Instruction DCMPG
DCMPG instruction.
-
IRETURN
public static final ReturnInstruction IRETURN
IRETURN instruction.
-
LRETURN
public static final ReturnInstruction LRETURN
LRETURN instruction.
-
FRETURN
public static final ReturnInstruction FRETURN
FRETURN instruction.
-
DRETURN
public static final ReturnInstruction DRETURN
DRETURN instruction.
-
ARETURN
public static final ReturnInstruction ARETURN
ARETURN instruction.
-
RETURN
public static final ReturnInstruction RETURN
RETURN instruction.
-
ARRAYLENGTH
public static final Instruction ARRAYLENGTH
ARRAYLENGTH instruction.
-
ATHROW
public static final Instruction ATHROW
ATHROW instruction.
-
MONITORENTER
public static final Instruction MONITORENTER
MONITORENTER instruction.
-
MONITOREXIT
public static final Instruction MONITOREXIT
MONITOREXIT instruction.
-
THIS
public static final LocalVariableInstruction 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
public static final LocalVariableInstruction ALOAD_0
ALOAD_0 instruction (same as THIS).
-
ALOAD_1
public static final LocalVariableInstruction ALOAD_1
ALOAD_1 instruction.
-
ALOAD_2
public static final LocalVariableInstruction ALOAD_2
ALOAD_2 instruction.
-
ILOAD_0
public static final LocalVariableInstruction ILOAD_0
ILOAD_0 instruction.
-
ILOAD_1
public static final LocalVariableInstruction ILOAD_1
ILOAD_1 instruction.
-
ILOAD_2
public static final LocalVariableInstruction ILOAD_2
ILOAD_2 instruction.
-
ASTORE_0
public static final LocalVariableInstruction ASTORE_0
ASTORE_0 instruction.
-
ASTORE_1
public static final LocalVariableInstruction ASTORE_1
ASTORE_1 instruction.
-
ASTORE_2
public static final LocalVariableInstruction ASTORE_2
ASTORE_2 instruction.
-
ISTORE_0
public static final LocalVariableInstruction ISTORE_0
ISTORE_0 instruction.
-
ISTORE_1
public static final LocalVariableInstruction ISTORE_1
ISTORE_1 instruction.
-
ISTORE_2
public static final LocalVariableInstruction ISTORE_2
ISTORE_2 instruction.
-
INSTRUCTIONS
static final Instruction[] INSTRUCTIONS
Gets object via its opcode, for immutable instructions like branch instructions entries are set to null.
-
-
Method Detail
-
getInstruction
public static Instruction getInstruction(int index)
Gets the Instruction.- Parameters:
index- the index, for exampleConst.RETURN.- Returns:
- the entry from the private INSTRUCTIONS table.
-
-