1 /* src/vm/jit/ir/icmd.hpp - Intermediate Commands
4 CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
6 This file is part of CACAO.
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License as
10 published by the Free Software Foundation; either version 2, or (at
11 your option) any later version.
13 This program is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
33 #include "vm/jit/ir/bytecode.h"
36 // JavaVM operation codes (sorted).
40 ICMD_ACONST = BC_aconst_null,
44 ICMD_ICONST = BC_iconst_0,
55 ICMD_LCONST = BC_lconst_0,
59 ICMD_FCONST = BC_fconst_0,
64 ICMD_DCONST = BC_dconst_0,
74 /* Order of LOAD instructions must be equal to order of TYPE_*
77 ICMD_ILOAD = BC_iload,
78 ICMD_LLOAD = BC_lload,
79 ICMD_FLOAD = BC_fload,
80 ICMD_DLOAD = BC_dload,
81 ICMD_ALOAD = BC_aload,
105 ICMD_LUSHRCONST = 44,
109 ICMD_IALOAD = BC_iaload,
110 ICMD_LALOAD = BC_laload,
111 ICMD_FALOAD = BC_faload,
112 ICMD_DALOAD = BC_daload,
113 ICMD_AALOAD = BC_aaload,
114 ICMD_BALOAD = BC_baload,
115 ICMD_CALOAD = BC_caload,
116 ICMD_SALOAD = BC_saload,
118 /* Order of STORE instructions must be equal to order of TYPE_*
121 ICMD_ISTORE = BC_istore,
122 ICMD_LSTORE = BC_lstore,
123 ICMD_FSTORE = BC_fstore,
124 ICMD_DSTORE = BC_dstore,
125 ICMD_ASTORE = BC_astore,
150 ICMD_IASTORE = BC_iastore,
151 ICMD_LASTORE = BC_lastore,
152 ICMD_FASTORE = BC_fastore,
153 ICMD_DASTORE = BC_dastore,
154 ICMD_AASTORE = BC_aastore,
155 ICMD_BASTORE = BC_bastore,
156 ICMD_CASTORE = BC_castore,
157 ICMD_SASTORE = BC_sastore,
162 ICMD_DUP_X1 = BC_dup_x1,
163 ICMD_DUP_X2 = BC_dup_x2,
165 ICMD_DUP2_X1 = BC_dup2_x1,
166 ICMD_DUP2_X2 = BC_dup2_x2,
203 ICMD_IUSHR = BC_iushr,
204 ICMD_LUSHR = BC_lushr,
228 ICMD_INT2BYTE = BC_int2byte,
229 ICMD_INT2CHAR = BC_int2char,
230 ICMD_INT2SHORT = BC_int2short,
233 ICMD_FCMPL = BC_fcmpl,
234 ICMD_FCMPG = BC_fcmpg,
235 ICMD_DCMPL = BC_dcmpl,
236 ICMD_DCMPG = BC_dcmpg,
245 ICMD_IF_ICMPEQ = BC_if_icmpeq,
246 ICMD_IF_ICMPNE = BC_if_icmpne,
247 ICMD_IF_ICMPLT = BC_if_icmplt,
248 ICMD_IF_ICMPGE = BC_if_icmpge,
249 ICMD_IF_ICMPGT = BC_if_icmpgt,
250 ICMD_IF_ICMPLE = BC_if_icmple,
251 ICMD_IF_ACMPEQ = BC_if_acmpeq,
252 ICMD_IF_ACMPNE = BC_if_acmpne,
258 ICMD_TABLESWITCH = BC_tableswitch,
259 ICMD_LOOKUPSWITCH = BC_lookupswitch,
261 ICMD_IRETURN = BC_ireturn,
262 ICMD_LRETURN = BC_lreturn,
263 ICMD_FRETURN = BC_freturn,
264 ICMD_DRETURN = BC_dreturn,
265 ICMD_ARETURN = BC_areturn,
266 ICMD_RETURN = BC_return,
268 ICMD_GETSTATIC = BC_getstatic,
269 ICMD_PUTSTATIC = BC_putstatic,
270 ICMD_GETFIELD = BC_getfield,
271 ICMD_PUTFIELD = BC_putfield,
273 ICMD_INVOKEVIRTUAL = BC_invokevirtual,
274 ICMD_INVOKESPECIAL = BC_invokespecial,
275 ICMD_INVOKESTATIC = BC_invokestatic,
276 ICMD_INVOKEINTERFACE = BC_invokeinterface,
281 ICMD_NEWARRAY = BC_newarray,
282 ICMD_ANEWARRAY = BC_anewarray,
284 ICMD_ARRAYLENGTH = BC_arraylength,
286 ICMD_ATHROW = BC_athrow,
288 ICMD_CHECKCAST = BC_checkcast,
289 ICMD_INSTANCEOF = BC_instanceof,
291 ICMD_MONITORENTER = BC_monitorenter,
292 ICMD_MONITOREXIT = BC_monitorexit,
296 ICMD_MULTIANEWARRAY = BC_multianewarray,
298 ICMD_IFNULL = BC_ifnull,
299 ICMD_IFNONNULL = BC_ifnonnull,
305 ICMD_IASTORECONST = 204,
306 ICMD_LASTORECONST = 205,
307 ICMD_FASTORECONST = 206,
308 ICMD_DASTORECONST = 207,
309 ICMD_AASTORECONST = 208,
310 ICMD_BASTORECONST = 209,
311 ICMD_CASTORECONST = 210,
312 ICMD_SASTORECONST = 211,
314 ICMD_PUTSTATICCONST = 212,
315 ICMD_PUTFIELDCONST = 213,
320 ICMD_GETEXCEPTION = 249,
323 ICMD_INLINE_START = 251, /* instruction before inlined method */
324 ICMD_INLINE_END = 252, /* instruction after inlined method */
325 ICMD_INLINE_BODY = 253, /* start of inlined body */
327 ICMD_BUILTIN = 255 /* internal opcode */
331 /* data-flow constants for the ICMD table ************************************/
338 #define DF_DST_BASE 4 /* from this value on, iptr->dst is a variable */
340 #define DF_0_TO_1 (DF_DST_BASE + 0)
341 #define DF_1_TO_1 (DF_DST_BASE + 1)
342 #define DF_2_TO_1 (DF_DST_BASE + 2)
343 #define DF_3_TO_1 (DF_DST_BASE + 3)
344 #define DF_N_TO_1 (DF_DST_BASE + 4)
346 #define DF_INVOKE (DF_DST_BASE + 5)
347 #define DF_BUILTIN (DF_DST_BASE + 6)
349 #define DF_COPY (DF_DST_BASE + 7)
350 #define DF_MOVE (DF_DST_BASE + 8)
356 #define DF_DUP2_X1 -1
357 #define DF_DUP2_X2 -1
360 /* special data-flow recognized by verify/generate.pl: */
361 #define DF_LOAD DF_COPY
362 #define DF_STORE DF_MOVE
363 #define DF_IINC DF_1_TO_1
364 #define DF_POP DF_1_TO_0
365 #define DF_POP2 DF_2_TO_0
368 // Control-flow constants for the ICMD table.
372 #define CF_END_BASE 2 /* from here on, they mark the end of a superblock */
374 #define CF_END (CF_END_BASE + 0)
375 #define CF_GOTO (CF_END_BASE + 1)
376 #define CF_TABLE (CF_END_BASE + 2)
377 #define CF_LOOKUP (CF_END_BASE + 3)
378 #define CF_JSR (CF_END_BASE + 4)
379 #define CF_RET (CF_END_BASE + 5)
382 // Flag constants for the ICMD table.
383 #define ICMDTABLE_PEI 0x0001 /* ICMD may throw an exception */
384 #define ICMDTABLE_CALLS 0x0002 /* needs registers to be saved, may call */
388 typedef struct icmdtable_entry_t icmdtable_entry_t;
390 struct icmdtable_entry_t {
392 const char* name; /* name, without ICMD_ prefix */
394 int32_t dataflow; /* a DF_ constant, see above */
395 int32_t controlflow; /* a CF_ constant, see above */
396 int32_t flags; /* a combination of ICMDTABLE_ flags */
401 extern icmdtable_entry_t icmd_table[256];
407 * These are local overrides for various environment variables in Emacs.
408 * Please do not remove this and leave it at the end of the file, where
409 * Emacs will automagically detect them.
410 * ---------------------------------------------------------------------
413 * indent-tabs-mode: t
417 * vim:noexpandtab:sw=4:ts=4: