edu.rit.classfile
Class Op

java.lang.Object
  extended by edu.rit.classfile.Op

public class Op
extends Object

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:

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

AALOAD

public static final Instruction AALOAD
An aaload instruction. This loads a reference value from an array.


AASTORE

public static final Instruction AASTORE
An aastore instruction. This stores a reference value into an array.


ACONST_NULL

public static final Instruction ACONST_NULL
An aconst_null instruction. This pushes null.


ARETURN

public static final Instruction ARETURN
An areturn instruction. This returns a reference value from a method.


ARRAYLENGTH

public static final Instruction ARRAYLENGTH
An arraylength instruction. This gets the length of an array.


ATHROW

public static final Instruction ATHROW
An athrow instruction. This throws an exception or error.


BALOAD

public static final Instruction BALOAD
A baload instruction. This loads a byte or boolean value from an array.


BASTORE

public static final Instruction BASTORE
A bastore instruction. This stores a byte or boolean value into an array.


CALOAD

public static final Instruction CALOAD
A caload instruction. This loads a char value from an array.


CASTORE

public static final Instruction CASTORE
A castore instruction. This stores a char value into an array.


D2F

public static final Instruction D2F
A d2f instruction. This converts a double value to a float value.


D2I

public static final Instruction D2I
A d2i instruction. This converts a double value to an int value.


D2L

public static final Instruction D2L
A d2l instruction. This converts a double value to a long value.


DADD

public static final Instruction DADD
A dadd instruction. This adds two double values.


DALOAD

public static final Instruction DALOAD
A daload instruction. This loads a double value from an array.


DASTORE

public static final Instruction DASTORE
A dastore instruction. This stores a double value into an array.


DCMPG

public static final Instruction DCMPG
A dcmpg instruction. This compares two double values. If either value is NaN, the first value is considered to be greater than the second value.


DCMPL

public static final Instruction DCMPL
A dcmpl instruction. This compares two double values. If either value is NaN, the first value is considered to be less than the second value.


DDIV

public static final Instruction DDIV
A ddiv instruction. This divides two double values.


DMUL

public static final Instruction DMUL
A dmul instruction. This multiplies two double values.


DNEG

public static final Instruction DNEG
A dneg instruction. This negates a double value.


DREM

public static final Instruction DREM
A drem instruction. This computes the remainder from dividing two double values.


DRETURN

public static final Instruction DRETURN
A dreturn instruction. This returns a double value from a method.


DSUB

public static final Instruction DSUB
A dsub instruction. This subtracts two double values.


DUP

public static final Instruction DUP
A dup instruction. This pushes a copy of the word at the top of the operand stack.


DUP_X1

public static final Instruction DUP_X1
A dup_x1 instruction. This inserts a copy of the word at the top of the operand stack below the two words at the top of the operand stack.


DUP_X2

public static final Instruction DUP_X2
A dup_x2 instruction. This inserts a copy of the word at the top of the operand stack below the three words at the top of the operand stack.


DUP2

public static final Instruction DUP2
A dup2 instruction. This pushes a copy of the two words at the top of the operand stack.


DUP2_X1

public static final Instruction DUP2_X1
A dup2_x1 instruction. This inserts a copy of the two words at the top of the operand stack below the three words at the top of the operand stack.


DUP2_X2

public static final Instruction DUP2_X2
A dup2_x2 instruction. This inserts a copy of the two words at the top of the operand stack below the four words at the top of the operand stack.


F2D

public static final Instruction F2D
An f2d instruction. This converts a float value to a double value.


F2I

public static final Instruction F2I
An f2i instruction. This converts a float value to an int value.


F2L

public static final Instruction F2L
An f2l instruction. This converts a float value to a long value.


FADD

public static final Instruction FADD
An fadd instruction. This adds two float values.


FALOAD

public static final Instruction FALOAD
An faload instruction. This loads a float value from an array.


FASTORE

public static final Instruction FASTORE
An fastore instruction. This stores a float value into an array.


