JVM bytecode list
Constants
Push constants into the operand stack.
- iconst_<i>
- Push the int constant <i> (-1, 0, 1, 2, 3, 4 or 5) onto the operand stack.
- bipush
- Push byte. iconst_<i> is equivalent to bipush <i>
- lconst_<l>
- Push long.
- fconst_<f>
- Push float.
- dconst_<d>
- Push double.
- sipush
- Push short
- ldc
- Push from constant pool(int, float, or string reference, etc.)
- ldc
- Push from constant pool(long, double, etc)
00 (0x00) nop
01 (0x01) aconst_null
02 (0x02) iconst_m1
03 (0x03) iconst_0
04 (0x04) iconst_1
05 (0x05) iconst_2
06 (0x06) iconst_3
07 (0x07) iconst_4
08 (0x08) iconst_5
09 (0x09) lconst_0
10 (0x0a) lconst_1
11 (0x0b) fconst_0
12 (0x0c) fconst_1
13 (0x0d) fconst_2
14 (0x0e) dconst_0
15 (0x0f) dconst_1
16 (0x10) bipush (byte)
17 (0x11) sipush (byte1 byte2)
18 (0x12) ldc (index)
19 (0x13) ldc_w (indexbyte1 indexbyte2)
20 (0x14) ldc2_w (indexbyte1 indexbyte2)
Loads
Load value from local variable to operand stack.
- iload_<i>
- Load int
- lload_<i>
- Load long
- fload_<i>
- Load float
- dload_<i>
- Load double
- aload_<i>
- Load reference
- iaload
- Load int from array. ..., arrayref, index → both array ref and index are popped from operand stack
- laload
- Load long from array
- faload
- Load float from array
- daload
- Load double from array
- aaload
- Load reference from array
- baload
- Load byte from array
- caload
- Load char from array
- saload
- Load short from array
21 (0x15) iload (index)
22 (0x16) lload (index)
23 (0x17) fload (index)
24 (0x18) dload (index)
25 (0x19) aload (index)
26 (0x1a) iload_0
27 (0x1b) iload_1
28 (0x1c) iload_2
29 (0x1d) iload_3
30 (0x1e) lload_0
31 (0x1f) lload_1
32 (0x20) lload_2
33 (0x21) lload_3
34 (0x22) fload_0
35 (0x23) fload_1
36 (0x24) fload_2
37 (0x25) fload_3
38 (0x26) dload_0
39 (0x27) dload_1
40 (0x28) dload_2
41 (0x29) dload_3
42 (0x2a) aload_0
43 (0x2b) aload_1
44 (0x2c) aload_2
45 (0x2d) aload_3
46 (0x2e) iaload
47 (0x2f) laload
48 (0x30) faload
49 (0x31) daload
50 (0x32) aaload
51 (0x33) baload
52 (0x34) caload
53 (0x35) saload
Stores
Store value into local variable.
- istore
- Store the value from the top of the operand stack(must be int) into local variable
- iastore
- Store into int array. ..., arrayref, index, value → values are popped from operand stack
54 (0x36) istore (index)
55 (0x37) lstore (index)
56 (0x38) fstore (index)
57 (0x39) dstore (index)
58 (0x3a) astore (index)
59 (0x3b) istore_0
60 (0x3c) istore_1
61 (0x3d) istore_2
62 (0x3e) istore_3
63 (0x3f) lstore_0
64 (0x40) lstore_1
65 (0x41) lstore_2
66 (0x42) lstore_3
67 (0x43) fstore_0
68 (0x44) fstore_1
69 (0x45) fstore_2
70 (0x46) fstore_3
71 (0x47) dstore_0
72 (0x48) dstore_1
73 (0x49) dstore_2
74 (0x4a) dstore_3
75 (0x4b) astore_0
76 (0x4c) astore_1
77 (0x4d) astore_2
78 (0x4e) astore_3
79 (0x4f) iastore
80 (0x50) lastore
81 (0x51) fastore
82 (0x52) dastore
83 (0x53) aastore
84 (0x54) bastore
85 (0x55) castore
86 (0x56) sastore
Stack
- pop
- Pop from the operand stack
- pop2
- Pop the top one or two operand stack values
- dup
- Duplicate the top value on the operand stack and push the duplicated value onto the operand stack.
- dup2
- Duplicate the top one or two operand stack values
- swap
- Swap the top two operand stack values
87 (0x57) pop
88 (0x58) pop2
89 (0x59) dup
90 (0x5a) dup_x1
91 (0x5b) dup_x2
92 (0x5c) dup2
93 (0x5d) dup2_x1
94 (0x5e) dup2_x2
95 (0x5f) swap
Math
- %add
- Add two values, ..., value1, value2 → ..., result
- %sub
- Subtract
- %mul
- Multiply
- %div
- Divide
- %rem
- Remainder (取余)
- %neg
- Negate
- %shl
- Shift left
- %shr
- Arithmetic shift right
- %ushr
- Logical shift right
- %and
- and
- %or
- or
- %xor
- xor
- %inc
- Increment local variable by constant
96 (0x60) iadd
97 (0x61) ladd
98 (0x62) fadd
99 (0x63) dadd
100 (0x64) isub
101 (0x65) lsub
102 (0x66) fsub
103 (0x67) dsub
104 (0x68) imul
105 (0x69) lmul
106 (0x6a) fmul
107 (0x6b) dmul
108 (0x6c) idiv
109 (0x6d) ldiv
110 (0x6e) fdiv
111 (0x6f) ddiv
112 (0x70) irem
113 (0x71) lrem
114 (0x72) frem
115 (0x73) drem
116 (0x74) ineg
117 (0x75) lneg
118 (0x76) fneg
119 (0x77) dneg
120 (0x78) ishl
121 (0x79) lshl
122 (0x7a) ishr
123 (0x7b) lshr
124 (0x7c) iushr
125 (0x7d) lushr
126 (0x7e) iand
127 (0x7f) land
128 (0x80) ior
129 (0x81) lor
130 (0x82) ixor
131 (0x83) lxor
132 (0x84) iinc (index const)
Conversions
Conversions between values. .., value → ..., result
133 (0x85) i2l
134 (0x86) i2f
135 (0x87) i2d
136 (0x88) l2i
137 (0x89) l2f
138 (0x8a) l2d
139 (0x8b) f2i
140 (0x8c) f2l
141 (0x8d) f2d
142 (0x8e) d2i
143 (0x8f) d2l
144 (0x90) d2f
145 (0x91) i2b
146 (0x92) i2c
147 (0x93) i2s
Comparisons
Compare values.
- %cmp
- If value1 is greater than value2, the int value 1 is pushed onto the operand stack. If value1 is equal to value2, the int value 0 is pushed onto the operand stack. If value1 is less than value2, the int value -1 is pushed onto the operand stack.
- %cmplg
- The fcmpg and fcmpl instructions differ only in their treatment of a comparison involving NaN.
- if<cond>
- Compared with the value popped from the operand stack and compared against zero. If success, the branch offset will be executed.
- if_icmp<cond>
- Compare values in stack ..., value1, value2 →
148 (0x94) lcmp
149 (0x95) fcmpl
150 (0x96) fcmpg
151 (0x97) dcmpl
152 (0x98) dcmpg
153 (0x99) ifeq (branchbyte1, branchbyte2)
154 (0x9a) ifne (branchbyte1, branchbyte2)
155 (0x9b) iflt (branchbyte1, branchbyte2)
156 (0x9c) ifge (branchbyte1, branchbyte2)
157 (0x9d) ifgt (branchbyte1, branchbyte2)
158 (0x9e) ifle (branchbyte1, branchbyte2)
159 (0x9f) if_icmpeq (branchbyte1, branchbyte2)
160 (0xa0) if_icmpne (branchbyte1, branchbyte2)
161 (0xa1) if_icmplt (branchbyte1, branchbyte2)
162 (0xa2) if_icmpge (branchbyte1, branchbyte2)
163 (0xa3) if_icmpgt (branchbyte1, branchbyte2)
164 (0xa4) if_icmple (branchbyte1, branchbyte2)
165 (0xa5) if_acmpeq (branchbyte1, branchbyte2)
166 (0xa6) if_acmpne (branchbyte1, branchbyte2)
References
See
178 (0xb2) getstatic (indexbyte1 indexbyte2)
179 (0xb3) putstatic (indexbyte1 indexbyte2)
180 (0xb4) getfield (indexbyte1 indexbyte2)
181 (0xb5) putfield (indexbyte1 indexbyte2)
182 (0xb6) invokevirtual (indexbyte1 indexbyte2)
183 (0xb7) invokespecial (indexbyte1 indexbyte2)
184 (0xb8) invokestatic (indexbyte1 indexbyte2)
185 (0xb9) invokeinterface (indexbyte1 indexbyte2 count 0)
186 (0xba) invokedynamic (indexbyte1 indexbyte2 0 0)
187 (0xbb) new (indexbyte1 indexbyte2)
188 (0xbc) newarray (acode)
189 (0xbd) anewarray (indexbyte1 indexbyte2)
190 (0xbe) arraylength
191 (0xbf) athrow
192 (0xc0) checkcast (indexbyte1 indexbyte2)
193 (0xc1) instanceof (indexbyte1 indexbyte2)
194 (0xc2) monitorenter
195 (0xc3) monitorexit
Control
- goto
- execute from the offset
- jsr
- (Jump to subroutine) Put the returnAddress to the stack
- ret
- (Return from subroutine) , the index is the local variable in current frame, which must be a returnAddress. The contents of the local variable are written into the Java Virtual Machine's pc register, and execution continues there.
- return
- A return instruction returns control from a method to its invoker, without passing any value back to the invoker.
See
- [[[JVM:Control]]
167 (0xa7) goto (branchbyte1 branchbyte2)
168 (0xa8) jsr (branchbyte1 branchbyte2)
169 (0xa9) ret (index)
170 (0xaa) tableswitch
171 (0xab) lookupswitch
172 (0xac) ireturn
173 (0xad) lreturn
174 (0xae) freturn
175 (0xaf) dreturn
176 (0xb0) areturn
177 (0xb1) return
Extended
196 (0xc4) wide
197 (0xc5) multianewarray
198 (0xc6) ifnull
199 (0xc7) ifnonnull
200 (0xc8) goto_w
201 (0xc9) jsr_w
Reserved
202 (0xca) breakpoint
254 (0xfe) impdep1
255 (0xff) impdep2