* Merged with 0da121c758b9.
[cacao.git] / src / vm / jit / ir / bytecode.c
1 /* src/vm/jit/ir/bytecode.c - Java byte code handling
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 #include "config.h"
27
28 #include <stdint.h>
29
30 #include "vm/jit/ir/bytecode.h"
31
32
33 /* bytecodes ******************************************************************/
34
35 bytecode_t bytecode[256] = {
36         { 1, 0,   "nop"             },
37         { 1, 1,   "aconst_null"     },
38         { 1, 1,   "iconst_m1"       },
39         { 1, 1,   "iconst"          },
40         { 1, 1,   "iconst_1"        },
41         { 1, 1,   "iconst_2"        },
42         { 1, 1,   "iconst_3"        },
43         { 1, 1,   "iconst_4"        },
44         { 1, 1,   "iconst_5"        },
45         { 1, 1,   "lconst_0"        },
46         { 1, 1,   "lconst_1"        },
47         { 1, 1,   "fconst_0"        },
48         { 1, 1,   "fconst_1"        },
49         { 1, 1,   "fconst_2"        },
50         { 1, 1,   "dconst_0"        },
51         { 1, 1,   "dconst_1"        },
52         { 2, 1,   "bipush"          },
53         { 3, 1,   "sipush"          },
54         { 2, 1,   "ldc"             },
55         { 3, 1,   "ldc_w"           },
56         { 3, 1,   "ldc2_w"          },
57         { 2, 1,   "iload"           },
58         { 2, 1,   "lload"           },
59         { 2, 1,   "fload"           },
60         { 2, 1,   "dload"           },
61         { 2, 1,   "aload"           },
62         { 1, 1,   "iload_0"         },
63         { 1, 1,   "iload_1"         },
64         { 1, 1,   "iload_2"         },
65         { 1, 1,   "iload_3"         },
66         { 1, 1,   "lload_0"         },
67         { 1, 1,   "lload_1"         },
68         { 1, 1,   "lload_2"         },
69         { 1, 1,   "lload_3"         },
70         { 1, 1,   "fload_0"         },
71         { 1, 1,   "fload_1"         },
72         { 1, 1,   "fload_2"         },
73         { 1, 1,   "fload_3"         },
74         { 1, 1,   "dload_0"         },
75         { 1, 1,   "dload_1"         },
76         { 1, 1,   "dload_2"         },
77         { 1, 1,   "dload_3"         },
78         { 1, 1,   "aload_0"         },
79         { 1, 1,   "aload_1"         },
80         { 1, 1,   "aload_2"         },
81         { 1, 1,   "aload_3"         },
82         { 1, 1,   "iaload"          },
83         { 1, 1,   "laload"          },
84         { 1, 1,   "faload"          },
85         { 1, 1,   "daload"          },
86         { 1, 1,   "aaload"          },
87         { 1, 1,   "baload"          },
88         { 1, 1,   "caload"          },
89         { 1, 1,   "saload"          },
90         { 2, 0,   "istore"          },
91         { 2, 0,   "lstore"          },
92         { 2, 0,   "fstore"          },
93         { 2, 0,   "dstore"          },
94         { 2, 0,   "astore"          },
95         { 1, 0,   "istore_0"        },
96         { 1, 0,   "istore_1"        },
97         { 1, 0,   "istore_2"        },
98         { 1, 0,   "istore_3"        },
99         { 1, 0,   "lstore_0"        },
100         { 1, 0,   "lstore_1"        },
101         { 1, 0,   "lstore_2"        },
102         { 1, 0,   "lstore_3"        },
103         { 1, 0,   "fstore_0"        },
104         { 1, 0,   "fstore_1"        },
105         { 1, 0,   "fstore_2"        },
106         { 1, 0,   "fstore_3"        },
107         { 1, 0,   "dstore_0"        },
108         { 1, 0,   "dstore_1"        },
109         { 1, 0,   "dstore_2"        },
110         { 1, 0,   "dstore_3"        },
111         { 1, 0,   "astore_0"        },
112         { 1, 0,   "astore_1"        },
113         { 1, 0,   "astore_2"        },
114         { 1, 0,   "astore_3"        },
115         { 1, 0,   "iastore"         },
116         { 1, 0,   "lastore"         },
117         { 1, 0,   "fastore"         },
118         { 1, 0,   "dastore"         },
119         { 1, 0,   "aastore"         },
120         { 1, 0,   "bastore"         },
121         { 1, 0,   "castore"         },
122         { 1, 0,   "sastore"         },
123         { 1, 0,   "pop"             },
124         { 1, 0,   "pop2"            },
125         { 1, 1,   "dup"             },
126         { 1, 1+3, "dup_x1"          },
127         { 1, 2+4, "dup_x2"          },
128         { 1, 2,   "dup2"            },
129         { 1, 2+5, "dup2_x1"         },
130         { 1, 3+6, "dup2_x2"         },
131         { 1, 1+2, "swap"            },
132         { 1, 1,   "iadd"            },
133         { 1, 1,   "ladd"            },
134         { 1, 1,   "fadd"            },
135         { 1, 1,   "dadd"            },
136         { 1, 1,   "isub"            },
137         { 1, 1,   "lsub"            },
138         { 1, 1,   "fsub"            },
139         { 1, 1,   "dsub"            },
140         { 1, 1,   "imul"            },
141         { 1, 1,   "lmul"            },
142         { 1, 1,   "fmul"            },
143         { 1, 1,   "dmul"            },
144         { 1, 1,   "idiv"            },
145         { 1, 1,   "ldiv"            },
146         { 1, 1,   "fdiv"            },
147         { 1, 1,   "ddiv"            },
148         { 1, 1,   "irem"            },
149         { 1, 1,   "lrem"            },
150         { 1, 1,   "frem"            },
151         { 1, 1,   "drem"            },
152         { 1, 1,   "ineg"            },
153         { 1, 1,   "lneg"            },
154         { 1, 1,   "fneg"            },
155         { 1, 1,   "dneg"            },
156         { 1, 1,   "ishl"            },
157         { 1, 1,   "lshl"            },
158         { 1, 1,   "ishr"            },
159         { 1, 1,   "lshr"            },
160         { 1, 1,   "iushr"           },
161         { 1, 1,   "lushr"           },
162         { 1, 1,   "iand"            },
163         { 1, 1,   "land"            },
164         { 1, 1,   "ior"             },
165         { 1, 1,   "lor"             },
166         { 1, 1,   "ixor"            },
167         { 1, 1,   "lxor"            },
168         { 3, 0,   "iinc"            },
169         { 1, 1,   "i2l"             },
170         { 1, 1,   "i2f"             },
171         { 1, 1,   "i2d"             },
172         { 1, 1,   "l2i"             },
173         { 1, 1,   "l2f"             },
174         { 1, 1,   "l2d"             },
175         { 1, 1,   "f2i"             },
176         { 1, 1,   "f2l"             },
177         { 1, 1,   "f2d"             },
178         { 1, 1,   "d2i"             },
179         { 1, 1,   "d2l"             },
180         { 1, 1,   "d2f"             },
181         { 1, 1,   "int2byte"        },
182         { 1, 1,   "int2char"        },
183         { 1, 1,   "int2short"       },
184         { 1, 1,   "lcmp"            },
185         { 1, 1,   "fcmpl"           },
186         { 1, 1,   "fcmpg"           },
187         { 1, 1,   "dcmpl"           },
188         { 1, 1,   "dcmpg"           },
189         { 3, 0,   "ifeq"            },
190         { 3, 0,   "ifne"            },
191         { 3, 0,   "iflt"            },
192         { 3, 0,   "ifge"            },
193         { 3, 0,   "ifgt"            },
194         { 3, 0,   "ifle"            },
195         { 3, 0,   "if_icmpe"        },
196         { 3, 0,   "if_icmpne"       },
197         { 3, 0,   "if_icmplt"       },
198         { 3, 0,   "if_icmpge"       },
199         { 3, 0,   "if_icmpgt"       },
200         { 3, 0,   "if_icmple"       },
201         { 3, 0,   "if_acmpeq"       },
202         { 3, 0,   "if_acmpne"       },
203         { 3, 0,   "goto"            },
204         { 3, 1,   "jsr"             },
205         { 2, 0,   "ret"             },
206         { 0, 0,   "tableswitch"     },
207         { 0, 0,   "lookupswitch"    },
208         { 1, 0,   "ireturn"         },
209         { 1, 0,   "lreturn"         },
210         { 1, 0,   "freturn"         },
211         { 1, 0,   "dreturn"         },
212         { 1, 0,   "areturn"         },
213         { 1, 0,   "return"          },
214         { 3, 1,   "getstatic"       },
215         { 3, 0,   "putstatic"       },
216         { 3, 1,   "getfield"        },
217         { 3, 0,   "putfield"        },
218         { 3, 1,   "invokevirtual"   },
219         { 3, 1,   "invokespecial"   },
220         { 3, 1,   "invokestatic"    },
221         { 5, 1,   "invokeinterface" },
222         { 1, 1,   "undef186"        }, /* XXX */
223         { 3, 1,   "new"             },
224         { 2, 1,   "newarray"        },
225         { 3, 1,   "anewarray"       },
226         { 1, 1,   "arraylength"     },
227         { 1, 1,   "athrow"          },
228         { 3, 1,   "checkcast"       },
229         { 3, 1,   "instanceof"      },
230         { 1, 0,   "monitorenter"    },
231         { 1, 0,   "monitorexit"     },
232         { 0, 0,   "wide"            },
233         { 4, 1,   "multianewarray"  },
234         { 3, 0,   "ifnull"          },
235         { 3, 0,   "ifnonnull"       },
236         { 5, 0,   "goto_w"          },
237         { 5, 1,   "jsr_w"           },
238         { 1, 0,   "breakpoint"      },
239 };
240
241
242 /*
243  * These are local overrides for various environment variables in Emacs.
244  * Please do not remove this and leave it at the end of the file, where
245  * Emacs will automagically detect them.
246  * ---------------------------------------------------------------------
247  * Local variables:
248  * mode: c
249  * indent-tabs-mode: t
250  * c-basic-offset: 4
251  * tab-width: 4
252  * End:
253  * vim:noexpandtab:sw=4:ts=4:
254  */