FCMPG

public static final Instruction FCMPG
An fcmpg instruction. This compares two float values. If either value is NaN, the first value is considered to be greater than the second value.


FCMPL

public static final Instruction FCMPL
An fcmpl instruction. This compares two float values. If either value is NaN, the first value is considered to be less than the second value.


FDIV

public static final Instruction FDIV
An fdiv instruction. This divides two float values.


FMUL

public static final Instruction FMUL
An fmul instruction. This multiplies two float values.


FNEG

public static final Instruction FNEG
An fneg instruction. This negates a float value.


FREM

public static final Instruction FREM
An frem instruction. This computes the remainder from dividing two float values.


FRETURN

public static final Instruction FRETURN
An freturn instruction. This returns a float value from a method.


FSUB

public static final Instruction FSUB
An fsub instruction. This subtracts two float values.


I2B

public static final Instruction I2B
An i2b instruction. This converts an int value to a byte value.


I2C

public static final Instruction I2C
An i2c instruction. This converts an int value to a char value.


I2D

public static final Instruction I2D
An i2d instruction. This converts an int value to a double value.


I2F

public static final Instruction I2F
An i2f instruction. This converts an int value to a float value.


I2L

public static final Instruction I2L
An i2l instruction. This converts an int value to a long value.


I2S

public static final Instruction I2S
An i2s instruction. This converts an int value to a short value.


IADD

public static final Instruction IADD
An iadd instruction. This adds two int values.


IALOAD

public static final Instruction IALOAD
An iaload instruction. This loads an int value from an array.


IAND

public static final Instruction IAND
An iand instruction. This bitwise-ands two int values.


IASTORE

public static final Instruction IASTORE
An iastore instruction. This stores an int value into an array.


IDIV

public static final Instruction IDIV
An idiv instruction. This divides two int values.


IMUL

public static final Instruction IMUL
An imul instruction. This multiplies two int values.


INEG

public static final Instruction INEG
An ineg instruction. This negates an int value.


IOR

public static final Instruction IOR
An ior instruction. This bitwise-ors two int values.


IREM

public static final Instruction IREM
An irem instruction. This computes the remainder from dividing two int values.


IRETURN

public static final Instruction IRETURN
An ireturn instruction. This returns an int value from a method.


ISHL

public static final Instruction ISHL
An ishl instruction. This left-shifts an int value.


ISHR

public static final Instruction ISHR
An ishr instruction. This arithmetic right-shifts an int value (with sign extension).


ISUB

public static final Instruction ISUB
An isub instruction. This subtracts two int values.


IUSHR

public static final Instruction IUSHR
An iushr instruction. This logical right-shifts an int value (with zero extension).


IXOR

public static final Instruction IXOR
An ixor instruction. This bitwise-exclusive-ors two int values.


L2D

public static final Instruction L2D
An l2d instruction. This converts a long value to a double value.


L2F

public static final Instruction L2F
An l2f instruction. This converts a long value to a float value.


L2I

public static final Instruction L2I
An l2i instruction. This converts a long value to an int value.


LADD

public static final Instruction LADD
An ladd instruction. This adds two long values.


LALOAD

public static final Instruction LALOAD
An laload instruction. This loads a long value from an array.


LAND

public static final Instruction LAND
An land instruction. This bitwise-ands two long values.


LASTORE

public static final Instruction LASTORE
An lastore instruction. This stores a long value into an array.


LCMP

public static final Instruction LCMP
An lcmp instruction. This compares two long values.


LDIV

public static final Instruction LDIV
An ldiv instruction. This divides two long values.


LMUL

public static final Instruction LMUL
An lmul instruction. This multiplies two long values.


LNEG

public static final Instruction LNEG
An lneg instruction. This negates a long value.


LOR

public static final Instruction LOR
An lor instruction. This bitwise-ors two long values.


LREM

public static final Instruction LREM
An lrem instruction. This computes the remainder from dividing two long values.


LRETURN

