You are on page 1of 16

Other bytes

Opcode Stack
[count]:
Mnemonic Opcode (in [before]→[after Description
[operand
binary) ]
labels]
0011 arrayref, index load onto the stack a reference
aaload 32
0010 → value from an array
0101 arrayref, index, store into a reference in an
aastore 53
0011 value → array
0000 push a null reference onto the
aconst_null 01 → null
0001 stack
0001 load a reference onto the stack
aload 19 1: index → objectref
1001 from a local variable #index
0010 load a reference onto the stack
aload_0 2a → objectref
1010 from local variable 0
0010 load a reference onto the stack
aload_1 2b → objectref
1011 from local variable 1
0010 load a reference onto the stack
aload_2 2c → objectref
1100 from local variable 2
0010 load a reference onto the stack
aload_3 2d → objectref
1101 from local variable 3
create a new array of references
of length count and component
2: type identified by the class
1011
anewarray bd indexbyte1, count → arrayref reference index (indexbyte1
1101
indexbyte2
<< 8 + indexbyte2) in
the constant pool
1011 objectref → return a reference from a
areturn b0
0000 [empty] method
1011 arrayref →
arraylength be get the length of an array
1110 length
0011 store a reference into a local
astore 3a 1: index objectref →
1010 variable #index
0100 store a reference into local
astore_0 4b objectref →
1011 variable 0
0100 store a reference into local
astore_1 4c objectref →
1100 variable 1
0100 store a reference into local
astore_2 4d objectref →
1101 variable 2
0100 store a reference into local
astore_3 4e objectref →
1110 variable 3
athrow bf 1011 objectref → throws an error or exception
1111 [empty], (notice that the rest of the stack
is cleared, leaving only a
objectref
reference to the Throwable)
0011 arrayref, index load a byte or Boolean value
baload 33
0011 → value from an array
0101 arrayref, index, store a byte or Boolean value
bastore 54
0100 value → into an array
0001 push a byte onto the stack as an
bipush 10 1: byte → value
0000 integer value
reserved for breakpoints in Java
1100
breakpoint ca debuggers; should not appear in
1010
any class file
0011 arrayref, index
caload 34 load a char from an array
0100 → value
0101 arrayref, index,
castore 55 store a char into an array
0101 value →
checks whether an objectref is
of a certain type, the class
2: reference of which is in the
1100 objectref →
checkcast c0 indexbyte1, constant pool at index
0000 objectref
indexbyte2 (indexbyte1 << 8 +
indexbyte2)
1001
d2f 90 value → result convert a double to a float
0000
1000
d2i 8e value → result convert a double to an int
1110
1000
d2l 8f value → result convert a double to a long
1111
0110 value1, value2
dadd 63 add two doubles
0011 → result
0011 arrayref, index
daload 31 load a double from an array
0001 → value
0101 arrayref, index,
dastore 52 store a double into an array
0010 value →
1001 value1, value2
dcmpg 98 compare two doubles
1000 → result
1001 value1, value2
dcmpl 97 compare two doubles
0111 → result
0000 push the constant 0.0 (a double)
dconst_0 0e → 0.0
1110 onto the stack
0000 push the constant 1.0 (a double)
dconst_1 0f → 1.0
1111 onto the stack
ddiv 6f 0110 value1, value2 divide two doubles
1111 → result
0001 load a double value from a
dload 18 1: index → value
1000 local variable #index
0010 load a double from local
dload_0 26 → value
0110 variable 0
0010 load a double from local
dload_1 27 → value
0111 variable 1
0010 load a double from local
dload_2 28 → value
1000 variable 2
0010 load a double from local
dload_3 29 → value
1001 variable 3
0110 value1, value2
dmul 6b multiply two doubles
1011 → result
0111
dneg 77 value → result negate a double
0111
0111 value1, value2 get the remainder from a
drem 73
0011 → result division between two doubles
1010
dreturn af value → [empty] return a double from a method
1111
0011 store a double value into a local
dstore 39 1: index value →
1001 variable #index
0100 store a double into local
dstore_0 47 value →
0111 variable 0
0100 store a double into local
dstore_1 48 value →
1000 variable 1
0100 store a double into local
dstore_2 49 value →
1001 variable 2
0100 store a double into local
dstore_3 4a value →
1010 variable 3
0110 value1, value2
dsub 67 subtract a double from another
0111 → result
0101 value → value, duplicate the value on top of
dup 59
1001 value the stack
insert a copy of the top value
value2, value1 into the stack two values from
0101
dup_x1 5a → value1, the top. value1 and value2 must
1010
value2, value1 not be of the type double or
long.
dup_x2 5b 0101 value3, value2, insert a copy of the top value
1011 value1 → into the stack two (if value2 is
value1, value3, double or long it takes up the
value2, value1 entry of value3, too) or three
values (if value2 is neither
double nor long) from the top
{value2, value1} duplicate top two stack words
0101 → {value2, (two values, if value1 is not
dup2 5c
1100 value1}, double nor long; a single value,
{value2, value1} if value1 is double or long)
value3, {value2,
value1} → duplicate two words and insert
0101
dup2_x1 5d {value2, beneath third word (see
1101
value1}, value3, explanation above)
{value2, value1}
{value4,
value3},
{value2, value1}
0101 → {value2, duplicate two words and insert
dup2_x2 5e
1110 value1}, beneath fourth word
{value4,
value3},
{value2, value1}
1000
f2d 8d value → result convert a float to a double
1101
1000
f2i 8b value → result convert a float to an int
1011
1000
f2l 8c value → result convert a float to a long
1100
0110 value1, value2
fadd 62 add two floats
0010 → result
0011 arrayref, index
faload 30 load a float from an array
0000 → value
0101 arrayref, index,
fastore 51 store a float in an array
0001 value →
1001 value1, value2
fcmpg 96 compare two floats
0110 → result
1001 value1, value2
fcmpl 95 compare two floats
0101 → result
0000
fconst_0 0b → 0.0f push 0.0f on the stack
1011
0000
fconst_1 0c → 1.0f push 1.0f on the stack
1100
0000
fconst_2 0d → 2.0f push 2.0f on the stack
1101
0110 value1, value2
fdiv 6e divide two floats
1110 → result
0001 load a float value from a local
fload 17 1: index → value
0111 variable #index
0010 load a float value from local
fload_0 22 → value
0010 variable 0
0010 load a float value from local
fload_1 23 → value
0011 variable 1
0010 load a float value from local
fload_2 24 → value
0100 variable 2
0010 load a float value from local
fload_3 25 → value
0101 variable 3
0110 value1, value2
fmul 6a multiply two floats
1010 → result
0111
fneg 76 value → result negate a float
0110
0111 value1, value2 get the remainder from a
frem 72
0010 → result division between two floats
1010
freturn ae value → [empty] return a float
1110
0011 store a float value into a local
fstore 38 1: index value →
1000 variable #index
0100 store a float value into local
fstore_0 43 value →
0011 variable 0
0100 store a float value into local
fstore_1 44 value →
0100 variable 1
0100 store a float value into local
fstore_2 45 value →
0101 variable 2
0100 store a float value into local
fstore_3 46 value →
0110 variable 3
0110 value1, value2
fsub 66 subtract two floats
0110 → result
get a field value of an object
objectref, where the field is
2: identified by field reference in
1011 objectref →
getfield b4 indexbyte1, the constant pool index
0100 value
indexbyte2 (indexbyte1 << 8 +
indexbyte2)
get a static field value of a
class, where the field is
2: identified by field reference in
1011
getstatic b2 indexbyte1, → value the constant pool index
0010
indexbyte2 (indexbyte1 << 8 +
indexbyte2)
goes to another instruction at
2: branchoffset (signed short
1010 branchbyte1 constructed from unsigned
goto a7 [no change]
0111 , bytes branchbyte1 << 8
branchbyte2
+ branchbyte2)
4:
goes to another instruction at
branchbyte1
branchoffset (signed int
,
constructed from unsigned
1100 branchbyte2
goto_w c8 [no change] bytes branchbyte1 << 24
1000 , + branchbyte2 << 16 +
branchbyte3 branchbyte3 << 8 +
,
branchbyte4)
branchbyte4
1001
i2b 91 value → result convert an int into a byte
0001
1001
i2c 92 value → result convert an int into a character
0010
1000
i2d 87 value → result convert an int into a double
0111
1000
i2f 86 value → result convert an int into a float
0110
1000
i2l 85 value → result convert an int into a long
0101
1001
i2s 93 value → result convert an int into a short
0011
0110 value1, value2
iadd 60 add two ints
0000 → result
0010 arrayref, index
iaload 2e load an int from an array
1110 → value
0111 value1, value2 perform a bitwise AND on two
iand 7e
1110 → result integers
0100 arrayref, index,
iastore 4f store an int into an array
1111 value →
0000 load the int value −1 onto the
iconst_m1 02 → -1
0010 stack
0000 load the int value 0 onto the
iconst_0 03 →0
0011 stack
0000 load the int value 1 onto the
iconst_1 04 →1
0100 stack
0000 load the int value 2 onto the
iconst_2 05 →2
0101 stack
iconst_3 06 0000 →3 load the int value 3 onto the
0110 stack
0000 load the int value 4 onto the
iconst_4 07 →4
0111 stack
0000 load the int value 5 onto the
iconst_5 08 →5
1000 stack
0110 value1, value2
idiv 6c divide two integers
1100 → result
if references are equal, branch
2: to instruction at branchoffset
1010 branchbyte1 value1, value2 (signed short constructed from
if_acmpeq a5
0101 , → unsigned bytes branchbyte1
branchbyte2
<< 8 + branchbyte2)
if references are not equal,
2: branch to instruction at
1010 branchbyte1 value1, value2 branchoffset (signed short
if_acmpne a6 constructed from unsigned
0110 , →
branchbyte2 bytes branchbyte1 << 8
+ branchbyte2)
if ints are equal, branch to
2: instruction at branchoffset
1001 branchbyte1 value1, value2 (signed short constructed from
if_icmpeq 9f
1111 , → unsigned bytes branchbyte1
branchbyte2
<< 8 + branchbyte2)
if value1 is greater than or
2: equal to value2, branch to
1010 branchbyte1 value1, value2 instruction at branchoffset
if_icmpge a2 (signed short constructed from
0010 , →
branchbyte2 unsigned bytes branchbyte1
<< 8 + branchbyte2)
if value1 is greater than value2,
2: branch to instruction at
1010 branchbyte1 value1, value2 branchoffset (signed short
if_icmpgt a3 constructed from unsigned
0011 , →
branchbyte2 bytes branchbyte1 << 8
+ branchbyte2)
if value1 is less than or equal to
2: value2, branch to instruction at
1010 branchbyte1 value1, value2 branchoffset (signed short
if_icmple a4 constructed from unsigned
0100 , →
branchbyte2 bytes branchbyte1 << 8
+ branchbyte2)
if_icmplt a1 1010 2: value1, value2 if value1 is less than value2,
0001 branchbyte1 → branch to instruction at
branchoffset (signed short
, constructed from unsigned
branchbyte2 bytes branchbyte1 << 8
+ branchbyte2)
if ints are not equal, branch to
2: instruction at branchoffset
1010 branchbyte1 value1, value2 (signed short constructed from
if_icmpne a0
0000 , → unsigned bytes branchbyte1
branchbyte2
<< 8 + branchbyte2)
if value is 0, branch to
2: instruction at branchoffset
1001 branchbyte1 (signed short constructed from
ifeq 99 value →
1001 , unsigned bytes branchbyte1
branchbyte2
<< 8 + branchbyte2)
if value is greater than or equal
2: to 0, branch to instruction at
1001 branchbyte1 branchoffset (signed short
ifge 9c value → constructed from unsigned
1100 ,
branchbyte2 bytes branchbyte1 << 8
+ branchbyte2)
if value is greater than 0,
2: branch to instruction at
1001 branchbyte1 branchoffset (signed short
ifgt 9d value → constructed from unsigned
1101 ,
branchbyte2 bytes branchbyte1 << 8
+ branchbyte2)
if value is less than or equal to
2: 0, branch to instruction at
1001 branchbyte1 branchoffset (signed short
ifle 9e value → constructed from unsigned
1110 ,
branchbyte2 bytes branchbyte1 << 8
+ branchbyte2)
if value is less than 0, branch to
2: instruction at branchoffset
1001 branchbyte1 (signed short constructed from
iflt 9b value →
1011 , unsigned bytes branchbyte1
branchbyte2
<< 8 + branchbyte2)
if value is not 0, branch to
2: instruction at branchoffset
1001 branchbyte1 (signed short constructed from
ifne 9a value →
1010 , unsigned bytes branchbyte1
branchbyte2
<< 8 + branchbyte2)
ifnonnull c7 1100 2: value → if value is not null, branch to
instruction at branchoffset
branchbyte1 (signed short constructed from
0111 , unsigned bytes branchbyte1
branchbyte2
<< 8 + branchbyte2)
if value is null, branch to
2: instruction at branchoffset
1100 branchbyte1 (signed short constructed from
ifnull c6 value →
0110 , unsigned bytes branchbyte1
branchbyte2
<< 8 + branchbyte2)
1000 2: index, increment local variable #index
iinc 84 [No change]
0100 const by signed byte const
0001 load an int value from a local
iload 15 1: index → value
0101 variable #index
0001 load an int value from local
iload_0 1a → value
1010 variable 0
0001 load an int value from local
iload_1 1b → value
1011 variable 1
0001 load an int value from local
iload_2 1c → value
1100 variable 2
0001 load an int value from local
iload_3 1d → value
1101 variable 3
reserved for implementation-
1111 dependent operations within
impdep1 fe
1110 debuggers; should not appear in
any class file
reserved for implementation-
1111 dependent operations within
impdep2 ff
1111 debuggers; should not appear in
any class file
0110 value1, value2
imul 68 multiply two integers
1000 → result
0111
ineg 74 value → result negate int
0100
determines if an object
objectref is of a given type,
2: identified by class reference
1100 objectref →
instanceof c1 indexbyte1, index in constant pool
0001 result
indexbyte2 (indexbyte1 << 8 +
indexbyte2)
invokedynamic ba 1011 4: [arg1, [arg2 ...]] invokes a dynamic method and
1010 indexbyte1, → result puts the result on the stack
indexbyte2, (might be void); the method is
0, 0 identified by method reference
index in constant pool
(indexbyte1 << 8 +
indexbyte2)
invokes an interface method on
object objectref and puts the
4: result on the stack (might be
objectref, [arg1, void); the interface method is
1011 indexbyte1,
invokeinterface b9 arg2, ...] → identified by method reference
1001 indexbyte2,
result index in constant pool
count, 0
(indexbyte1 << 8 +
indexbyte2)
invoke instance method on
object objectref and puts the
2: objectref, [arg1, result on the stack (might be
1011 void); the method is identified
invokespecial b7 indexbyte1, arg2, ...] →
0111 by method reference index in
indexbyte2 result
constant pool (indexbyte1
<< 8 + indexbyte2)
invoke a static method and puts
the result on the stack (might
2: be void); the method is
1011 [arg1, arg2, ...] identified by method reference
invokestatic b8 indexbyte1,
1000 → result index in constant pool
indexbyte2
(indexbyte1 << 8 +
indexbyte2)
invoke virtual method on object
objectref and puts the result on
2: objectref, [arg1, the stack (might be void); the
1011 method is identified by method
invokevirtual b6 indexbyte1, arg2, ...] →
0110 reference index in constant pool
indexbyte2 result
(indexbyte1 << 8 +
indexbyte2)
1000 value1, value2
ior 80 bitwise int OR
0000 → result
0111 value1, value2
irem 70 logical int remainder
0000 → result
1010
ireturn ac value → [empty] return an integer from a method
1100
0111 value1, value2
ishl 78 int shift left
1000 → result
0111 value1, value2
ishr 7a int arithmetic shift right
1010 → result
istore 36 0011 1: index value → store int value into variable
0110 #index
0011
istore_0 3b value → store int value into variable 0
1011
0011
istore_1 3c value → store int value into variable 1
1100
0011
istore_2 3d value → store int value into variable 2
1101
0011
istore_3 3e value → store int value into variable 3
1110
0110 value1, value2
isub 64 int subtract
0100 → result
0111 value1, value2
iushr 7c int logical shift right
1100 → result
1000 value1, value2
ixor 82 int xor
0010 → result
jump to subroutine at
2: branchoffset (signed short
1010 branchbyte1 constructed from unsigned
jsr a8 → address bytes branchbyte1 << 8
1000 ,
branchbyte2 + branchbyte2) and place
the return address on the stack
4: jump to subroutine at
branchbyte1 branchoffset (signed int
, constructed from unsigned
1100 branchbyte2 bytes branchbyte1 << 24
jsr_w c9 → address + branchbyte2 << 16 +
1001 ,
branchbyte3 branchbyte3 << 8 +
, branchbyte4) and place the
branchbyte4 return address on the stack
1000
l2d 8a value → result convert a long to a double
1010
1000
l2f 89 value → result convert a long to a float
1001
1000
l2i 88 value → result convert a long to a int
1000
0110 value1, value2
ladd 61 add two longs
0001 → result
0010 arrayref, index
laload 2f load a long from an array
1111 → value
0111 value1, value2
land 7f bitwise AND of two longs
1111 → result
lastore 50 0101 arrayref, index, store a long to an array
0000 value →
push 0 if the two longs are the
1001 value1, value2
lcmp 94 same, 1 if value1 is greater than
0100 → result
value2, -1 otherwise
0000 push 0L (the number zero with
lconst_0 09 → 0L
1001 type long) onto the stack
0000 push 1L (the number one with
lconst_1 0a → 1L
1010 type long) onto the stack
push a constant #index from a
constant pool (String, int, float,
Class,
0001
ldc 12 1: index → value java.lang.invoke.MethodType,
0010
or
java.lang.invoke.MethodHandl
e) onto the stack
push a constant #index from a
constant pool (String, int, float,
Class,
2: java.lang.invoke.MethodType,
0001 or
ldc_w 13 indexbyte1, → value
0011 java.lang.invoke.MethodHandl
indexbyte2
e) onto the stack (wide index is
constructed as indexbyte1
<< 8 + indexbyte2)
push a constant #index from a
2: constant pool (double or long)
0001 onto the stack (wide index is
ldc2_w 14 indexbyte1, → value
0100 constructed as indexbyte1
indexbyte2
<< 8 + indexbyte2)
0110 value1, value2
ldiv 6d divide two longs
1101 → result
0001 load a long value from a local
lload 16 1: index → value
0110 variable #index
0001 load a long value from a local
lload_0 1e → value
1110 variable 0
0001 load a long value from a local
lload_1 1f → value
1111 variable 1
0010 load a long value from a local
lload_2 20 → value
0000 variable 2
0010 load a long value from a local
lload_3 21 → value
0001 variable 3
0110 value1, value2
lmul 69 multiply two longs
1001 → result
0111
lneg 75 value → result negate a long
0101
8+: <0–3
bytes
padding>,
defaultbyte1
,
defaultbyte2
, a target address is looked up
1010 defaultbyte3 from a table using a key and
lookupswitch ab key →
1011 , execution continues from the
defaultbyte4 instruction at that address
, npairs1,
npairs2,
npairs3,
npairs4,
match-offset
pairs...
1000 value1, value2
lor 81 bitwise OR of two longs
0001 → result
0111 value1, value2 remainder of division of two
lrem 71
0001 → result longs
1010
lreturn ad value → [empty] return a long value
1101
0111 value1, value2 bitwise shift left of a long
lshl 79
1001 → result value1 by int value2 positions
0111 value1, value2 bitwise shift right of a long
lshr 7b
1011 → result value1 by int value2 positions
0011 store a long value in a local
lstore 37 1: index value →
0111 variable #index
0011 store a long value in a local
lstore_0 3f value →
1111 variable 0
0100 store a long value in a local
lstore_1 40 value →
0000 variable 1
0100 store a long value in a local
lstore_2 41 value →
0001 variable 2
0100 store a long value in a local
lstore_3 42 value →
0010 variable 3
0110 value1, value2
lsub 65 subtract two longs
0101 → result
bitwise shift right of a long
0111 value1, value2
lushr 7d value1 by int value2 positions,
1101 → result
unsigned
1000 value1, value2
lxor 83 bitwise XOR of two longs
0011 → result
enter monitor for object ("grab
1100
monitorenter c2 objectref → the lock" – start of
0010
synchronized() section)
exit monitor for object ("release
1100
monitorexit c3 objectref → the lock" – end of
0011
synchronized() section)
create a new array of
dimensions dimensions of type
3: identified by class reference in
count1, constant pool index
multianewarra 1100 indexbyte1,
c5 [count2,...] → (indexbyte1 << 8 +
y 0101 indexbyte2,
arrayref
dimensions indexbyte2); the sizes of
each dimension is identified by
count1, [count2, etc.]
create new object of type
2: identified by class reference in
1011 constant pool index
new bb indexbyte1, → objectref
1011 (indexbyte1 << 8 +
indexbyte2
indexbyte2)
create new array with count
1011
newarray bc 1: atype count → arrayref elements of primitive type
1100
identified by atype
0000
nop 00 [No change] perform no operation
0000
0101 discard the top value on the
pop 57 value →
0111 stack
discard the top two values on
0101 {value2, value1}
pop2 58 the stack (or one value, if it is a
1000 →
double or long)
set field to value in an object
objectref, where the field is
2:
1011 objectref, value identified by a field reference
putfield b5 indexbyte1, index in constant pool
0101 →
indexbyte2 (indexbyte1 << 8 +
indexbyte2)
set static field to value in a
class, where the field is
2: identified by a field reference
1011
putstatic b3 indexbyte1, value → index in constant pool
0011
indexbyte2 (indexbyte1 << 8 +
indexbyte2)
continue execution from
1010 address taken from a local
ret a9 1: index [No change]
1001 variable #index (the asymmetry
with jsr is intentional)
1011
return b1 → [empty] return void from method
0001
0011 arrayref, index
saload 35 load short from array
0101 → value
0101 arrayref, index,
sastore 56 store short to array
0110 value →
0001 2: byte1, push a short onto the stack as
sipush 11 → value
0001 byte2 an integer value
swaps two top words on the
value2, value1
0101 stack (note that value1 and
swap 5f → value1,
1111 value2 must not be double or
value2
long)
16+: [0–3
bytes
padding],
defaultbyte1
,
defaultbyte2
,
defaultbyte3
,
continue execution from an
1010 defaultbyte4
tableswitch aa index → address in the table at offset
1010 , lowbyte1,
index
lowbyte2,
lowbyte3,
lowbyte4,
highbyte1,
highbyte2,
highbyte3,
highbyte4,
jump
offsets...
3/5: opcode, execute opcode, where opcode
indexbyte1, is either iload, fload, aload,
indexbyte2 lload, dload, istore, fstore,
or [same as for astore, lstore, dstore, or ret, but
1100
wide c4 iinc, corresponding assume the index is 16 bit; or
0100
indexbyte1, instructions] execute iinc, where the index is
indexbyte2, 16 bits and the constant to
countbyte1, increment by is a signed 16 bit
countbyte2 short
these values are currently
(no name) cb-fd unassigned for opcodes and are
reserved for future use

Text is available under the Creative Commons Attribution-ShareAlike License; additional terms
may apply. See Terms of use for details.
Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc., a non-profit
organization.

You might also like