Package org.apache.bcel.generic
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
Modifier and TypeFieldDescriptionstatic final ArrayInstruction
static final ArrayInstruction
static final Instruction
static final LocalVariableInstruction
static final LocalVariableInstruction
static final LocalVariableInstruction
static final ReturnInstruction
static final Instruction
static final LocalVariableInstruction
static final LocalVariableInstruction
static final LocalVariableInstruction
static final Instruction
static final ArrayInstruction
static final ArrayInstruction
static final ArrayInstruction
static final ArrayInstruction
static final ConversionInstruction
static final ConversionInstruction
static final ConversionInstruction
static final ArithmeticInstruction
static final ArrayInstruction
static final ArrayInstruction
static final Instruction
static final Instruction
static final Instruction
static final Instruction
static final ArithmeticInstruction
static final ArithmeticInstruction
static final ArithmeticInstruction
static final ArithmeticInstruction
static final ReturnInstruction
static final ArithmeticInstruction
static final StackInstruction
static final StackInstruction
static final StackInstruction
static final StackInstruction
static final StackInstruction
static final StackInstruction
static final ConversionInstruction
static final ConversionInstruction
static final ConversionInstruction
static final ArithmeticInstruction
static final ArrayInstruction
static final ArrayInstruction
static final Instruction
static final Instruction
static final Instruction
static final Instruction
static final Instruction
static final ArithmeticInstruction
static final ArithmeticInstruction
static final ArithmeticInstruction
static final ArithmeticInstruction
static final ReturnInstruction
static final ArithmeticInstruction
static final ConversionInstruction
static final ConversionInstruction
static final ConversionInstruction
static final ConversionInstruction
static final ConversionInstruction
static final ConversionInstruction
static final ArithmeticInstruction
static final ArrayInstruction
static final ArithmeticInstruction
static final ArrayInstruction
static final Instruction
static final Instruction
static final Instruction
static final Instruction
static final Instruction
static final Instruction
static final Instruction
static final ArithmeticInstruction
static final LocalVariableInstruction
static final LocalVariableInstruction
static final LocalVariableInstruction
static final ArithmeticInstruction
static final ArithmeticInstruction
static final ArithmeticInstruction
static final ArithmeticInstruction
static final ReturnInstruction
static final ArithmeticInstruction
static final ArithmeticInstruction
static final LocalVariableInstruction
static final LocalVariableInstruction
static final LocalVariableInstruction
static final ArithmeticInstruction
static final ArithmeticInstruction
static final ArithmeticInstruction
static final ConversionInstruction
static final ConversionInstruction
static final ConversionInstruction
static final ArithmeticInstruction
static final ArrayInstruction
static final ArithmeticInstruction
static final ArrayInstruction
static final Instruction
static final Instruction
static final Instruction
static final ArithmeticInstruction
static final ArithmeticInstruction
static final ArithmeticInstruction
static final ArithmeticInstruction
static final ArithmeticInstruction
static final ReturnInstruction
static final ArithmeticInstruction
static final ArithmeticInstruction
static final ArithmeticInstruction
static final ArithmeticInstruction
static final ArithmeticInstruction
static final Instruction
static final Instruction
static final Instruction
Predefined instruction objects.static final StackInstruction
static final StackInstruction
static final ReturnInstruction
static final ArrayInstruction
static final ArrayInstruction
static final StackInstruction
static final LocalVariableInstruction
You can use these constants in multiple places safely, if you can guarantee that you will never alter their internal values, e.g. -
Method Summary
Modifier and TypeMethodDescriptionstatic Instruction
getInstruction
(int index) Gets the Instruction.
-
Field Details
-
NOP
Predefined instruction objects. NOTE these are not currently immutable, because Instruction has mutable protected fields opcode and length. -
ACONST_NULL
-
ICONST_M1
-
ICONST_0
-
ICONST_1
-
ICONST_2
-
ICONST_3
-
ICONST_4
-
ICONST_5
-
LCONST_0
-
LCONST_1
-
FCONST_0
-
FCONST_1
-
FCONST_2
-
DCONST_0
-
DCONST_1
-
IALOAD
-
LALOAD
-
FALOAD
-
DALOAD
-
AALOAD
-
BALOAD
-
CALOAD
-
SALOAD
-
IASTORE
-
LASTORE
-
FASTORE
-
DASTORE
-
AASTORE
-
BASTORE
-
CASTORE
-
SASTORE
-
POP
-
POP2
-
DUP
-
DUP_X1
-
DUP_X2
-
DUP2
-
DUP2_X1
-
DUP2_X2
-
SWAP
-
IADD
-
LADD
-
FADD
-
DADD
-
ISUB
-
LSUB
-
FSUB
-
DSUB
-
IMUL
-
LMUL
-
FMUL
-
DMUL
-
IDIV
-
LDIV
-
FDIV
-
DDIV
-
IREM
-
LREM
-
FREM
-
DREM
-
INEG
-
LNEG
-
FNEG
-
DNEG
-
ISHL
-
LSHL
-
ISHR
-
LSHR
-
IUSHR
-
LUSHR
-
IAND
-
LAND
-
IOR
-
LOR
-
IXOR
-
LXOR
-
I2L
-
I2F
-
I2D
-
L2I
-
L2F
-
L2D
-
F2I
-
F2L
-
F2D
-
D2I
-
D2L
-
D2F
-
I2B
-
I2C
-
I2S
-
LCMP
-
FCMPL
-
FCMPG
-
DCMPL
-
DCMPG
-
IRETURN
-
LRETURN
-
FRETURN
-
DRETURN
-
ARETURN
-
RETURN
-
ARRAYLENGTH
-
ATHROW
-
MONITORENTER
-
MONITOREXIT
-
THIS
You can use these constants in multiple places safely, if you can guarantee that you will never alter their internal values, e.g. call setIndex(). -
ALOAD_0
-
ALOAD_1
-
ALOAD_2
-
ILOAD_0
-
ILOAD_1
-
ILOAD_2
-
ASTORE_0
-
ASTORE_1
-
ASTORE_2
-
ISTORE_0
-
ISTORE_1
-
ISTORE_2
-
-
Method Details
-
getInstruction
Gets the Instruction.- Parameters:
index
- the index, e.g.Const.RETURN
- Returns:
- the entry from the private INSTRUCTIONS table
-