public static final Instruction LRETURN
An lreturn instruction. This returns a long value from a method.


LSHL

public static final Instruction LSHL
An lshl instruction. This left-shifts a long value.


LSHR

public static final Instruction LSHR
An lshr instruction. This arithmetic right-shifts a long value (with sign extension).


LSUB

public static final Instruction LSUB
An lsub instruction. This subtracts two long values.


LUSHR

public static final Instruction LUSHR
An lushr instruction. This logical right-shifts a long value (with zero extension).


LXOR

public static final Instruction LXOR
An lxor instruction. This bitwise-exclusive-ors two long values.


MONITORENTER

public static final Instruction MONITORENTER
A monitorenter instruction. This enters an object's monitor.


MONITOREXIT

public static final Instruction MONITOREXIT
A monitorexit instruction. This exits an object's monitor.


NOP

public static final Instruction NOP
A nop instruction. This does nothing.


POP

public static final Instruction POP
A pop instruction. This pops the top word off the operand stack.


POP2

public static final Instruction POP2
A pop2 instruction. This pops the top two words off the operand stack.


RETURN

public static final Instruction RETURN
A return instruction. This returns void from a method.


SALOAD

public static final Instruction SALOAD
An saload instruction. This loads a short value from an array.


SASTORE

public static final Instruction SASTORE
An sastore instruction. This stores a short value into an array.


SWAP

public static final Instruction SWAP
A swap instruction. This interchanges the first word with the second word on the operand stack.

Method Detail

ALOAD

public static final Instruction ALOAD(int theIndex)
                               throws OutOfRangeException
An aload instruction. This pushes onto the operand stack a reference value from the local variable at the given index. If the index is in the range 0 .. 3, the opcode is aload_0 through aload_3; if the index is in the range 4 .. 255, the opcode is aload; if the index is in the range 256 .. 65535, the opcode is wide aload.

Parameters:
theIndex - Local variable index.
Returns:
aload instruction.
Throws:
OutOfRangeException - Thrown if theIndex is not in the range 0 .. 65535.

ANEWARRAY

public static final Instruction ANEWARRAY(ArrayOrClassReference theType)
An anewarray instruction. This creates a new array of reference values.

Parameters:
theType - Component type for the new array (an array or class reference).
Returns:
anewarray instruction.
Throws:
NullPointerException - (unchecked exception) Thrown if theType is null.

ASTORE

public static final Instruction ASTORE(int theIndex)
                                throws OutOfRangeException
An astore instruction. This pops from the operand stack a reference value into the local variable at the given index. If the index is in the range 0 .. 3, the opcode is astore_0 through astore_3; if the index is in the range 4 .. 255, the opcode is astore; if the index is in the range 256 .. 65535, the opcode is wide astore.

Parameters:
theIndex - Local variable index.
Returns:
astore instruction.
Throws:
OutOfRangeException - Thrown if theIndex is not in the range 0 .. 65535.

CHECKCAST

public static final Instruction CHECKCAST(ArrayOrClassReference theType)
A checkcast instruction. This checks whether an object can be cast to the given type.

Parameters:
theType - Type to check (an array or class reference).
Returns:
checkcast instruction.
Throws:
NullPointerException - (unchecked exception) Thrown if theType is null.

DLOAD

public static final Instruction DLOAD(int theIndex)
                               throws OutOfRangeException
A dload instruction. This pushes onto the operand stack a double value from the two local variables starting at the given index. If the index is in the range 0 .. 3, the opcode is dload_0 through dload_3; if the index is in the range 4 .. 255, the opcode is dload; if the index is in the range 256 .. 65535, the opcode is wide dload.

Parameters:
theIndex - Local variable index.
Returns:
dload instruction.
Throws:
OutOfRangeException - Thrown if theIndex is not in the range 0 .. 65535.

DSTORE

public static final Instruction DSTORE(int theIndex)
                                throws OutOfRangeException
