|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.rit.classfile.Op
public class Op
Class Op encapsulates all the opcodes used in Java bytecode instructions. To
create a particular Instruction
, use the desired static
field or method in class Op. For example:
SynthesizedMethodDescription theMethod = . . .; ClassReference javaLangObject = NamedClassReference.JAVA_LANG_OBJECT; SubroutineReference javaLangObjectInit = new ConstructorReference (javaLangObject); . . . theMethod.addInstruction (Op.ALOAD (0)); theMethod.addInstruction (Op.INVOKESPECIAL (javaLangObjectInit)); theMethod.addInstruction (Op.RETURN);
Class Op provides certain "smart opcodes" that generate different Java bytecodes, depending on the argument:
ALOAD(int)
.
ASTORE(int)
.
DLOAD(int)
.
DSTORE(int)
.
FLOAD(int)
.
FSTORE(int)
.
IINC(int,int)
.
ILOAD(int)
.
ISTORE(int)
.
LDC(String)
.
LDC(int)
.
LDC(float)
.
LDC(long)
.
LDC(double)
.
LLOAD(int)
.
LSTORE(int)
.
RET(int)
.
Class Op provides the following "type sensitive opcodes" where the actual
opcode depends on a given type reference: TLOAD
, TSTORE
.
For the official explanation of what each Java bytecode does, refer to The Java™ Virtual Machine Specification, 2nd Edition by Tim Lindholm and Frank Yellin.
Field Summary | |
---|---|
static Instruction |
AALOAD
An aaload instruction. |
static Instruction |
AASTORE
An aastore instruction. |
static Instruction |
ACONST_NULL
An aconst_null instruction. |
static Instruction |
ARETURN
An areturn instruction. |
static Instruction |
ARRAYLENGTH
An arraylength instruction. |
static Instruction |
ATHROW
An athrow instruction. |
static Instruction |
BALOAD
A baload instruction. |
static Instruction |
BASTORE
A bastore instruction. |
static Instruction |
CALOAD
A caload instruction. |
static Instruction |
CASTORE
A castore instruction. |
static Instruction |
D2F
A d2f instruction. |
static Instruction |
D2I
A d2i instruction. |
static Instruction |
D2L
A d2l instruction. |
static Instruction |
DADD
A dadd instruction. |
static Instruction |
DALOAD
A daload instruction. |
static Instruction |
DASTORE
A dastore instruction. |
static Instruction |
DCMPG
A dcmpg instruction. |
static Instruction |
DCMPL
A dcmpl instruction. |
static Instruction |
DDIV
A ddiv instruction. |
static Instruction |
DMUL
A dmul instruction. |
static Instruction |
DNEG
A dneg instruction. |
static Instruction |
DREM
A drem instruction. |
static Instruction |
DRETURN
A dreturn instruction. |
static Instruction |
DSUB
A dsub instruction. |
static Instruction |
DUP
A dup instruction. |
static Instruction |
DUP_X1
A dup_x1 instruction. |
static Instruction |
DUP_X2
A dup_x2 instruction. |
static Instruction |
DUP2
A dup2 instruction. |
static Instruction |
DUP2_X1
A dup2_x1 instruction. |
static Instruction |
DUP2_X2
A dup2_x2 instruction. |
static Instruction |
F2D
An f2d instruction. |
static Instruction |
F2I
An f2i instruction. |
static Instruction |
F2L
An f2l instruction. |
static Instruction |
FADD
An fadd instruction. |
static Instruction |
FALOAD
An faload instruction. |
static Instruction |
FASTORE
An fastore instruction. |
static Instruction |
FCMPG
An fcmpg instruction. |
static Instruction |
FCMPL
An fcmpl instruction. |
static Instruction |
FDIV
An fdiv instruction. |
static Instruction |
FMUL
An fmul instruction. |
static Instruction |
FNEG
An fneg instruction. |
static Instruction |
FREM
An frem instruction. |
static Instruction |
FRETURN
An freturn instruction. |
static Instruction |
FSUB
An fsub instruction. |
static Instruction |
I2B
An i2b instruction. |
static Instruction |
I2C
An i2c instruction. |
static Instruction |
I2D
An i2d instruction. |
static Instruction |
I2F
An i2f instruction. |
static Instruction |
I2L
An i2l instruction. |
static Instruction |
I2S
An i2s instruction. |
static Instruction |
IADD
An iadd instruction. |
static Instruction |
IALOAD
An iaload instruction. |
static Instruction |
IAND
An iand instruction. |
static Instruction |
IASTORE
An iastore instruction. |
static Instruction |
IDIV
An idiv instruction. |
static Instruction |
IMUL
An imul instruction. |
static Instruction |
INEG
An ineg instruction. |
static Instruction |
IOR
An ior instruction. |
static Instruction |
IREM
An irem instruction. |
static Instruction |
IRETURN
An ireturn instruction. |
static Instruction |
ISHL
An ishl instruction. |
static Instruction |
ISHR
An ishr instruction. |
static Instruction |
ISUB
An isub instruction. |
static Instruction |
IUSHR
An iushr instruction. |
static Instruction |
IXOR
An ixor instruction. |
static Instruction |
L2D
An l2d instruction. |
static Instruction |
L2F
An l2f instruction. |
static Instruction |
L2I
An l2i instruction. |
static Instruction |
LADD
An ladd instruction. |
static Instruction |
LALOAD
An laload instruction. |
static Instruction |
LAND
An land instruction. |
static Instruction |
LASTORE
An lastore instruction. |
static Instruction |
LCMP
An lcmp instruction. |
static Instruction |
LDIV
An ldiv instruction. |
static Instruction |
LMUL
An lmul instruction. |
static Instruction |
LNEG
An lneg instruction. |
static Instruction |
LOR
An lor instruction. |
static Instruction |
LREM
An lrem instruction. |
static Instruction |
LRETURN
An lreturn instruction. |
static Instruction |
LSHL
An lshl instruction. |
static Instruction |
LSHR
An lshr instruction. |
static Instruction |
LSUB
An lsub instruction. |
static Instruction |
LUSHR
An lushr instruction. |
static Instruction |
LXOR
An lxor instruction. |
static Instruction |
MONITORENTER
A monitorenter instruction. |
static Instruction |
MONITOREXIT
A monitorexit instruction. |
static Instruction |
NOP
A nop instruction. |
static Instruction |
POP
A pop instruction. |
static Instruction |
POP2
A pop2 instruction. |
static Instruction |
RETURN
A return instruction. |
static Instruction |
SALOAD
An saload instruction. |
static Instruction |
SASTORE
An sastore instruction. |
static Instruction |
SWAP
A swap instruction. |
Method Summary | |
---|---|
static Instruction |
ALOAD(int theIndex)
An aload instruction. |
static Instruction |
ANEWARRAY(ArrayOrClassReference theType)
An anewarray instruction. |
static Instruction |
ASTORE(int theIndex)
An astore instruction. |
static Instruction |
CHECKCAST(ArrayOrClassReference theType)
A checkcast instruction. |
static Instruction |
DLOAD(int theIndex)
A dload instruction. |
static Instruction |
DSTORE(int theIndex)
A dstore instruction. |
static Instruction |
FLOAD(int theIndex)
An fload instruction. |
static Instruction |
FSTORE(int theIndex)
An fstore instruction. |
static Instruction |
GETFIELD(FieldReference theField)
A getfield instruction. |
static Instruction |
GETSTATIC(FieldReference theField)
A getstatic instruction. |
static Instruction |
GOTO_W(Location theTarget)
A goto_w instruction. |
static Instruction |
GOTO(Location theTarget)
A goto instruction. |
static Instruction |
IF_ACMPEQ(Location theTarget)
An if_acmpeq instruction. |
static Instruction |
IF_ACMPNE(Location theTarget)
An if_acmpne instruction. |
static Instruction |
IF_ICMPEQ(Location theTarget)
An if_icmpeq instruction. |
static Instruction |
IF_ICMPGE(Location theTarget)
An if_icmpge instruction. |
static Instruction |
IF_ICMPGT(Location theTarget)
An if_icmpgt instruction. |
static Instruction |
IF_ICMPLE(Location theTarget)
An if_icmple instruction. |
static Instruction |
IF_ICMPLT(Location theTarget)
An if_icmplt instruction. |
static Instruction |
IF_ICMPNE(Location theTarget)
An if_icmpne instruction. |
static Instruction |
IFEQ(Location theTarget)
An ifeq instruction. |
static Instruction |
IFGE(Location theTarget)
An ifge instruction. |
static Instruction |
IFGT(Location theTarget)
An ifgt instruction. |
static Instruction |
IFLE(Location theTarget)
An ifle instruction. |
static Instruction |
IFLT(Location theTarget)
An iflt instruction. |
static Instruction |
IFNE(Location theTarget)
An ifne instruction. |
static Instruction |
IFNONNULL(Location theTarget)
An ifnonnull instruction. |
static Instruction |
IFNULL(Location theTarget)
An ifnull instruction. |
static Instruction |
IINC(int theIndex,
int theAmount)
An iinc instruction. |
static Instruction |
ILOAD(int theIndex)
An iload instruction. |
static Instruction |
INSTANCEOF(ArrayOrClassReference theType)
An instanceof instruction. |
static Instruction |
INVOKEINTERFACE(SubroutineReference theMethod)
An invokeinterface instruction. |
static Instruction |
INVOKESPECIAL(SubroutineReference theMethod)
An invokespecial instruction. |
static Instruction |
INVOKESTATIC(SubroutineReference theMethod)
An invokestatic instruction. |
static Instruction |
INVOKEVIRTUAL(SubroutineReference theMethod)
An invokevirtual instruction. |
static Instruction |
ISTORE(int theIndex)
An istore instruction. |
static Instruction |
JSR_W(Location theTarget)
A jsr_w instruction. |
static Instruction |
JSR(Location theTarget)
A jsr instruction. |
static Instruction |
LDC(double theValue)
A double ldc instruction. |
static Instruction |
LDC(float theValue)
A float ldc instruction. |
static Instruction |
LDC(int theValue)
An integer ldc instruction. |
static Instruction |
LDC(long theValue)
A long ldc instruction. |
static Instruction |
LDC(String theValue)
A string ldc instruction. |
static Instruction |
LLOAD(int theIndex)
An lload instruction. |
static SwitchInstruction |
LOOKUPSWITCH(Location theDefaultTarget)
A lookupswitch instruction. |
static Instruction |
LSTORE(int theIndex)
An lstore instruction. |
static Instruction |
MULTIANEWARRAY(ArrayReference theArrayType,
int theDimensions)
A multianewarray instruction. |
static Instruction |
NEW(ClassReference theType)
A new instruction. |
static Instruction |
NEWARRAY(PrimitiveReference theType)
A newarray instruction. |
static Instruction |
PUTFIELD(FieldReference theField)
A putfield instruction. |
static Instruction |
PUTSTATIC(FieldReference theField)
A putstatic instruction. |
static Instruction |
RET(int theIndex)
A ret instruction. |
static SwitchInstruction |
TABLESWITCH(Location theDefaultTarget)
A tableswitch instruction. |
static Instruction |
TLOAD(int theIndex,
TypeReference theType)
A type-sensitive load instruction. |
static Instruction |
TSTORE(int theIndex,
TypeReference theType)
A type-sensitive store instruction. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final Instruction AALOAD
public static final Instruction AASTORE
public static final Instruction ACONST_NULL
public static final Instruction ARETURN
public static final Instruction ARRAYLENGTH
public static final Instruction ATHROW
public static final Instruction BALOAD
public static final Instruction BASTORE
public static final Instruction CALOAD
public static final Instruction CASTORE
public static final Instruction D2F
public static final Instruction D2I
public static final Instruction D2L
public static final Instruction DADD
public static final Instruction DALOAD
public static final Instruction DASTORE
public static final Instruction DCMPG
public static final Instruction DCMPL
public static final Instruction DDIV
public static final Instruction DMUL
public static final Instruction DNEG
public static final Instruction DREM
public static final Instruction DRETURN
public static final Instruction DSUB
public static final Instruction DUP
public static final Instruction DUP_X1
public static final Instruction DUP_X2
public static final Instruction DUP2
public static final Instruction DUP2_X1
public static final Instruction DUP2_X2
public static final Instruction F2D
public static final Instruction F2I
public static final Instruction F2L
public static final Instruction FADD
public static final Instruction FALOAD
public static final Instruction FASTORE
public static final Instruction FCMPG
public static final Instruction FCMPL
public static final Instruction FDIV
public static final Instruction FMUL
public static final Instruction FNEG
public static final Instruction FREM
public static final Instruction FRETURN
public static final Instruction FSUB
public static final Instruction I2B
public static final Instruction I2C
public static final Instruction I2D
public static final Instruction I2F
public static final Instruction I2L
public static final Instruction I2S
public static final Instruction IADD
public static final Instruction IALOAD
public static final Instruction IAND
public static final Instruction IASTORE
public static final Instruction IDIV
public static final Instruction IMUL
public static final Instruction INEG
public static final Instruction IOR
public static final Instruction IREM
public static final Instruction IRETURN
public static final Instruction ISHL
public static final Instruction ISHR
public static final Instruction ISUB
public static final Instruction IUSHR
public static final Instruction IXOR
public static final Instruction L2D
public static final Instruction L2F
public static final Instruction L2I
public static final Instruction LADD
public static final Instruction LALOAD
public static final Instruction LAND
public static final Instruction LASTORE
public static final Instruction LCMP
public static final Instruction LDIV
public static final Instruction LMUL
public static final Instruction LNEG
public static final Instruction LOR
public static final Instruction LREM
public static final Instruction LRETURN
public static final Instruction LSHL
public static final Instruction LSHR
public static final Instruction LSUB
public static final Instruction LUSHR
public static final Instruction LXOR
public static final Instruction MONITORENTER
public static final Instruction MONITOREXIT
public static final Instruction NOP
public static final Instruction POP
public static final Instruction POP2
public static final Instruction RETURN
public static final Instruction SALOAD
public static final Instruction SASTORE
public static final Instruction SWAP
Method Detail |
---|
public static final Instruction ALOAD(int theIndex) throws OutOfRangeException
theIndex
- Local variable index.
OutOfRangeException
- Thrown if theIndex is not in the range 0 .. 65535.public static final Instruction ANEWARRAY(ArrayOrClassReference theType)
theType
- Component type for the new array (an array or class
reference).
NullPointerException
- (unchecked exception) Thrown if theType is null.public static final Instruction ASTORE(int theIndex) throws OutOfRangeException
theIndex
- Local variable index.
OutOfRangeException
- Thrown if theIndex is not in the range 0 .. 65535.public static final Instruction CHECKCAST(ArrayOrClassReference theType)
theType
- Type to check (an array or class reference).
NullPointerException
- (unchecked exception) Thrown if theType is null.public static final Instruction DLOAD(int theIndex) throws OutOfRangeException
theIndex
- Local variable index.
OutOfRangeException
- Thrown if theIndex is not in the range 0 .. 65535.public static final Instruction DSTORE(int theIndex) throws OutOfRangeException
theIndex
- Local variable index.
OutOfRangeException
- Thrown if theIndex is not in the range 0 .. 65535.public static final Instruction FLOAD(int theIndex) throws OutOfRangeException
theIndex
- Local variable index.
OutOfRangeException
- Thrown if theIndex is not in the range 0 .. 65535.public static final Instruction FSTORE(int theIndex) throws OutOfRangeException
theIndex
- Local variable index.
OutOfRangeException
- Thrown if theIndex is not in the range 0 .. 65535.public static final Instruction GETFIELD(FieldReference theField)
theField
- Field in the symbolic link.
NullPointerException
- (unchecked exception) Thrown if theField is null.public static final Instruction GETSTATIC(FieldReference theField)
theField
- Field in the symbolic link.
NullPointerException
- (unchecked exception) Thrown if theField is null.public static final Instruction GOTO(Location theTarget)
theTarget
- Target location for the branch.
NullPointerException
- (unchecked exception) Thrown if theTarget is null.public static final Instruction GOTO_W(Location theTarget)
theTarget
- Target location for the branch.
NullPointerException
- (unchecked exception) Thrown if theTarget is null.public static final Instruction IF_ACMPEQ(Location theTarget)
theTarget
- Target location for the branch.
NullPointerException
- (unchecked exception) Thrown if theTarget is null.public static final Instruction IF_ACMPNE(Location theTarget)
theTarget
- Target location for the branch.
NullPointerException
- (unchecked exception) Thrown if theTarget is null.public static final Instruction IF_ICMPEQ(Location theTarget)
theTarget
- Target location for the branch.
NullPointerException
- (unchecked exception) Thrown if theTarget is null.public static final Instruction IF_ICMPNE(Location theTarget)
theTarget
- Target location for the branch.
NullPointerException
- (unchecked exception) Thrown if theTarget is null.public static final Instruction IF_ICMPLT(Location theTarget)
theTarget
- Target location for the branch.
NullPointerException
- (unchecked exception) Thrown if theTarget is null.public static final Instruction IF_ICMPGE(Location theTarget)
theTarget
- Target location for the branch.
NullPointerException
- (unchecked exception) Thrown if theTarget is null.public static final Instruction IF_ICMPGT(Location theTarget)
theTarget
- Target location for the branch.
NullPointerException
- (unchecked exception) Thrown if theTarget is null.public static final Instruction IF_ICMPLE(Location theTarget)
theTarget
- Target location for the branch.
NullPointerException
- (unchecked exception) Thrown if theTarget is null.public static final Instruction IFEQ(Location theTarget)
theTarget
- Target location for the branch.
NullPointerException
- (unchecked exception) Thrown if theTarget is null.public static final Instruction IFNE(Location theTarget)
theTarget
- Target location for the branch.
NullPointerException
- (unchecked exception) Thrown if theTarget is null.public static final Instruction IFLT(Location theTarget)
theTarget
- Target location for the branch.
NullPointerException
- (unchecked exception) Thrown if theTarget is null.public static final Instruction IFGE(Location theTarget)
theTarget
- Target location for the branch.
NullPointerException
- (unchecked exception) Thrown if theTarget is null.public static final Instruction IFGT(Location theTarget)
theTarget
- Target location for the branch.
NullPointerException
- (unchecked exception) Thrown if theTarget is null.public static final Instruction IFLE(Location theTarget)
theTarget
- Target location for the branch.
NullPointerException
- (unchecked exception) Thrown if theTarget is null.public static final Instruction IFNONNULL(Location theTarget)
theTarget
- Target location for the branch.
NullPointerException
- (unchecked exception) Thrown if theTarget is null.public static final Instruction IFNULL(Location theTarget)
theTarget
- Target location for the branch.
NullPointerException
- (unchecked exception) Thrown if theTarget is null.public static final Instruction IINC(int theIndex, int theAmount) throws OutOfRangeException
theIndex
- Local variable index.theAmount
- Amount by which to increment the local variable.
OutOfRangeException
- Thrown if theIndex is not in the range 0 .. 65535 or
theAmount is not in the range -32768 .. 32767.public static final Instruction ILOAD(int theIndex) throws OutOfRangeException
theIndex
- Local variable index.
OutOfRangeException
- Thrown if theIndex is not in the range 0 .. 65535.public static final Instruction INSTANCEOF(ArrayOrClassReference theType)
theType
- Type to check (an array or class reference).
NullPointerException
- (unchecked exception) Thrown if theType is null.public static final Instruction INVOKEINTERFACE(SubroutineReference theMethod)
theMethod
- Method in the symbolic link.
NullPointerException
- (unchecked exception) Thrown if theMethod is null.public static final Instruction INVOKESPECIAL(SubroutineReference theMethod)
theMethod
- Method in the symbolic link.
NullPointerException
- (unchecked exception) Thrown if theMethod is null.public static final Instruction INVOKESTATIC(SubroutineReference theMethod)
theMethod
- Method in the symbolic link.
NullPointerException
- (unchecked exception) Thrown if theMethod is null.public static final Instruction INVOKEVIRTUAL(SubroutineReference theMethod)
theMethod
- Method in the symbolic link.
NullPointerException
- (unchecked exception) Thrown if theMethod is null.public static final Instruction ISTORE(int theIndex) throws OutOfRangeException
theIndex
- Local variable index.
OutOfRangeException
- Thrown if theIndex is not in the range 0 .. 65535.public static final Instruction JSR(Location theTarget)
theTarget
- Target location for the branch.
NullPointerException
- (unchecked exception) Thrown if theTarget is null.public static final Instruction JSR_W(Location theTarget)
theTarget
- Target location for the branch.
NullPointerException
- (unchecked exception) Thrown if theTarget is null.public static final Instruction LDC(String theValue)
theValue
- String value to push.
public static final Instruction LDC(int theValue)
theValue
- Integer value to push.
public static final Instruction LDC(float theValue)
theValue
- Float value to push.
public static final Instruction LDC(long theValue)
theValue
- Long value to push.
public static final Instruction LDC(double theValue)
theValue
- Double value to push.
public static final Instruction LLOAD(int theIndex) throws OutOfRangeException
theIndex
- Local variable index.
OutOfRangeException
- Thrown if theIndex is not in the range 0 .. 65535.public static final SwitchInstruction LOOKUPSWITCH(Location theDefaultTarget)
SwitchInstruction
.
theDefaultTarget
- Target branch location for the default
case.
NullPointerException
- (unchecked exception) Thrown if theDefaultTarget is null.public static final Instruction LSTORE(int theIndex) throws OutOfRangeException
theIndex
- Local variable index.
OutOfRangeException
- Thrown if theIndex is not in the range 0 .. 65535.public static final Instruction MULTIANEWARRAY(ArrayReference theArrayType, int theDimensions) throws OutOfRangeException
theArrayType
- Type of the new array. This must be an array
reference with at least as many dimensions as
theDimensions.theDimensions
- Number of dimensions to create.
NullPointerException
- (unchecked exception) Thrown if theArrayType is null.
OutOfRangeException
- Thrown if theDimensions is not in the range 1 .. 255, or if
theDimensions is greater than the number of dimensions in
theArrayType.public static final Instruction NEW(ClassReference theType)
theType
- Type for the new object (a class reference). It should
refer to a class, not an interface.
NullPointerException
- (unchecked exception) Thrown if theType is null.public static final Instruction NEWARRAY(PrimitiveReference theType)
theType
- Component type for the new array (a primitive
reference).
NullPointerException
- (unchecked exception) Thrown if theType is null.public static final Instruction PUTFIELD(FieldReference theField)
theField
- Field in the symbolic link.
NullPointerException
- (unchecked exception) Thrown if theField is null.public static final Instruction PUTSTATIC(FieldReference theField)
theField
- Field in the symbolic link.
NullPointerException
- (unchecked exception) Thrown if theField is null.public static final Instruction RET(int theIndex) throws OutOfRangeException
theIndex
- Local variable index.
OutOfRangeException
- Thrown if theIndex is not in the range 0 .. 65535.public static final SwitchInstruction TABLESWITCH(Location theDefaultTarget)
SwitchInstruction
.
theDefaultTarget
- Target branch location for the default
case.
NullPointerException
- (unchecked exception) Thrown if theDefaultTarget is null.public static final Instruction TLOAD(int theIndex, TypeReference theType) throws OutOfRangeException
theIndex
- Local variable index.theType
- Local variable type.
OutOfRangeException
- Thrown if theIndex is not in the range 0 .. 65535.public static final Instruction TSTORE(int theIndex, TypeReference theType) throws OutOfRangeException
theIndex
- Local variable index.theType
- Local variable type.
OutOfRangeException
- Thrown if theIndex is not in the range 0 .. 65535.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |