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