A dstore instruction. This pops from the operand stack a double value into the two local variables starting at the given index. If the index is in the range 0 .. 3, the opcode is dstore_0 through dstore_3; if the index is in the range 4 .. 255, the opcode is dstore; if the index is in the range 256 .. 65535, the opcode is wide dstore.

Parameters:
theIndex - Local variable index.
Returns:
dstore instruction.
Throws:
OutOfRangeException - Thrown if theIndex is not in the range 0 .. 65535.

FLOAD

public static final Instruction FLOAD(int theIndex)
                               throws OutOfRangeException
An fload instruction. This pushes onto the operand stack a float value from the local variable at the given index. If the index is in the range 0 .. 3, the opcode is fload_0 through fload_3; if the index is in the range 4 .. 255, the opcode is fload; if the index is in the range 256 .. 65535, the opcode is wide fload.

Parameters:
theIndex - Local variable index.
Returns:
fload instruction.
Throws:
OutOfRangeException - Thrown if theIndex is not in the range 0 .. 65535.

FSTORE

public static final Instruction FSTORE(int theIndex)
                                throws OutOfRangeException
An fstore instruction. This pops from the operand stack a float value into the local variable at the given index. If the index is in the range 0 .. 3, the opcode is fstore_0 through fstore_3; if the index is in the range 4 .. 255, the opcode is fstore; if the index is in the range 256 .. 65535, the opcode is wide fstore.

Parameters:
theIndex - Local variable index.
Returns:
fstore instruction.
Throws:
OutOfRangeException - Thrown if theIndex is not in the range 0 .. 65535.

GETFIELD

public static final Instruction GETFIELD(FieldReference theField)
A getfield instruction. This loads an instance field of an object.

Parameters:
theField - Field in the symbolic link.
Returns:
getfield instruction.
Throws:
NullPointerException - (unchecked exception) Thrown if theField is null.

GETSTATIC

public static final Instruction GETSTATIC(FieldReference theField)
A getstatic instruction. This loads a static field of a class.

Parameters:
theField - Field in the symbolic link.
Returns:
getstatic instruction.
Throws:
NullPointerException - (unchecked exception) Thrown if theField is null.

GOTO

public static final Instruction GOTO(Location theTarget)
A goto instruction. This performs an unconditional branch. The branch target location must be no more than 32768 bytes before and no more than 32767 bytes after the goto instruction; otherwise, a ByteCodeException will be thrown when the classfile containing the goto instruction is emitted.

Parameters:
theTarget - Target location for the branch.
Returns:
goto instruction.
Throws:
NullPointerException - (unchecked exception) Thrown if theTarget is null.

GOTO_W

public static final Instruction GOTO_W(Location theTarget)
A goto_w instruction. This performs an unconditional branch. The branch target location may be any number of bytes before or after the goto instruction.

Parameters:
theTarget - Target location for the branch.
Returns:
goto_w instruction.
Throws:
NullPointerException - (unchecked exception) Thrown if theTarget is null.

IF_ACMPEQ

public static final Instruction IF_ACMPEQ(Location theTarget)
An if_acmpeq instruction. This performs a conditional branch if a reference value is equal to another reference value.

Parameters:
theTarget - Target location for the branch.
Returns:
if_acmpeq instruction.
Throws:
NullPointerException - (unchecked exception) Thrown if theTarget is null.

IF_ACMPNE

public static final Instruction IF_ACMPNE(Location theTarget)
An if_acmpne instruction. This performs a conditional branch if a reference value is not equal to another reference value.

Parameters:
theTarget - Target location for the branch.
Returns:
if_acmpne instruction.
Throws:
NullPointerException - (unchecked exception) Thrown if theTarget is null.

IF_ICMPEQ

public static final Instruction IF_ICMPEQ(Location theTarget)
An if_icmpeq instruction. This performs a conditional branch if an int value is equal to another int value.

Parameters:
theTarget - Target location for the branch.
Returns:
if_icmpeq instruction.
Throws:
NullPointerException - (unchecked exception) Thrown if theTarget is null.

