List of Java bytecode instructions explained

See main article: Java bytecode.

This is a list of the instructions that make up the Java bytecode, an abstract machine language that is ultimately executed by the Java virtual machine.[1] The Java bytecode is generated from languages running on the Java Platform, most notably the Java programming language.

Note that any referenced "value" refers to a 32-bit int as per the Java instruction set.

MnemonicOpcode
(in hex)
Opcode (in binary)Other bytes
[count]: [operand labels]
Stack
[before]→[after]
Description
aaloaddata-sort-value=50320011 0010arrayref, index → valueload onto the stack a reference from an array
aastoredata-sort-value=83530101 0011arrayref, index, value →store a reference in an array
aconst_nulldata-sort-value=1010000 0001→ nullpush a null reference onto the stack
aloaddata-sort-value=25190001 10011: index→ objectrefload a reference onto the stack from a local variable #index
aload_0data-sort-value=422a0010 1010→ objectrefload a reference onto the stack from local variable 0
aload_1data-sort-value=432b0010 1011→ objectrefload a reference onto the stack from local variable 1
aload_2data-sort-value=442c0010 1100→ objectrefload a reference onto the stack from local variable 2
aload_3data-sort-value=452d0010 1101→ objectrefload a reference onto the stack from local variable 3
anewarraydata-sort-value=189bd1011 11012: indexbyte1, indexbyte2count → arrayrefcreate a new array of references of length count and component type identified by the class reference index in the constant pool
areturndata-sort-value=176b01011 0000objectref → [empty]return a reference from a method
arraylengthdata-sort-value=190be1011 1110arrayref → lengthget the length of an array
astoredata-sort-value=583a0011 10101: indexobjectref →store a reference into a local variable #index
astore_0data-sort-value=754b0100 1011objectref →store a reference into local variable 0
astore_1data-sort-value=764c0100 1100objectref →store a reference into local variable 1
astore_2data-sort-value=774d0100 1101objectref →store a reference into local variable 2
astore_3data-sort-value=784e0100 1110objectref →store a reference into local variable 3
athrowdata-sort-value=191bf1011 1111objectref → [empty], objectrefthrows an error or exception (notice that the rest of the stack is cleared, leaving only a reference to the Throwable)
baloaddata-sort-value=51330011 0011arrayref, index → valueload a byte or Boolean value from an array
bastoredata-sort-value=84540101 0100arrayref, index, value →store a byte or Boolean value into an array
bipushdata-sort-value=16100001 00001: byte→ valuepush a byte onto the stack as an integer value
breakpointdata-sort-value=202ca1100 1010reserved for breakpoints in Java debuggers; should not appear in any class file
caloaddata-sort-value=52340011 0100arrayref, index → valueload a char from an array
castoredata-sort-value=85550101 0101arrayref, index, value →store a char into an array
checkcastdata-sort-value=192c01100 00002: indexbyte1, indexbyte2objectref → objectrefchecks whether an objectref is of a certain type, the class reference of which is in the constant pool at index
d2fdata-sort-value=144901001 0000value → resultconvert a double to a float
d2idata-sort-value=1428e1000 1110value → resultconvert a double to an int
d2ldata-sort-value=1438f1000 1111value → resultconvert a double to a long
dadddata-sort-value=99630110 0011value1, value2 → resultadd two doubles
daloaddata-sort-value=49310011 0001arrayref, index → valueload a double from an array
dastoredata-sort-value=82520101 0010arrayref, index, value →store a double into an array
dcmpgdata-sort-value=152981001 1000value1, value2 → resultcompare two doubles, 1 on NaN
dcmpldata-sort-value=151971001 0111value1, value2 → resultcompare two doubles, -1 on NaN
dconst_0data-sort-value=140e0000 1110→ 0.0push the constant 0.0 (a double) onto the stack
dconst_1data-sort-value=150f0000 1111→ 1.0push the constant 1.0 (a double) onto the stack
ddivdata-sort-value=1116f0110 1111value1, value2 → resultdivide two doubles
dloaddata-sort-value=24180001 10001: index→ valueload a double value from a local variable #index
dload_0data-sort-value=38260010 0110→ valueload a double from local variable 0
dload_1data-sort-value=39270010 0111→ valueload a double from local variable 1
dload_2data-sort-value=40280010 1000→ valueload a double from local variable 2
dload_3data-sort-value=41290010 1001→ valueload a double from local variable 3
dmuldata-sort-value=1076b0110 1011value1, value2 → resultmultiply two doubles
dnegdata-sort-value=119770111 0111value → resultnegate a double
dremdata-sort-value=115730111 0011value1, value2 → resultget the remainder from a division between two doubles
dreturndata-sort-value=175af1010 1111value → [empty]return a double from a method
dstoredata-sort-value=57390011 10011: indexvalue →store a double value into a local variable #index
dstore_0data-sort-value=71470100 0111value →store a double into local variable 0
dstore_1data-sort-value=72480100 1000value →store a double into local variable 1
dstore_2data-sort-value=73490100 1001value →store a double into local variable 2
dstore_3data-sort-value=744a0100 1010value →store a double into local variable 3
dsubdata-sort-value=103670110 0111value1, value2 → resultsubtract a double from another
dupdata-sort-value=89590101 1001value → value, valueduplicate the value on top of the stack
dup_x1data-sort-value=905a0101 1010value2, value1 → value1, value2, value1insert a copy of the top value into the stack two values from the top. value1 and value2 must not be of the type double or long.
dup_x2data-sort-value=915b0101 1011value3, value2, value1 → value1, value3, value2, value1insert a copy of the top value into the stack two (if value2 is double or long it takes up the entry of value3, too) or three values (if value2 is neither double nor long) from the top
dup2data-sort-value=925c0101 1100 →, duplicate top two stack words (two values, if value1 is not double nor long; a single value, if value1 is double or long)
dup2_x1data-sort-value=935d0101 1101value3, →, value3, duplicate two words and insert beneath third word (see explanation above)
dup2_x2data-sort-value=945e0101 1110, →,, duplicate two words and insert beneath fourth word
f2ddata-sort-value=1418d1000 1101value → resultconvert a float to a double
f2idata-sort-value=1398b1000 1011value → resultconvert a float to an int
f2ldata-sort-value=1408c1000 1100value → resultconvert a float to a long
fadddata-sort-value=98620110 0010value1, value2 → resultadd two floats
faloaddata-sort-value=48300011 0000arrayref, index → valueload a float from an array
fastoredata-sort-value=81510101 0001arrayref, index, value →store a float in an array
fcmpgdata-sort-value=150961001 0110value1, value2 → resultcompare two floats, 1 on NaN
fcmpldata-sort-value=149951001 0101value1, value2 → resultcompare two floats, -1 on NaN
fconst_0data-sort-value=110b0000 1011→ 0.0fpush 0.0f on the stack
fconst_1data-sort-value=120c0000 1100→ 1.0fpush 1.0f on the stack
fconst_2data-sort-value=130d0000 1101→ 2.0fpush 2.0f on the stack
fdivdata-sort-value=1106e0110 1110value1, value2 → resultdivide two floats
floaddata-sort-value=23170001 01111: index→ valueload a float value from a local variable #index
fload_0data-sort-value=34220010 0010→ valueload a float value from local variable 0
fload_1data-sort-value=35230010 0011→ valueload a float value from local variable 1
fload_2data-sort-value=36240010 0100→ valueload a float value from local variable 2
fload_3data-sort-value=37250010 0101→ valueload a float value from local variable 3
fmuldata-sort-value=1066a0110 1010value1, value2 → resultmultiply two floats
fnegdata-sort-value=118760111 0110value → resultnegate a float
fremdata-sort-value=114720111 0010value1, value2 → resultget the remainder from a division between two floats
freturndata-sort-value=174ae1010 1110value → [empty]return a float
fstoredata-sort-value=56380011 10001: indexvalue →store a float value into a local variable #index
fstore_0data-sort-value=67430100 0011value →store a float value into local variable 0
fstore_1data-sort-value=68440100 0100value →store a float value into local variable 1
fstore_2data-sort-value=69450100 0101value →store a float value into local variable 2
fstore_3data-sort-value=70460100 0110value →store a float value into local variable 3
fsubdata-sort-value=102660110 0110value1, value2 → resultsubtract two floats
getfielddata-sort-value=180b41011 01002: indexbyte1, indexbyte2objectref → valueget a field value of an object objectref, where the field is identified by field reference in the constant pool index
getstaticdata-sort-value=178b21011 00102: indexbyte1, indexbyte2→ valueget a static field value of a class, where the field is identified by field reference in the constant pool index
gotodata-sort-value=167a71010 01112: branchbyte1, branchbyte2[no change]goes to another instruction at branchoffset (signed short constructed from unsigned bytes)
goto_wdata-sort-value=200c81100 10004: branchbyte1, branchbyte2, branchbyte3, branchbyte4[no change]goes to another instruction at branchoffset (signed int constructed from unsigned bytes)
i2bdata-sort-value=145911001 0001value → resultconvert an int into a byte
i2cdata-sort-value=146921001 0010value → resultconvert an int into a character
i2ddata-sort-value=135871000 0111value → resultconvert an int into a double
i2fdata-sort-value=134861000 0110value → resultconvert an int into a float
i2ldata-sort-value=133851000 0101value → resultconvert an int into a long
i2sdata-sort-value=147931001 0011value → resultconvert an int into a short
iadddata-sort-value=96600110 0000value1, value2 → resultadd two ints
ialoaddata-sort-value=462e0010 1110arrayref, index → valueload an int from an array
ianddata-sort-value=1267e0111 1110value1, value2 → resultperform a bitwise AND on two integers
iastoredata-sort-value=794f0100 1111arrayref, index, value →store an int into an array
iconst_m1data-sort-value=2020000 0010→ -1load the int value −1 onto the stack
iconst_0data-sort-value=3030000 0011→ 0load the int value 0 onto the stack
iconst_1data-sort-value=4040000 0100→ 1load the int value 1 onto the stack
iconst_2data-sort-value=5050000 0101→ 2load the int value 2 onto the stack
iconst_3data-sort-value=6060000 0110→ 3load the int value 3 onto the stack
iconst_4data-sort-value=7070000 0111→ 4load the int value 4 onto the stack
iconst_5data-sort-value=8080000 1000→ 5load the int value 5 onto the stack
idivdata-sort-value=1086c0110 1100value1, value2 → resultdivide two integers
if_acmpeqdata-sort-value=165a51010 01012: branchbyte1, branchbyte2value1, value2 →if references are equal, branch to instruction at branchoffset (signed short constructed from unsigned bytes)
if_acmpnedata-sort-value=166a61010 01102: branchbyte1, branchbyte2value1, value2 →if references are not equal, branch to instruction at branchoffset (signed short constructed from unsigned bytes)
if_icmpeqdata-sort-value=1599f1001 11112: branchbyte1, branchbyte2value1, value2 →if ints are equal, branch to instruction at branchoffset (signed short constructed from unsigned bytes)
if_icmpgedata-sort-value=162a21010 00102: branchbyte1, branchbyte2value1, value2 →if value1 is greater than or equal to value2, branch to instruction at branchoffset (signed short constructed from unsigned bytes)
if_icmpgtdata-sort-value=163a31010 00112: branchbyte1, branchbyte2value1, value2 →if value1 is greater than value2, branch to instruction at branchoffset (signed short constructed from unsigned bytes)
if_icmpledata-sort-value=164a41010 01002: branchbyte1, branchbyte2value1, value2 →if value1 is less than or equal to value2, branch to instruction at branchoffset (signed short constructed from unsigned bytes)
if_icmpltdata-sort-value=161a11010 00012: branchbyte1, branchbyte2value1, value2 →if value1 is less than value2, branch to instruction at branchoffset (signed short constructed from unsigned bytes)
if_icmpnedata-sort-value=160a01010 00002: branchbyte1, branchbyte2value1, value2 →if ints are not equal, branch to instruction at branchoffset (signed short constructed from unsigned bytes)
ifeqdata-sort-value=153991001 10012: branchbyte1, branchbyte2value →if value is 0, branch to instruction at branchoffset (signed short constructed from unsigned bytes)
ifgedata-sort-value=1569c1001 11002: branchbyte1, branchbyte2value →if value is greater than or equal to 0, branch to instruction at branchoffset (signed short constructed from unsigned bytes)
ifgtdata-sort-value=1579d1001 11012: branchbyte1, branchbyte2value →if value is greater than 0, branch to instruction at branchoffset (signed short constructed from unsigned bytes)
ifledata-sort-value=1589e1001 11102: branchbyte1, branchbyte2value →if value is less than or equal to 0, branch to instruction at branchoffset (signed short constructed from unsigned bytes)
ifltdata-sort-value=1559b1001 10112: branchbyte1, branchbyte2value →if value is less than 0, branch to instruction at branchoffset (signed short constructed from unsigned bytes)
ifnedata-sort-value=1549a1001 10102: branchbyte1, branchbyte2value →if value is not 0, branch to instruction at branchoffset (signed short constructed from unsigned bytes)
ifnonnulldata-sort-value=199c71100 01112: branchbyte1, branchbyte2value →if value is not null, branch to instruction at branchoffset (signed short constructed from unsigned bytes)
ifnulldata-sort-value=198c61100 01102: branchbyte1, branchbyte2value →if value is null, branch to instruction at branchoffset (signed short constructed from unsigned bytes)
iincdata-sort-value=132841000 01002: index, const[No change]increment local variable #index by signed byte const
iloaddata-sort-value=21150001 01011: index→ valueload an int value from a local variable #index
iload_0data-sort-value=261a0001 1010→ valueload an int value from local variable 0
iload_1data-sort-value=271b0001 1011→ valueload an int value from local variable 1
iload_2data-sort-value=281c0001 1100→ valueload an int value from local variable 2
iload_3data-sort-value=291d0001 1101→ valueload an int value from local variable 3
impdep1data-sort-value=254fe1111 1110reserved for implementation-dependent operations within debuggers; should not appear in any class file
impdep2data-sort-value=255ff1111 1111reserved for implementation-dependent operations within debuggers; should not appear in any class file
imuldata-sort-value=104680110 1000value1, value2 → resultmultiply two integers
inegdata-sort-value=116740111 0100value → resultnegate int
instanceofdata-sort-value=193c11100 00012: indexbyte1, indexbyte2objectref → resultdetermines if an object objectref is of a given type, identified by class reference index in constant pool
invokedynamicdata-sort-value=186ba1011 10104: indexbyte1, indexbyte2, 0, 0[arg1, arg2, ...] → resultinvokes a dynamic method and puts the result on the stack (might be void); the method is identified by method reference index in constant pool
invokeinterfacedata-sort-value=185b91011 10014: indexbyte1, indexbyte2, count, 0objectref, [arg1, arg2, ...] → resultinvokes an interface method on object objectref and puts the result on the stack (might be void); the interface method is identified by method reference index in constant pool
invokespecialdata-sort-value=183b71011 01112: indexbyte1, indexbyte2objectref, [arg1, arg2, ...] → resultinvoke instance method on object objectref and puts the result on the stack (might be void); the method is identified by method reference index in constant pool
invokestaticdata-sort-value=184b81011 10002: indexbyte1, indexbyte2[arg1, arg2, ...] → resultinvoke a static method and puts the result on the stack (might be void); the method is identified by method reference index in constant pool
invokevirtualdata-sort-value=182b61011 01102: indexbyte1, indexbyte2objectref, [arg1, arg2, ...] → resultinvoke virtual method on object objectref and puts the result on the stack (might be void); the method is identified by method reference index in constant pool
iordata-sort-value=128801000 0000value1, value2 → resultbitwise int OR
iremdata-sort-value=112700111 0000value1, value2 → resultlogical int remainder
ireturndata-sort-value=172ac1010 1100value → [empty]return an integer from a method
ishldata-sort-value=120780111 1000value1, value2 → resultint shift left
ishrdata-sort-value=1227a0111 1010value1, value2 → resultint arithmetic shift right
istoredata-sort-value=54360011 01101: indexvalue →store int value into variable #index
istore_0data-sort-value=593b0011 1011value →store int value into variable 0
istore_1data-sort-value=603c0011 1100value →store int value into variable 1
istore_2data-sort-value=613d0011 1101value →store int value into variable 2
istore_3data-sort-value=623e0011 1110value →store int value into variable 3
isubdata-sort-value=100640110 0100value1, value2 → resultint subtract
iushrdata-sort-value=1247c0111 1100value1, value2 → resultint logical shift right
ixordata-sort-value=130821000 0010value1, value2 → resultint xor
jsrdata-sort-value=168a81010 10002: branchbyte1, branchbyte2→ addressjump to subroutine at branchoffset (signed short constructed from unsigned bytes) and place the return address on the stack
jsr_wdata-sort-value=201c91100 10014: branchbyte1, branchbyte2, branchbyte3, branchbyte4→ addressjump to subroutine at branchoffset (signed int constructed from unsigned bytes) and place the return address on the stack
l2ddata-sort-value=1388a1000 1010value → resultconvert a long to a double
l2fdata-sort-value=137891000 1001value → resultconvert a long to a float
l2idata-sort-value=136881000 1000value → resultconvert a long to a int
ladddata-sort-value=97610110 0001value1, value2 → resultadd two longs
laloaddata-sort-value=472f0010 1111arrayref, index → valueload a long from an array
landdata-sort-value=1277f0111 1111value1, value2 → resultbitwise AND of two longs
lastoredata-sort-value=80500101 0000arrayref, index, value →store a long to an array
lcmpdata-sort-value=148941001 0100value1, value2 → resultpush 0 if the two longs are the same, 1 if value1 is greater than value2, -1 otherwise
lconst_0data-sort-value=9090000 1001→ 0Lpush 0L (the number zero with type long) onto the stack
lconst_1data-sort-value=100a0000 1010→ 1Lpush 1L (the number one with type long) onto the stack
ldcdata-sort-value=18120001 00101: index→ valuepush a constant #index from a constant pool (String, int, float, Class, java.lang.invoke.MethodType, java.lang.invoke.MethodHandle, or a dynamically-computed constant) onto the stack
ldc_wdata-sort-value=19130001 00112: indexbyte1, indexbyte2→ valuepush a constant #index from a constant pool (String, int, float, Class, java.lang.invoke.MethodType, java.lang.invoke.MethodHandle, or a dynamically-computed constant) onto the stack (wide index is constructed as)
ldc2_wdata-sort-value=20140001 01002: indexbyte1, indexbyte2→ valuepush a constant #index from a constant pool (double, long, or a dynamically-computed constant) onto the stack (wide index is constructed as)
ldivdata-sort-value=1096d0110 1101value1, value2 → resultdivide two longs
lloaddata-sort-value=22160001 01101: index→ valueload a long value from a local variable #index
lload_0data-sort-value=301e0001 1110→ valueload a long value from a local variable 0
lload_1data-sort-value=311f0001 1111→ valueload a long value from a local variable 1
lload_2data-sort-value=32200010 0000→ valueload a long value from a local variable 2
lload_3data-sort-value=33210010 0001→ valueload a long value from a local variable 3
lmuldata-sort-value=105690110 1001value1, value2 → resultmultiply two longs
lnegdata-sort-value=117750111 0101value → resultnegate a long
lookupswitchdata-sort-value=171ab1010 10118+: <0–3 bytes padding>, defaultbyte1, defaultbyte2, defaultbyte3, defaultbyte4, npairs1, npairs2, npairs3, npairs4, match-offset pairs...key →a target address is looked up from a table using a key and execution continues from the instruction at that address
lordata-sort-value=129811000 0001value1, value2 → resultbitwise OR of two longs
lremdata-sort-value=113710111 0001value1, value2 → resultremainder of division of two longs
lreturndata-sort-value=173ad1010 1101value → [empty]return a long value
lshldata-sort-value=121790111 1001value1, value2 → resultbitwise shift left of a long value1 by int value2 positions
lshrdata-sort-value=1237b0111 1011value1, value2 → resultbitwise shift right of a long value1 by int value2 positions
lstoredata-sort-value=55370011 01111: indexvalue →store a long value in a local variable #index
lstore_0data-sort-value=633f0011 1111value →store a long value in a local variable 0
lstore_1data-sort-value=64400100 0000value →store a long value in a local variable 1
lstore_2data-sort-value=65410100 0001value →store a long value in a local variable 2
lstore_3data-sort-value=66420100 0010value →store a long value in a local variable 3
lsubdata-sort-value=101650110 0101value1, value2 → resultsubtract two longs
lushrdata-sort-value=1257d0111 1101value1, value2 → resultbitwise shift right of a long value1 by int value2 positions, unsigned
lxordata-sort-value=131831000 0011value1, value2 → resultbitwise XOR of two longs
monitorenterdata-sort-value=194c21100 0010objectref →enter monitor for object ("grab the lock" – start of synchronized section)
monitorexitdata-sort-value=195c31100 0011objectref →exit monitor for object ("release the lock" – end of synchronized section)
multianewarraydata-sort-value=197c51100 01013: indexbyte1, indexbyte2, dimensionscount1, [count2,...] → arrayrefcreate a new array of dimensions dimensions of type identified by class reference in constant pool index ; the sizes of each dimension is identified by count1, [''count2'', etc.]
newdata-sort-value=187bb1011 10112: indexbyte1, indexbyte2→ objectrefcreate new object of type identified by class reference in constant pool index
newarraydata-sort-value=188bc1011 11001: atypecount → arrayrefcreate new array with count elements of primitive type identified by atype
nopdata-sort-value=0000000 0000[No change]perform no operation
popdata-sort-value=87570101 0111value →discard the top value on the stack
pop2data-sort-value=88580101 1000discard the top two values on the stack (or one value, if it is a double or long)
putfielddata-sort-value=181b51011 01012: indexbyte1, indexbyte2objectref, value →set field to value in an object objectref, where the field is identified by a field reference index in constant pool
putstaticdata-sort-value=179b31011 00112: indexbyte1, indexbyte2value →set static field to value in a class, where the field is identified by a field reference index in constant pool
retdata-sort-value=169a91010 10011: index[No change]continue execution from address taken from a local variable #index (the asymmetry with jsr is intentional)
returndata-sort-value=177b11011 0001→ [empty]return void from method
saloaddata-sort-value=53350011 0101arrayref, index → valueload short from array
sastoredata-sort-value=86560101 0110arrayref, index, value →store short to array
sipushdata-sort-value=17110001 00012: byte1, byte2→ valuepush a short onto the stack as an integer value
swapdata-sort-value=955f0101 1111value2, value1 → value1, value2swaps two top words on the stack (note that value1 and value2 must not be double or long)
tableswitchdata-sort-value=170aa1010 101016+: [0–3 bytes padding], defaultbyte1, defaultbyte2, defaultbyte3, defaultbyte4, lowbyte1, lowbyte2, lowbyte3, lowbyte4, highbyte1, highbyte2, highbyte3, highbyte4, jump offsets...index →continue execution from an address in the table at offset index
widedata-sort-value=196c41100 01003/5: opcode, indexbyte1, indexbyte2
or
iinc, indexbyte1, indexbyte2, countbyte1, countbyte2
[same as for corresponding instructions]execute opcode, where opcode is either iload, fload, aload, lload, dload, istore, fstore, astore, lstore, dstore, or ret, but assume the index is 16 bit; or execute iinc, where the index is 16 bits and the constant to increment by is a signed 16 bit short
(no name)data-sort-value=203cb-fdthese values are currently unassigned for opcodes and are reserved for future use

See also

External links

Notes and References

  1. Web site: The Java® Virtual Machine Specification – Java SE 12 Edition . May 22, 2021.