- All Implemented Interfaces:
Serializable,Comparable<OpcodePREVIEW>,Constable
Opcode is a preview API of the Java platform.Programs can only use
Opcode when preview features are enabled.Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
Describes the opcodes of the JVM instruction set, as described in6.5. As well as a number of pseudo-instructions that may be encountered when traversing the instructions of a method.
- Since:
- 22
- See Also:
Nested Class Summary
Nested ClassesNested classes/interfaces declared in class java.lang.Enum
Enum.EnumDesc<E extendsEnum<E>>Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionLoad reference from arrayStore into reference arrayPush nullLoad reference from local variableLoad reference from local variable 0Load reference from local variable 1Load reference from local variable 2Load reference from local variable 3Load reference from local variable (wide index)Create new array of referenceReturn reference from methodGet length of arrayStore reference into local variableStore reference into local variable 0Store reference into local variable 1Store reference into local variable 2Store reference into local variable 3Store reference into local variable (wide index)Throw exception or errorLoad byte from arrayStore into byte arrayPush byteLoad char from arrayStore into char arrayCheck whether object is of given typeConvert double to floatConvert double to intConvert double to longAdd doubleLoad double from arrayStore into double arrayCompare doubleCompare doublePush double constant 0Push double constant 1Divide doubleLoad double from local variableLoad double from local variable 0Load double from local variable 1Load double from local variable 2Load double from local variable 3Load double from local variable (wide index)Multiply doubleNegate doubleRemainder doubleReturn double from methodStore double into local variableStore double into local variable 0Store double into local variable 1Store double into local variable 2Store double into local variable 3Store double into local variable (wide index)Subtract doubleDuplicate the top operand stack valueDuplicate the top operand stack value and insert two values downDuplicate the top operand stack value and insert two or three values downDuplicate the top one or two operand stack valuesDuplicate the top one or two operand stack values and insert two or three values downDuplicate the top one or two operand stack values and insert two, three, or four values downConvert float to doubleConvert float to intConvert float to longAdd floatLoad float from arrayStore into float arrayCompare floatCompare floatPush float constant 0Push float constant 1Push float constant 2Divide floatLoad float from local variableLoad float from local variable 0Load float from local variable 1Load float from local variable 2Load float from local variable 3Load float from local variable (wide index)Multiply floatNegate floatRemainder floatReturn float from methodStore float into local variableStore float into local variable 0Store float into local variable 1Store float into local variable 2Store float into local variable 3Store float into local variable (wide index)Subtract floatFetch field from objectGet static field from classBranch alwaysBranch always (wide index)Convert int to byteConvert int to charConvert int to doubleConvert int to floatConvert int to longConvert int to shortAdd intLoad int from arrayBoolean AND intStore into int arrayPush int constant 0Push int constant 1Push int constant 2Push int constant 3Push int constant 4Push int constant 5Push int constant -1Divide intBranch if reference comparison succeedsBranch if reference comparison succeedsBranch if int comparison succeedsBranch if int comparison succeedsBranch if int comparison succeedsBranch if int comparison succeedsBranch if int comparison succeedsBranch if int comparison succeedsBranch if int comparison with zero succeedsBranch if int comparison with zero succeedsBranch if int comparison with zero succeedsBranch if int comparison with zero succeedsBranch if int comparison with zero succeedsBranch if int comparison with zero succeedsBranch if reference not nullBranch if reference is nullIncrement local variable by constantIncrement local variable by constant (wide index)Load int from local variableLoad int from local variable 0Load int from local variable 1Load int from local variable 2Load int from local variable3Load int from local variable (wide index)Multiply intNegate intDetermine if object is of given typeInvoke a dynamically-computed call siteInvoke interface methodInvoke instance method; direct invocation of instance initialization methods and methods of the current class and its supertypesInvoke a class (static) methodInvoke instance method; dispatch based on classBoolean OR intRemainder intReturn int from methodShift left intShift right intStore int into local variableStore int into local variable 0Store int into local variable 1Store int into local variable 2Store int into local variable 3Store int into local variable (wide index)Subtract intLogical shift right intBoolean XOR intJump subroutine is discontinued opcodeJump subroutine (wide index) is discontinued opcodeConvert long to doubleConvert long to floatConvert long to intAdd longLoad long from arrayBoolean AND longStore into long arrayCompare longPush long constant 0Push long constant 1Push item from run-time constant poolPush item from run-time constant pool (wide index)Push long or double from run-time constant pool (wide index)Divide longLoad long from local variableLoad long from local variable 0Load long from local variable 1Load long from local variable 2Load long from local variable 3Load long from local variable (wide index)Multiply longNegate longAccess jump table by key match and jumpBoolean OR longRemainder longReturn long from methodShift left longShift right longStore long into local variableStore long into local variable 0Store long into local variable 1Store long into local variable 2Store long into local variable 3Store long into local variable (wide index)Subtract longLogical shift right longBoolean XOR longEnter monitor for objectExit monitor for objectCreate new multidimensional arrayCreate new objectCreate new arrayDo nothingPop the top operand stack valuePop the top one or two operand stack valuesSet field in objectSet static field in classReturn from subroutine is discontinued opcodeReturn from subroutine (wide index) is discontinued opcodeReturn void from methodLoad short from arrayStore into short arrayPush shortSwap the top two operand stack valuesAccess jump table by index and jumpMethod Summary
Modifier and TypeMethodDescriptionintbytecode()Returns bytecode.Returns constant value for constant instructions, or null otherwise.booleanReturns true if the instruction represents an unconditional branch.booleanisWide()Returns true if the instruction has extended local variable index by additional bytes.kind()Returns instruction kind.Returns primary type kind for instructions operating with at least one type, or null otherwise.Returns secondary type kind for instructions operating with two types, or null otherwise.intReturns size of the instruction if fixed, or -1 otherwise.intslot()Returns local variable slot for instructions operating with local variable, or -1 otherwise.Returns the enum constant of this class with the specified name.values()Returns an array containing the constants of this enum class, inthe order they are declared.
Enum Constant Details
NOP
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
BIPUSH
SIPUSH
LDC
LDC_W
LDC2_W
ILOAD
LLOAD
FLOAD
DLOAD
ALOAD
ILOAD_0
ILOAD_1
ILOAD_2
ILOAD_3
LLOAD_0
LLOAD_1
LLOAD_2
LLOAD_3
FLOAD_0
FLOAD_1
FLOAD_2
FLOAD_3
DLOAD_0
DLOAD_1
DLOAD_2
DLOAD_3
ALOAD_0
ALOAD_1
ALOAD_2
ALOAD_3
IALOAD
LALOAD
FALOAD
DALOAD
AALOAD
BALOAD
CALOAD
SALOAD
ISTORE
LSTORE
FSTORE
DSTORE
ASTORE
ISTORE_0
ISTORE_1
ISTORE_2
ISTORE_3
LSTORE_0
LSTORE_1
LSTORE_2
LSTORE_3
FSTORE_0
FSTORE_1
FSTORE_2
FSTORE_3
DSTORE_0
DSTORE_1
DSTORE_2
DSTORE_3
ASTORE_0
ASTORE_1
ASTORE_2
ASTORE_3
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
IINC
I2L
I2F
I2D
L2I
L2F
L2D
F2I
F2L
F2D
D2I
D2L
D2F
I2B
I2C
I2S
LCMP
FCMPL
FCMPG
DCMPL
DCMPG
IFEQ
IFNE
IFLT
IFGE
IFGT
IFLE
IF_ICMPEQ
IF_ICMPNE
IF_ICMPLT
IF_ICMPGE
IF_ICMPGT
IF_ICMPLE
IF_ACMPEQ
IF_ACMPNE
GOTO
JSR
Jump subroutine is discontinued opcode- See Also:
RET
Return from subroutine is discontinued opcode- See Also:
TABLESWITCH
LOOKUPSWITCH
IRETURN
LRETURN
FRETURN
DRETURN
ARETURN
RETURN
GETSTATIC
PUTSTATIC
GETFIELD
PUTFIELD
INVOKEVIRTUAL
INVOKESPECIAL
INVOKESTATIC
INVOKEINTERFACE
INVOKEDYNAMIC
NEW
NEWARRAY
ANEWARRAY
ARRAYLENGTH
ATHROW
CHECKCAST
INSTANCEOF
MONITORENTER
MONITOREXIT
MULTIANEWARRAY
IFNULL
IFNONNULL
GOTO_W
JSR_W
Jump subroutine (wide index) is discontinued opcode- See Also:
ILOAD_W
LLOAD_W
FLOAD_W
DLOAD_W
ALOAD_W
ISTORE_W
LSTORE_W
FSTORE_W
DSTORE_W
ASTORE_W
RET_W
Return from subroutine (wide index) is discontinued opcode- See Also:
IINC_W
Method Details
values
valueOf
Returns the enum constant of this class with the specified name.The string must matchexactly an identifier used to declare anenum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
bytecode
public int bytecode()Returns bytecode.- Returns:
- bytecode
isWide
public boolean isWide()Returns true if the instruction has extended local variable index by additional bytes.- Returns:
- true if the instruction has extended local variable index by additional bytes
sizeIfFixed
public int sizeIfFixed()Returns size of the instruction if fixed, or -1 otherwise.- Returns:
- size of the instruction if fixed, or -1 otherwise
kind
primaryTypeKind
secondaryTypeKind
slot
public int slot()Returns local variable slot for instructions operating with local variable, or -1 otherwise.- Returns:
- local variable slot for instructions operating with local variable, or -1 otherwise
constantValue
Returns constant value for constant instructions, or null otherwise.- Returns:
- constant value for constant instructions, or null otherwise
isUnconditionalBranch
public boolean isUnconditionalBranch()Returns true if the instruction represents an unconditional branch.- Returns:
- true if the instruction represents an unconditional branch