IF_ICMPNE

public static final Instruction IF_ICMPNE(Location theTarget)
An if_icmpne instruction. This performs a conditional branch if an int value is not equal to another int value.

Parameters:
theTarget - Target location for the branch.
Returns:
if_icmpne instruction.
Throws:
NullPointerException - (unchecked exception) Thrown if theTarget is null.

IF_ICMPLT

public static final Instruction IF_ICMPLT(Location theTarget)
An if_icmplt instruction. This performs a conditional branch if an int value is less than another int value.

Parameters:
theTarget - Target location for the branch.
Returns:
if_icmplt instruction.
Throws:
NullPointerException - (unchecked exception) Thrown if theTarget is null.

IF_ICMPGE

public static final Instruction IF_ICMPGE(Location theTarget)
An if_icmpge instruction. This performs a conditional branch if an int value is greater than or equal to another int value.

Parameters:
theTarget - Target location for the branch.
Returns:
if_icmpge instruction.
Throws:
NullPointerException - (unchecked exception) Thrown if theTarget is null.

IF_ICMPGT

public static final Instruction IF_ICMPGT(Location theTarget)
An if_icmpgt instruction. This performs a conditional branch if an int value is greater than another int value.

Parameters:
theTarget - Target location for the branch.
Returns:
if_icmpgt instruction.
Throws:
NullPointerException - (unchecked exception) Thrown if theTarget is null.

IF_ICMPLE

public static final Instruction IF_ICMPLE(Location theTarget)
An if_icmple instruction. This performs a conditional branch if an int value is less than or equal to another int value.

Parameters:
theTarget - Target location for the branch.
Returns:
if_icmple instruction.
Throws:
NullPointerException - (unchecked exception) Thrown if theTarget is null.

IFEQ

public static final Instruction IFEQ(Location theTarget)
An ifeq instruction. This performs a conditional branch if an int value is equal to zero.

Parameters:
theTarget - Target location for the branch.
Returns:
ifeq instruction.
Throws:
NullPointerException - (unchecked exception) Thrown if theTarget is null.

IFNE

public static final Instruction IFNE(Location theTarget)
An ifne instruction. This performs a conditional branch if an int value is not equal to zero.

Parameters:
theTarget - Target location for the branch.
Returns:
ifne instruction.
Throws:
NullPointerException - (unchecked exception) Thrown if theTarget is null.

IFLT

public static final Instruction IFLT(Location theTarget)
An iflt instruction. This performs a conditional branch if an int value is less than zero.

Parameters:
theTarget - Target location for the branch.
Returns:
iflt instruction.
Throws:
NullPointerException - (unchecked exception) Thrown if theTarget is null.

IFGE

public static final Instruction IFGE(Location theTarget)
An ifge instruction. This performs a conditional branch if an int value is greater than or equal to zero.

Parameters:
theTarget - Target location for the branch.
Returns:
ifge instruction.
Throws:
NullPointerException - (unchecked exception) Thrown if theTarget is null.

IFGT

public static final Instruction IFGT(Location theTarget)
An ifgt instruction. This performs a conditional branch if an int value is greater than zero.

Parameters:
theTarget - Target location for the branch.
Returns:
ifgt instruction.
Throws:
NullPointerException - (unchecked exception) Thrown if theTarget is null.

IFLE

public static final Instruction IFLE(Location theTarget)
An ifle instruction. This performs a conditional branch if an int value is less than or equal to zero.

Parameters:
theTarget - Target location for the branch.
Returns:
ifle instruction.
Throws:
NullPointerException - (unchecked exception) Thrown if theTarget is null.

IFNONNULL

public static final Instruction IFNONNULL(Location theTarget)
An ifnonnull instruction. This performs a conditional branch if a reference value is not null.

Parameters:
theTarget - Target location for the branch.
Returns:
ifnonnull instruction.
Throws:
NullPointerException - (unchecked exception) Thrown if theTarget is null.

IFNULL

