CACAO
bytecode.hpp
Go to the documentation of this file.
1 /* src/vm/jit/ir/bytecode.hpp - Java byte code definitions
2 
3  Copyright (C) 2007
4  CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
5 
6  This file is part of CACAO.
7 
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.
12 
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.
17 
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
21  02110-1301, USA.
22 
23 */
24 
25 
26 #ifndef BYTECODE_HPP_
27 #define BYTECODE_HPP_ 1
28 
29 #include "config.h"
30 
31 
32 /* bytecode_t *****************************************************************/
33 
34 typedef struct bytecode_t bytecode_t;
35 
36 struct bytecode_t {
37  int length; /* length of the instruction in bytes */
38  int slots; /* required stack slots */
39  const char *mnemonic;
40 };
41 
42 extern bytecode_t bytecode[256];
43 
44 
45 /* Java bytecodes *************************************************************/
46 
47 enum ByteCode {
48  BC_nop = 0,
49 
51 
59 
62 
66 
69 
70  BC_bipush = 16,
71  BC_sipush = 17,
72 
73  BC_ldc1 = 18,
74  BC_ldc2 = 19,
75  BC_ldc2w = 20,
76 
77  BC_iload = 21,
78  BC_lload = 22,
79  BC_fload = 23,
80  BC_dload = 24,
81  BC_aload = 25,
82 
83  BC_iload_0 = 26,
84  BC_iload_1 = 27,
85  BC_iload_2 = 28,
86  BC_iload_3 = 29,
87 
88  BC_lload_0 = 30,
89  BC_lload_1 = 31,
90  BC_lload_2 = 32,
91  BC_lload_3 = 33,
92 
93  BC_fload_0 = 34,
94  BC_fload_1 = 35,
95  BC_fload_2 = 36,
96  BC_fload_3 = 37,
97 
98  BC_dload_0 = 38,
99  BC_dload_1 = 39,
102 
107 
108  BC_iaload = 46,
109  BC_laload = 47,
110  BC_faload = 48,
111  BC_daload = 49,
112  BC_aaload = 50,
113  BC_baload = 51,
114  BC_caload = 52,
115  BC_saload = 53,
116 
117  BC_istore = 54,
118  BC_lstore = 55,
119  BC_fstore = 56,
120  BC_dstore = 57,
121  BC_astore = 58,
122 
127 
132 
137 
142 
147 
156 
157  BC_pop = 87,
158  BC_pop2 = 88,
159  BC_dup = 89,
160  BC_dup_x1 = 90,
161  BC_dup_x2 = 91,
162  BC_dup2 = 92,
165  BC_swap = 95,
166 
167  BC_iadd = 96,
168  BC_ladd = 97,
169  BC_fadd = 98,
170  BC_dadd = 99,
171 
172  BC_isub = 100,
173  BC_lsub = 101,
174  BC_fsub = 102,
175  BC_dsub = 103,
176 
177  BC_imul = 104,
178  BC_lmul = 105,
179  BC_fmul = 106,
180  BC_dmul = 107,
181 
182  BC_idiv = 108,
183  BC_ldiv = 109,
184  BC_fdiv = 110,
185  BC_ddiv = 111,
186 
187  BC_irem = 112,
188  BC_lrem = 113,
189  BC_frem = 114,
190  BC_drem = 115,
191 
192  BC_ineg = 116,
193  BC_lneg = 117,
194  BC_fneg = 118,
195  BC_dneg = 119,
196 
197  BC_ishl = 120,
198  BC_lshl = 121,
199  BC_ishr = 122,
200  BC_lshr = 123,
201  BC_iushr = 124,
202  BC_lushr = 125,
203 
204  BC_iand = 126,
205  BC_land = 127,
206  BC_ior = 128,
207  BC_lor = 129,
208  BC_ixor = 130,
209  BC_lxor = 131,
210 
211  BC_iinc = 132,
212 
213  BC_i2l = 133,
214  BC_i2f = 134,
215  BC_i2d = 135,
216  BC_l2i = 136,
217  BC_l2f = 137,
218  BC_l2d = 138,
219  BC_f2i = 139,
220  BC_f2l = 140,
221  BC_f2d = 141,
222  BC_d2i = 142,
223  BC_d2l = 143,
224  BC_d2f = 144,
225 
226  BC_int2byte = 145,
227  BC_int2char = 146,
229 
230  BC_lcmp = 148,
231  BC_fcmpl = 149,
232  BC_fcmpg = 150,
233  BC_dcmpl = 151,
234  BC_dcmpg = 152,
235 
236  BC_ifeq = 153,
237  BC_ifne = 154,
238  BC_iflt = 155,
239  BC_ifge = 156,
240  BC_ifgt = 157,
241  BC_ifle = 158,
242 
251 
252  BC_goto = 167,
253  BC_jsr = 168,
254  BC_ret = 169,
255 
258 
259  BC_ireturn = 172,
260  BC_lreturn = 173,
261  BC_freturn = 174,
262  BC_dreturn = 175,
263  BC_areturn = 176,
264  BC_return = 177,
265 
268  BC_getfield = 180,
269  BC_putfield = 181,
270 
275 
276  /* xxxunusedxxx 186 */
277 
278  BC_new = 187,
279  BC_newarray = 188,
281 
283 
284  BC_athrow = 191,
285 
288 
291 
292  BC_wide = 196,
293 
295 
296  BC_ifnull = 198,
298 
299  BC_goto_w = 200,
300  BC_jsr_w = 201,
301 
302  /* Reserved opcodes. */
303 
305 
306  BC_impdep1 = 254,
308 };
309 
310 #endif // BYTECODE_HPP_
311 
312 
313 /*
314  * These are local overrides for various environment variables in Emacs.
315  * Please do not remove this and leave it at the end of the file, where
316  * Emacs will automagically detect them.
317  * ---------------------------------------------------------------------
318  * Local variables:
319  * mode: c++
320  * indent-tabs-mode: t
321  * c-basic-offset: 4
322  * tab-width: 4
323  * End:
324  * vim:noexpandtab:sw=4:ts=4:
325  */
const char * mnemonic
Definition: bytecode.hpp:39
ByteCode
Definition: bytecode.hpp:47
int length
Definition: bytecode.hpp:37
bytecode_t bytecode[256]
Definition: bytecode.cpp:33