Opcodes by Function

back
  1. Data Operations
    1. The Stack
      1. Pushing constants onto the stack
      2. Stack Manipulation
    2. Local Variables
      1. Push local
      2. Pop stack into local var
    3. Arrays
      1. Creating arrays
      2. Pushing array values
      3. Storing values in arrays
    4. Objects
    5. Transformations
      1. Arithmetic
      2. Bit Operations
      3. Type Conversions
  2. Process Control
    1. Transfer
      1. Conditional Branching
      2. Comparisons
      3. Unconditional Branches
      4. Tables
    2. Methods
  3. Miscellany

Data Operations

The Stack

Pushing constants onto the stack
bipush
Push a signed byte.
sipush
Push a signed word.
ldc
Push a single word constant.
ldc_w
Push a single word constant. (16-bit ref in constant pool)
ldc2_w
Push a double word constant.
aconst_null
Push the null object.
iconst_m1
Push integer -1.
iconst_n
Integers n = 0..5.
lconst_v
Longs v = 0..1.
fconst_v
Floats v = 0.0..2.0.
dconst_v
Doubles v = 0.0..1.0.
Stack Manipulation
nop
Do nothing.
pop
Pop the top word.
pop2
Pop the top two words.
dup
Duplicate the top word to place 2.
dup2
Duplicate the top two words.
dup_x1
Duplicate the top word to place 3.
dup2_x1
Duplicate the top two words to places 4 and 5.
dup_x2
Duplicate the top word to place 4.
dup2_x2
Duplicate the top two words to places 5 and 6.
swap
Swap the top two words.

Local Variables

Push local
aload
Load object from local variable n
aload_n
Load object from local variable n : n = 0..3
dload
Load double from local variable n
dload_n
Load double from local variable n : n = 0..3
fload
Load float from local variable n
fload_n
Load float from local variable n : n = 0..3
iload
Load integer from local variable n
iload_n
Load integer from local variable n : n = 0..3
lload
Load long from local variable n
lload_n
Load long from local variable n : n = 0..3
Pop stack into local var
astore
store object in local variable n
astore_n
store object in local variable n : n = 0..3
dstore
store double in local variable n
dstore_n
store double in local variable n : n = 0..3
fstore
store float in local variable n
fstore_n
store float in local variable n : n = 0..3
istore
store integer in local variable n
istore_n
store integer in local variable n : n = 0..3
lstore
store long in local variable n
lstore_n
store long in local variable n : n = 0..3

Arrays

Creating arrays
newarray
New array of primitive type
anewarray
New array of objects
multianewarray
New multidimensional array
Pushing array values
aaload
Push object from array.
baload
Push byte or boolean from array.
caload
Push char from array.
daload
Push double from array.
faload
Push float from array.
iaload
Push integer from array.
laload
Push long from array.
saload
Push short from array.
Storing values in arrays
aastore
Store object in array.
bastore
Store byte or boolean in array.
castore
Store char in array.
dastore
Store double in array.
fastore
Store float in array.
iastore
Store integer in array.
lastore
Store long in array.
sastore
Store short in array.

Objects

arraylength
Get length of array.
new
Allocate mem for object.
putfield
Store an instance variable.
getfield
Push an instance variable.
putstatic
Store a static object's variable.
getstatic
Push a static object's variable.
checkcast
Checks object type of stack top.
instanceof
Checks object's class.

Transformations

Arithmetic
iinc
Increment local var.
dadd
Add two doubles.
fadd
Add two floats.
iadd
Add two integers.
ladd
Add two longs.
dsub
Subtract two doubles.
fsub
Subtract two floats.
isub
Subtract two integers.
lsub
Subtract two longs.
dmul
Multiply two doubles.
fmul
Multiply two floats.
imul
Multiply two integers.
lmul
Multiply two longs.
ddiv
Divide two doubles.
fdiv
Divide two floats.
idiv
Divide two integers.
ldiv
Divide two longs.
drem
Take remainder of two doubles.
frem
Take remainder of two floats.
irem
Take remainder of two integers.
lrem
Take remainder of two longs.
dneg
Negate a double.
fneg
Negate a float.
ineg
Negate a integer.
lneg
Negate a long.
Bit Operations
ishl
shift integer left
ishr
shift integer right
iushr
shift integer right without regard to sign
lshl
shift long left
lshr
shift long righ
lushr
shift long right without regard to sign
iand
and two integers
land
and two longs
ior
or two integers
lor
or two longs
ixor
exclusive or two integers
lxor
exclusive or two longs
Type Conversions
i2l
integer to long
i2f
integer to float
i2d
integer to double
i2b
integer to byte
i2s
integer to short
i2c
integer to char
l2i
long to integer
l2f
long to float
l2d
long to double
f2i
float to integer
f2l
float to long
f2d
float to double
d2i
double to integer
d2l
double to long
d2f
double to float

Process Control

Transfer

Conditional Branching
ifeq
branch if equal
ifne
branch if not equal
iflt
branch if less than
ifle
branch if less than or equal
ifgt
branch if greater than
ifge
branch if greater than or equal
ifnull
branch if null
ifnonnull
branch if not null
if_icmpeq
branch if two ints are equal
if_icmpne
branch if two ints are not equal
if_icmplt
branch if int2 less than int1
if_icmple
branch if int2 less than or equal to int1
if_icmpgt
branch if int2 greater than int1
if_icmpge
branch if int2 greater than or equal to int1
if_acmpeq
branch if references are equal
if_acmpne
branch if references are uneqal
Comparisons
lcmp
compare two longs
fcmpl
compare two floats (-1 on NaN)
fcmpg
compare two floats (1 on NaN)
dcmpl
compare two doubles (-1 on NaN)
dcmpg
compare two doubles (1 on NaN)
Unconditional Branches
goto
go to label
goto_w
go to label (wide address)
jsr
jump to subroutine
jsr_w
jump to subroutine (wide address)
ret
return from subroutine
Tables
lookupswitch
case statement equivalent
tableswitch
branch by range of values

Methods

invokeinterface
call interface method
invokespecial
call method in a specific class
invokestatic
call a static method
invokevirtual
call any other method
ireturn
return from method with integer
lreturn
return from method with long
freturn
return from method with float
dreturn
return from method with double
areturn
return from method with object
return
return from method with nothing

Miscellany

athrow
throw exception
breakpoint
used for debugging
wide
used for 2-word address or value
monitorenter
begin sychronization
monitorexit
end sychronization
Last modified: April 29, 1998

back to opcode reference.