public static final Instruction IFNULL(Location theTarget)
An ifnull instruction. This performs a conditional branch if a reference value is null.

Parameters:
theTarget - Target location for the branch.
Returns:
ifnull instruction.
Throws:
NullPointerException - (unchecked exception) Thrown if theTarget is null.

IINC

public static final Instruction IINC(int theIndex,
                                     int theAmount)
                              throws OutOfRangeException
An iinc instruction. This increments the int valued local variable at the given index by the given amount. If the index is in the range 0 .. 255 and the amount is in the range -128 .. 127, the opcode is iinc. If the index is in the range 0 .. 65535 or the amount is in the range -32768 .. 32767, the opcode is wide iinc.

Parameters:
theIndex - Local variable index.
theAmount - Amount by which to increment the local variable.
Returns:
fload instruction.
Throws:
OutOfRangeException - Thrown if theIndex is not in the range 0 .. 65535 or theAmount is not in the range -32768 .. 32767.

ILOAD

public static final Instruction ILOAD(int theIndex)
                               throws OutOfRangeException
An iload instruction. This pushes onto the operand stack an int value from the local variable at the given index. If the index is in the range 0 .. 3, the opcode is iload_0 through iload_3; if the index is in the range 4 .. 255, the opcode is iload; if the index is in the range 256 .. 65535, the opcode is wide iload.

Parameters:
theIndex - Local variable index.
Returns:
iload instruction.
Throws:
OutOfRangeException - Thrown if theIndex is not in the range 0 .. 65535.

INSTANCEOF

public static final Instruction INSTANCEOF(ArrayOrClassReference theType)
An instanceof instruction. This checks whether an object is an instance of the given type.

Parameters:
theType - Type to check (an array or class reference).
Returns:
instanceof instruction.
Throws:
NullPointerException - (unchecked exception) Thrown if theType is null.

INVOKEINTERFACE

public static final Instruction INVOKEINTERFACE(SubroutineReference theMethod)
An invokeinterface instruction. This invokes an interface method.

Parameters:
theMethod - Method in the symbolic link.
Returns:
invokeinterface instruction.
Throws:
NullPointerException - (unchecked exception) Thrown if theMethod is null.

INVOKESPECIAL

public static final Instruction INVOKESPECIAL(SubroutineReference theMethod)
An invokespecial instruction. This invokes an instance method, with special handling for superclass, private, and instance initialization method invocations.

Parameters:
theMethod - Method in the symbolic link.
Returns:
invokespecial instruction.
Throws:
NullPointerException - (unchecked exception) Thrown if theMethod is null.

INVOKESTATIC

public static final Instruction INVOKESTATIC(SubroutineReference theMethod)
An invokestatic instruction. This invokes a class static method.

Parameters:
theMethod - Method in the symbolic link.
Returns:
invokestatic instruction.
Throws:
NullPointerException - (unchecked exception) Thrown if theMethod is null.

INVOKEVIRTUAL

public static final Instruction INVOKEVIRTUAL(SubroutineReference theMethod)
An invokevirtual instruction. This invokes an instance method.

Parameters:
theMethod - Method in the symbolic link.
Returns:
invokevirtual instruction.
Throws:
NullPointerException - (unchecked exception) Thrown if theMethod is null.

ISTORE

public static final Instruction ISTORE(int theIndex)
                                throws OutOfRangeException
An istore instruction. This pops from the operand stack an int value into the local variable at the given index. If the index is in the range 0 .. 3, the opcode is istore_0 through istore_3; if the index is in the range 4 .. 255, the opcode is istore; if the index is in the range 256 .. 65535, the opcode is wide istore.

Parameters:
theIndex - Local variable index.
Returns:
istore instruction.
Throws:
OutOfRangeException - Thrown if theIndex is not in the range 0 .. 65535.

JSR

