1 /* Table of opcodes for byte codes defined by the
Java(TM
) virtual
3 Copyright (C
) 1998 Free Software Foundation
, Inc.
5 This file is part of GNU CC.
7 GNU CC is free software
; you can redistribute it and
/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation
; either version
2, or (at your option
)
12 GNU CC is distributed in the hope that it will be useful
,
13 but WITHOUT ANY WARRANTY
; without even the implied warranty of
14 MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GNU CC
; see the file COPYING. If not
, write to
19 the Free Software Foundation
, 59 Temple Place
- Suite
330,
20 Boston
, MA
02111-1307, USA.
22 Java and all Java
-based marks are trademarks or registered trademarks
23 of Sun Microsystems
, Inc. in the United States and other countries.
24 The Free Software Foundation is independent of Sun Microsystems
, Inc.
26 Written by Per Bothner
<bothner@cygnus.com
>, February
1996.
29 /* JAVAOP (OPNAME
, OPCODE
, OPKIND
, OPERAND_TYPE
, OPERAND_VALUE
), where
:
30 OPNAME is the name of the opcode.
31 OPCODE is the
1-byte opcode value.
32 OPKIND is the kind of operation.
33 OPERAND_TYPE is the type operands affected.
34 OPERAND_VALUE tells where to get the value.
(Its meaning
35 depends on OPKIND.
) */
37 /* Various macro used in OPERAND_VALUE
:
38 IMMEDIATE_s1
: An immediate signed
1-byte value in the byte
-code stream.
39 IMMEDIATE_s2
: An immediate signed
2-byte value in the byte
-code stream.
40 IMMEDIATE_u1
: An immediate unsigned
1-byte value in the byte
-code stream.
41 IMMEDIATE_u2
: An immediate unsigned
2-byte value in the byte
-code stream.
43 CONST_INDEX_1
: An immediate unsigned
1-byte index into the constant pool.
44 CONST_INDEX_2
: An immediate unsigned
2-byte index into the constant pool.
47 /* More specifically
, this is the meaning of the various OPKINDs
:
49 BINOP
: binary operation
50 OPERAND_TYPE is the argument type.
51 OPERAND_VALUE is PLUS
, MINUS
, MULT
, TRUNC_DIV
, RDIV
, REM,
52 LSHIFT
, RSHIFT
, URSHIFT
, BIT_AND
, BIT_IOR
, BIT_XOR
,
53 COMPARE
, COMPARE_L
, or COMPARE_G.
56 OPERAND_TYPE is the argument type.
59 INVOKE
: invoke operations
60 OPERAND_TYPE is VIRTUAL
, SPECIAL
, STATIC
, or INTERFACE.
61 OPERAND_VALUE is
1 if interface
, 0 otherwise.
63 OBJECT
: new
, checkcast
, instanceof
65 OPERAND_VALUE is
NEW, CHECKCAST
, or INSTANCEOF.
67 BRANCH
: branch operations
68 OPERAND_TYPE is GOTO
, CALL
, or
RETURN.
69 OPERAND_VALUE is IMMEDIATE_s2
, VAR_INDEX_1
, IMMEDIATE_s4
,
72 STACK
: Various stack operations.
74 PUSHC
: Push a constant onto the operand stack.
75 OPERAND_VALUE maybe be the value to push
,
76 or IMMEDIATE_s1 or IMMEDIATE_s2 if the constant is immediate
,
77 or CONST_INDEX_1 or CONST_INDEX_2 for a constant pool index.
79 LOAD
: Push a value from a local variable onto the operand stack.
80 OPERAND_VALUE is the index of the local variable in the current
81 Java frame. It can be a literal
, or IMMEDIATE_i2.
83 CONVERT
: Convert top of stack value from one type to another.
84 OPERAND_TYPE is the argument type.
85 OPERAND_VALUE is the result type.
87 TEST
: Compares an
integer (popped from the stack
) against zero.
88 If the
test (in OPERAND_VALUE
) is true
, goto a relative
89 offset given by the next two bytes.
91 COND
: Compares two
values (popped from the stack
) againt each other.
92 If the
test (in OPERAND_VALUE
) is true
, goto a relative
93 offset given by the next two bytes.
96 OPERAND_VALUE is either TABLE or LOOKUP.
99 OPERAND_VALUE is LOAD
, STORE
, LENGTH
, or
NEW.
101 FIELD
: Extracts from or stores into a field.
102 OPERAND_TYPE is
1 for a static field
, 0 for a regular field.
103 OPERAND_VALUE is
1 for a put operation
, 0 for a get operation.
106 Random bunch of opcodes.
110 JAVAOP (nop
, 0, STACK
, POP
, 0)
111 JAVAOP (aconst_null
, 1, PUSHC
, PTR
, 0)
112 JAVAOP (iconst_m1
, 2, PUSHC
, INT
, -1)
113 JAVAOP (iconst_0
, 3, PUSHC
, INT
, 0)
114 JAVAOP (iconst_1
, 4, PUSHC
, INT
, 1)
115 JAVAOP (iconst_2
, 5, PUSHC
, INT
, 2)
116 JAVAOP (iconst_3
, 6, PUSHC
, INT
, 3)
117 JAVAOP (iconst_4
, 7, PUSHC
, INT
, 4)
118 JAVAOP (iconst_5
, 8, PUSHC
, INT
, 5)
119 JAVAOP (lconst_0
, 9, PUSHC
, LONG
, 0)
120 JAVAOP (lconst_1
, 10, PUSHC
, LONG
, 1)
121 JAVAOP (fconst_0
, 11, PUSHC
, FLOAT, 0)
122 JAVAOP (fconst_1
, 12, PUSHC
, FLOAT, 1)
123 JAVAOP (fconst_2
, 13, PUSHC
, FLOAT, 2)
124 JAVAOP (dconst_0
, 14, PUSHC
, DOUBLE
, 0)
125 JAVAOP (dconst_1
, 15, PUSHC
, DOUBLE
, 1)
126 JAVAOP (bipush
, 16, PUSHC
, INT
, IMMEDIATE_s1
)
127 JAVAOP (sipush
, 17, PUSHC
, INT
, IMMEDIATE_s2
)
128 JAVAOP (ldc
, 18, PUSHC
, INT
, CONST_INDEX_1
)
129 JAVAOP (ldc_w
, 19, PUSHC
, INT
, CONST_INDEX_2
)
130 JAVAOP (ldc2_w
, 20, PUSHC
, LONG
, CONST_INDEX_2
)
131 JAVAOP (iload
, 21, LOAD
, INT
, IMMEDIATE_u1
)
132 JAVAOP (lload
, 22, LOAD
, LONG
, IMMEDIATE_u1
)
133 JAVAOP (fload
, 23, LOAD
, FLOAT, IMMEDIATE_u1
)
134 JAVAOP (dload
, 24, LOAD
, DOUBLE
, IMMEDIATE_u1
)
135 JAVAOP (aload
, 25, LOAD
, PTR
, IMMEDIATE_u1
)
136 JAVAOP (iload_0
, 26, LOAD
, INT
, 0)
137 JAVAOP (iload_1
, 27, LOAD
, INT
, 1)
138 JAVAOP (iload_2
, 28, LOAD
, INT
, 2)
139 JAVAOP (iload_3
, 29, LOAD
, INT
, 3)
140 JAVAOP (lload_0
, 30, LOAD
, LONG
, 0)
141 JAVAOP (lload_1
, 31, LOAD
, LONG
, 1)
142 JAVAOP (lload_2
, 32, LOAD
, LONG
, 2)
143 JAVAOP (lload_3
, 33, LOAD
, LONG
, 3)
144 JAVAOP (fload_0
, 34, LOAD
, FLOAT, 0)
145 JAVAOP (fload_1
, 35, LOAD
, FLOAT, 1)
146 JAVAOP (fload_2
, 36, LOAD
, FLOAT, 2)
147 JAVAOP (fload_3
, 37, LOAD
, FLOAT, 3)
148 JAVAOP (dload_0
, 38, LOAD
, DOUBLE
, 0)
149 JAVAOP (dload_1
, 39, LOAD
, DOUBLE
, 1)
150 JAVAOP (dload_2
, 40, LOAD
, DOUBLE
, 2)
151 JAVAOP (dload_3
, 41, LOAD
, DOUBLE
, 3)
152 JAVAOP (aload_0
, 42, LOAD
, PTR
, 0)
153 JAVAOP (aload_1
, 43, LOAD
, PTR
, 1)
154 JAVAOP (aload_2
, 44, LOAD
, PTR
, 2)
155 JAVAOP (aload_3
, 45, LOAD
, PTR
, 3)
156 JAVAOP (iaload
, 46, ARRAY, INT
, LOAD
)
157 JAVAOP (laload
, 47, ARRAY, LONG
, LOAD
)
158 JAVAOP (faload
, 48, ARRAY, FLOAT, LOAD
)
159 JAVAOP (daload
, 49, ARRAY, DOUBLE
, LOAD
)
160 JAVAOP (aaload
, 50, ARRAY, PTR
, LOAD
)
161 JAVAOP (baload
, 51, ARRAY, BYTE
, LOAD
)
162 JAVAOP (caload
, 52, ARRAY, CHAR, LOAD
)
163 JAVAOP (saload
, 53, ARRAY, SHORT
, LOAD
)
164 JAVAOP (istore
, 54, STORE
, INT
, IMMEDIATE_u1
)
165 JAVAOP (lstore
, 55, STORE
, LONG
, IMMEDIATE_u1
)
166 JAVAOP (fstore
, 56, STORE
, FLOAT, IMMEDIATE_u1
)
167 JAVAOP (dstore
, 57, STORE
, DOUBLE
, IMMEDIATE_u1
)
168 JAVAOP (astore
, 58, STORE
, PTR
, IMMEDIATE_u1
)
169 JAVAOP (istore_0
, 59, STORE
, INT
, 0)
170 JAVAOP (istore_1
, 60, STORE
, INT
, 1)
171 JAVAOP (istore_2
, 61, STORE
, INT
, 2)
172 JAVAOP (istore_3
, 62, STORE
, INT
, 3)
173 JAVAOP (lstore_0
, 63, STORE
, LONG
, 0)
174 JAVAOP (lstore_1
, 64, STORE
, LONG
, 1)
175 JAVAOP (lstore_2
, 65, STORE
, LONG
, 2)
176 JAVAOP (lstore_3
, 66, STORE
, LONG
, 3)
177 JAVAOP (fstore_0
, 67, STORE
, FLOAT, 0)
178 JAVAOP (fstore_1
, 68, STORE
, FLOAT, 1)
179 JAVAOP (fstore_2
, 69, STORE
, FLOAT, 2)
180 JAVAOP (fstore_3
, 70, STORE
, FLOAT, 3)
181 JAVAOP (dstore_0
, 71, STORE
, DOUBLE
, 0)
182 JAVAOP (dstore_1
, 72, STORE
, DOUBLE
, 1)
183 JAVAOP (dstore_2
, 73, STORE
, DOUBLE
, 2)
184 JAVAOP (dstore_3
, 74, STORE
, DOUBLE
, 3)
185 JAVAOP (astore_0
, 75, STORE
, PTR
, 0)
186 JAVAOP (astore_1
, 76, STORE
, PTR
, 1)
187 JAVAOP (astore_2
, 77, STORE
, PTR
, 2)
188 JAVAOP (astore_3
, 78, STORE
, PTR
, 3)
189 JAVAOP (iastore
, 79, ARRAY, INT
, STORE
)
190 JAVAOP (lastore
, 80, ARRAY, LONG
, STORE
)
191 JAVAOP (fastore
, 81, ARRAY, FLOAT, STORE
)
192 JAVAOP (dastore
, 82, ARRAY, DOUBLE
, STORE
)
193 JAVAOP (aastore
, 83, ARRAY, PTR
, STORE
)
194 JAVAOP (bastore
, 84, ARRAY, BYTE
, STORE
)
195 JAVAOP (castore
, 85, ARRAY, CHAR, STORE
)
196 JAVAOP (sastore
, 86, ARRAY, SHORT
, STORE
)
197 JAVAOP (pop
, 87, STACK
, POP
, 1)
198 JAVAOP (pop2
, 88, STACK
, POP
, 2)
199 JAVAOP (dup
, 89, STACK
, DUP
, 1)
200 JAVAOP (dup_x1
, 90, STACK
, DUPx1
, 1)
201 JAVAOP (dup_x2
, 91, STACK
, DUPx2
, 1)
202 JAVAOP (dup2
, 92, STACK
, DUP
, 2)
203 JAVAOP (dup2_x1
, 93, STACK
, DUPx1
, 2)
204 JAVAOP (dup2_x2
, 94, STACK
, DUPx2
, 2)
205 JAVAOP (swap
, 95, STACK
, SWAP
, 0)
206 JAVAOP (iadd
, 96, BINOP
, INT
, PLUS
)
207 JAVAOP (ladd
, 97, BINOP
, LONG
, PLUS
)
208 JAVAOP (fadd
, 98, BINOP
, FLOAT, PLUS
)
209 JAVAOP (dadd
, 99, BINOP
, DOUBLE
, PLUS
)
210 JAVAOP (isub
, 100, BINOP
, INT
, MINUS
)
211 JAVAOP (lsub
, 101, BINOP
, LONG
, MINUS
)
212 JAVAOP (fsub
, 102, BINOP
, FLOAT, MINUS
)
213 JAVAOP (dsub
, 103, BINOP
, DOUBLE
, MINUS
)
214 JAVAOP (imul
, 104, BINOP
, INT
, MULT
)
215 JAVAOP (lmul
, 105, BINOP
, LONG
, MULT
)
216 JAVAOP (fmul
, 106, BINOP
, FLOAT, MULT
)
217 JAVAOP (dmul
, 107, BINOP
, DOUBLE
, MULT
)
218 JAVAOP (idiv
, 108, BINOP
, INT
, TRUNC_DIV
)
219 JAVAOP (ldiv
, 109, BINOP
, LONG
, TRUNC_DIV
)
220 JAVAOP (fdiv
, 110, BINOP
, FLOAT, RDIV
)
221 JAVAOP (ddiv
, 111, BINOP
, DOUBLE
, RDIV
)
222 JAVAOP (irem
, 112, BINOP
, INT
, REM)
223 JAVAOP (lrem
, 113, BINOP
, LONG
, REM)
224 JAVAOP (frem
, 114, BINOP
, FLOAT, REM)
225 JAVAOP (drem
, 115, BINOP
, DOUBLE
, REM)
226 JAVAOP (ineg
, 116, UNOP
, INT
, NEG
)
227 JAVAOP (lneg
, 117, UNOP
, LONG
, NEG
)
228 JAVAOP (fneg
, 118, UNOP
, FLOAT, NEG
)
229 JAVAOP (dneg
, 119, UNOP
, DOUBLE
, NEG
)
230 JAVAOP (ishl
, 120, BINOP
, INT
, LSHIFT
)
231 JAVAOP (lshl
, 121, BINOP
, LONG
, LSHIFT
)
232 JAVAOP (ishr
, 122, BINOP
, INT
, RSHIFT
)
233 JAVAOP (lshr
, 123, BINOP
, LONG
, RSHIFT
)
234 JAVAOP (iushr
, 124, BINOP
, INT
, URSHIFT
)
235 JAVAOP (lushr
, 125, BINOP
, LONG
, URSHIFT
)
236 JAVAOP (iand
, 126, BINOP
, INT
, BIT_AND
)
237 JAVAOP (land
, 127, BINOP
, LONG
, BIT_AND
)
238 JAVAOP (ior
, 128, BINOP
, INT
, BIT_IOR
)
239 JAVAOP (lor
, 129, BINOP
, LONG
, BIT_IOR
)
240 JAVAOP (ixor
, 130, BINOP
, INT
, BIT_XOR
)
241 JAVAOP (lxor
, 131, BINOP
, LONG
, BIT_XOR
)
242 JAVAOP (iinc
, 132, SPECIAL
, INT
, IINC
)
243 JAVAOP (i2l
, 133, CONVERT
, INT
, LONG
)
244 JAVAOP (i2f
, 134, CONVERT
, INT
, FLOAT)
245 JAVAOP (i2d
, 135, CONVERT
, INT
, DOUBLE
)
246 JAVAOP (l2i
, 136, CONVERT
, LONG
, INT
)
247 JAVAOP (l2f
, 137, CONVERT
, LONG
, FLOAT)
248 JAVAOP (l2d
, 138, CONVERT
, LONG
, DOUBLE
)
249 JAVAOP (f2i
, 139, CONVERT
, FLOAT, INT
)
250 JAVAOP (f2l
, 140, CONVERT
, FLOAT, LONG
)
251 JAVAOP (f2d
, 141, CONVERT
, FLOAT, DOUBLE
)
252 JAVAOP (d2i
, 142, CONVERT
, DOUBLE
, INT
)
253 JAVAOP (d2l
, 143, CONVERT
, DOUBLE
, LONG
)
254 JAVAOP (d2f
, 144, CONVERT
, DOUBLE
, FLOAT)
255 JAVAOP (i2b
, 145, CONVERT2
, INT
, BYTE
)
256 JAVAOP (i2c
, 146, CONVERT2
, INT
, CHAR)
257 JAVAOP (i2s
, 147, CONVERT2
, INT
, SHORT
)
258 JAVAOP (lcmp
, 148, BINOP
, LONG
, COMPARE
)
259 JAVAOP (fcmpl
, 149, BINOP
, FLOAT, COMPARE_L
)
260 JAVAOP (fcmpg
, 150, BINOP
, FLOAT, COMPARE_G
)
261 JAVAOP (dcmpl
, 151, BINOP
, DOUBLE
, COMPARE_L
)
262 JAVAOP (dcmpg
, 152, BINOP
, DOUBLE
, COMPARE_G
)
263 JAVAOP (ifeq
, 153, TEST
, INT
, EQ
)
264 JAVAOP (ifne
, 154, TEST
, INT
, NE
)
265 JAVAOP (iflt
, 155, TEST
, INT
, LT
)
266 JAVAOP (ifge
, 156, TEST
, INT
, GE
)
267 JAVAOP (ifgt
, 157, TEST
, INT
, GT
)
268 JAVAOP (ifle
, 158, TEST
, INT
, LE
)
269 JAVAOP (if_icmpeq
, 159, COND
, INT
, EQ
)
270 JAVAOP (if_icmpne
, 160, COND
, INT
, NE
)
271 JAVAOP (if_icmplt
, 161, COND
, INT
, LT
)
272 JAVAOP (if_icmpge
, 162, COND
, INT
, GE
)
273 JAVAOP (if_icmpgt
, 163, COND
, INT
, GT
)
274 JAVAOP (if_icmple
, 164, COND
, INT
, LE
)
275 JAVAOP (if_acmpeq
, 165, COND
, PTR
, EQ
)
276 JAVAOP (if_acmpne
, 166, COND
, PTR
, NE
)
277 JAVAOP (goto
, 167, BRANCH
, GOTO
, IMMEDIATE_s2
)
278 JAVAOP (jsr
, 168, JSR
, CALL
, IMMEDIATE_s2
)
279 JAVAOP (ret
, 169, RET
, RETURN, VAR_INDEX_1
)
280 JAVAOP (tableswitch
, 170, SWITCH
, INT
, TABLE
)
281 JAVAOP (lookupswitch
, 171, SWITCH
, INT
, LOOKUP
)
282 JAVAOP (ireturn
, 172, RETURN, INT
, 0)
283 JAVAOP (lreturn
, 173, RETURN, LONG
, 0)
284 JAVAOP (freturn
, 174, RETURN, FLOAT, 0)
285 JAVAOP (dreturn
, 175, RETURN, DOUBLE
, 0)
286 JAVAOP (areturn
, 176, RETURN, PTR
, 0)
287 JAVAOP (return
, 177, RETURN, VOID
, 0)
288 JAVAOP (getstatic
, 178, FIELD
, 1, 0)
289 JAVAOP (putstatic
, 179, FIELD
, 1, 1)
290 JAVAOP (getfield
, 180, FIELD
, 0, 0)
291 JAVAOP (putfield
, 181, FIELD
, 0, 1)
292 JAVAOP (invokevirtual
, 182, INVOKE
, VIRTUAL
,0)
293 JAVAOP (invokespecial
, 183, INVOKE
, SPECIAL
, 0)
294 JAVAOP (invokestatic
, 184, INVOKE
, STATIC
, 0)
295 JAVAOP (invokeinterface
,185, INVOKE
, INTERFACE
, 1)
296 JAVAOP (new
, 187, OBJECT
, PTR
, NEW)
297 JAVAOP (newarray
, 188, ARRAY, NUM
, NEW)
298 JAVAOP (anewarray
, 189, ARRAY, PTR
, NEW)
299 JAVAOP (arraylength
, 190, ARRAY, INT
, LENGTH
)
300 JAVAOP (athrow
, 191, SPECIAL
, ANY
, THROW
)
301 JAVAOP (checkcast
, 192, OBJECT
, PTR
, CHECKCAST
)
302 JAVAOP (instanceof
, 193, OBJECT
, PTR
, INSTANCEOF
)
303 JAVAOP (monitorenter
, 194, SPECIAL
, MONITOR
, ENTER
)
304 JAVAOP (monitorexit
, 195, SPECIAL
, MONITOR
, EXIT)
305 JAVAOP (wide
, 196, SPECIAL
, ANY
, WIDE
)
306 JAVAOP (multianewarray
,197, ARRAY, MULTI
, NEW)
307 JAVAOP (ifnull
, 198, TEST
, PTR
, EQ
)
308 JAVAOP (ifnonnull
, 199, TEST
, PTR
, NE
)
309 JAVAOP (goto_w
, 200, BRANCH
, GOTO
, IMMEDIATE_s4
)
310 JAVAOP (jsr_w
, 201, JSR
, CALL
, IMMEDIATE_s4
)
311 JAVAOP (breakpoint
, 202, SPECIAL
, ANY
, BREAK
)
312 JAVAOP (ret_w
, 209, RET
, RETURN, VAR_INDEX_2
)
313 JAVAOP (impdep1
, 254, IMPL
, ANY
, 1)
314 JAVAOP (impdep2
, 255, IMPL
, ANY
, 2)