public static final Instruction JSR(Location theTarget)
A jsr instruction. This performs an unconditional branch to a miniature subroutine within the same bytecode sequence, pushing the return address on the operand stack. The branch target location must be no more than 32768 bytes before and no more than 32767 bytes after the jump subroutine instruction; otherwise, a ByteCodeException will be thrown when the classfile containing the jump subroutine instruction is emitted.

Parameters:
theTarget - Target location for the branch.
Returns:
jsr instruction.
Throws:
NullPointerException - (unchecked exception) Thrown if theTarget is null.

JSR_W

public static final Instruction JSR_W(Location theTarget)
A jsr_w instruction. This performs an unconditional branch to a miniature subroutine within the same bytecode sequence, pushing the return address on the operand stack. The branch target location may be any number of bytes before or after the jump subroutine instruction.

Parameters:
theTarget - Target location for the branch.
Returns:
jsr_w instruction.
Throws:
NullPointerException - (unchecked exception) Thrown if theTarget is null.

LDC

public static final Instruction LDC(String theValue)
A string ldc instruction. This pushes the given string constant value onto the operand stack. The opcode is ldc or ldc_w depending on how full the constant pool is.

Parameters:
theValue - String value to push.
Returns:
Instruction.

LDC

public static final Instruction LDC(int theValue)
An integer ldc instruction. This pushes the given integer constant value onto the operand stack. If the value is in the range –1 .. 5, the opcode is iconst_m1 through iconst_5. Otherwise, if the value is in the range –27 .. 27–1, the opcode is bipush. Otherwise, if the value is in the range –215 .. 215–1, the opcode is sipush. Otherwise, the opcode is ldc or ldc_w depending on how full the constant pool is.

Parameters:
theValue - Integer value to push.
Returns:
Instruction.

LDC

public static final Instruction LDC(float theValue)
A float ldc instruction. This pushes the given float constant value onto the operand stack. If the value is 0.0f, 1.0f, or 2.0f, the opcode is fconst_0, fconst_1, or fconst_2 respectively. Otherwise, the opcode is ldc or ldc_w depending on how full the constant pool is.

Parameters:
theValue - Float value to push.
Returns:
Instruction.

LDC

public static final Instruction LDC(long theValue)
A long ldc instruction. This pushes the given long constant value onto the operand stack. If the value is 0L or 1L, the opcode is lconst_0 or lconst_1 respectively. Otherwise, the opcode is ldc2_w.

Parameters:
theValue - Long value to push.
Returns:
Instruction.

LDC

public static final Instruction LDC(double theValue)
A double ldc instruction. This pushes the given double constant value onto the operand stack. If the value is 0.0 or 1.0, the opcode is dconst_0 or dconst_1 respectively. Otherwise, the opcode is ldc2_w.

Parameters:
theValue - Double value to push.
Returns:
Instruction.

LLOAD

public static final Instruction LLOAD(int theIndex)
                               throws OutOfRangeException
An lload instruction. This pushes onto the operand stack a long value from the local variable at the given index. If the index is in the range 0 .. 3, the opcode is lload_0 through lload_3; if the index is in the range 4 .. 255, the opcode is lload; if the index is in the range 256 .. 65535, the opcode is wide lload.

Parameters:
theIndex - Local variable index.
Returns:
lload instruction.
Throws:
OutOfRangeException - Thrown if theIndex is not in the range 0 .. 65535.

LOOKUPSWITCH

public static final SwitchInstruction LOOKUPSWITCH(Location theDefaultTarget)
A lookupswitch instruction. This branches to a target location based on an integer case value by searching in a list of (case value, target location) pairs. After creating a lookupswitch instruction, and before adding the instruction to a subroutine, add cases to the instruction as described in class SwitchInstruction.

Parameters:
theDefaultTarget - Target branch location for the default case.
Throws:
NullPointerException - (unchecked exception) Thrown if theDefaultTarget is null.

LSTORE

public static final Instruction LSTORE(int theIndex)
                                throws OutOfRangeException
An lstore instruction. This pops from the operand stack a long value into the local variable at the given index. If the index is in the range 0 .. 3, the opcode is lstore_0 through lstore_3; if the index is in the range 4 .. 255, the opcode is lstore; if the index is in the range 256 .. 65535, the opcode is wide lstore.

Parameters:
theIndex - Local variable index.
Returns:
lstore instruction.
Throws:
OutOfRangeException - Thrown if theIndex is not in the range 0 .. 65535.

MULTIANEWARRAY

public static final Instruction MULTIANEWARRAY(ArrayReference theArrayType,
                                               int theDimensions)
                                        throws OutOfRangeException
A multianewarray instruction. This creates a new multidimensional array. Note that the argument is a reference to the type of the array itself, not a reference to the type of the array's components.

Parameters:
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.
Returns:
multianewarray instruction.
Throws:
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.

NEW

public static final Instruction NEW(ClassReference theType)
A new instruction. This creates a new object of the given type.

Parameters:
theType - Type for the new object (a class reference). It should refer to a class, not an interface.
Returns:
new instruction.
Throws:
NullPointerException - (unchecked exception) Thrown if theType is null.

NEWARRAY

public static final Instruction NEWARRAY(PrimitiveReference theType)
A newarray instruction. This creates a new array of a primitive type.

Parameters:
theType - Component type for the new array (a primitive reference).
Returns:
newarray instruction.
Throws:
NullPointerException - (unchecked exception) Thrown if theType is null.

PUTFIELD

public static final Instruction PUTFIELD(FieldReference theField)
A putfield instruction. This stores into an instance field of an object.

Parameters:
theField - Field in the symbolic link.
Returns:
putfield instruction.
Throws:
NullPointerException - (unchecked exception) Thrown if theField is null.

PUTSTATIC

public static final Instruction PUTSTATIC(FieldReference theField)
A putstatic instruction. This stores into a static field of a class.

Parameters:
theField - Field in the symbolic link.
Returns:
putstatic instruction.
Throws:
NullPointerException - (unchecked exception) Thrown if theField is null.

RET

public static final Instruction RET(int theIndex)
                             throws OutOfRangeException
A ret instruction. This returns from a miniature subroutine in the bytecode sequence, with the return address being taken from the local variable at the given index. If the index is in the range 0 .. 255, the opcode is ret; if the index is in the range 256 .. 65535, the opcode is wide ret.

Parameters:
theIndex - Local variable index.
Returns:
ret instruction.
Throws:
OutOfRangeException - Thrown if theIndex is not in the range 0 .. 65535.

TABLESWITCH

public static final SwitchInstruction TABLESWITCH(Location theDefaultTarget)
A tableswitch instruction. This branches to a target location based on an integer case value by indexing a table of target locations. After creating a tableswitch instruction, and before adding the instruction to a subroutine, add cases to the instruction as described in class SwitchInstruction.

Parameters:
theDefaultTarget - Target branch location for the default case.
Throws:
NullPointerException - (unchecked exception) Thrown if theDefaultTarget is null.

TLOAD

public static final Instruction TLOAD(int theIndex,
                                      TypeReference theType)
                               throws OutOfRangeException
A type-sensitive load instruction. This pushes onto the operand stack a value from the local variable at the given index. The type of the local variable is the given type.

Parameters:
theIndex - Local variable index.
theType - Local variable type.
Returns:
The appropriate load instruction for theType.
Throws:
OutOfRangeException - Thrown if theIndex is not in the range 0 .. 65535.

TSTORE

public static final Instruction TSTORE(int theIndex,
                                       TypeReference theType)
                                throws OutOfRangeException
A type-sensitive store instruction. This pops a value from the operand stack and stores it in the local variable at the given index. The type of the local variable is the given type.

Parameters:
theIndex - Local variable index.
theType - Local variable type.
Returns:
The appropriate store instruction for theType.
Throws:
OutOfRangeException - Thrown if theIndex is not in the range 0 .. 65535.


Copyright © 2001-2006 by Alan Kaminsky. All rights reserved. Send comments to ark­@­cs.rit.edu.