0e0ee9aeb1ad68c6d680b295576fe9943f451d0c
[cacao.git] / src / vm / builtintable.inc
1 /* src/vm/builtintable.inc - tables of builtin functions
2
3    Copyright (C) 1996-2005 R. Grafl, A. Krall, C. Kruegel, C. Oates,
4    R. Obermaisser, M. Platter, M. Probst, S. Ring, E. Steiner,
5    C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, J. Wenninger,
6    Institut f. Computersprachen - TU Wien
7
8    This file is part of CACAO.
9
10    This program is free software; you can redistribute it and/or
11    modify it under the terms of the GNU General Public License as
12    published by the Free Software Foundation; either version 2, or (at
13    your option) any later version.
14
15    This program is distributed in the hope that it will be useful, but
16    WITHOUT ANY WARRANTY; without even the implied warranty of
17    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18    General Public License for more details.
19
20    You should have received a copy of the GNU General Public License
21    along with this program; if not, write to the Free Software
22    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
23    02111-1307, USA.
24
25    Contact: cacao@complang.tuwien.ac.at
26
27    Authors: Christian Thalinger
28
29    Changes:
30
31    $Id: builtintable.inc 4167 2006-01-12 21:55:07Z twisti $
32
33 */
34
35
36 #include "config.h"
37 #include "arch.h"
38 #include "vm/builtin.h"
39 #include "vm/jit/jit.h"
40
41
42 /* internal and not automatically replaced functions **************************/
43
44 static builtintable_entry builtintable_internal[] = {
45
46 #if defined(__ALPHA__) || defined(DISABLE_GC)
47         {
48                 ICMD_F2L,
49                 BUILTIN_f2l,
50                 "(F)J",
51                 "f2l",
52                 NULL
53         },
54         {
55                 ICMD_D2L,
56                 BUILTIN_d2l,
57                 "(D)J",
58                 "d2l",
59                 NULL
60         },
61         {
62                 ICMD_F2I,
63                 BUILTIN_f2i,
64                 "(F)I",
65                 "f2i",
66                 NULL
67         },
68         {
69                 ICMD_D2I,
70                 BUILTIN_d2i,
71                 "(D)I",
72                 "d2i",
73                 NULL
74         },
75 #endif
76
77 #if !SUPPORT_DIVISION || defined(DISABLE_GC)
78         {
79                 ICMD_IDIV,
80                 BUILTIN_idiv,
81                 "(II)I",
82                 "idiv",
83                 NULL
84         },
85         {
86                 ICMD_IREM,
87                 BUILTIN_irem,
88                 "(II)I",
89                 "irem",
90                 NULL
91         },
92 #endif
93
94 #if !(SUPPORT_DIVISION && SUPPORT_LONG && SUPPORT_LONG_DIV) || defined(DISABLE_GC)
95         {
96                 ICMD_LDIV,
97                 BUILTIN_ldiv,
98                 "(JJ)J",
99                 "ldiv",
100                 NULL
101         },
102         {
103                 ICMD_LREM,
104                 BUILTIN_lrem,
105                 "(JJ)J",
106                 "lrem",
107                 NULL
108         },
109 #endif
110
111         {
112                 ICMD_FREM,
113                 BUILTIN_frem,
114                 "(FF)F",
115                 "frem",
116                 NULL
117         },
118         {
119                 ICMD_DREM,
120                 BUILTIN_drem,
121                 "(DD)D",
122                 "drem",
123                 NULL
124         },
125
126
127         /* internal functions *****************************************************/
128
129         {
130                 ICMD_NEW,
131                 BUILTIN_new,
132                 "(Ljava/lang/Class;)Ljava/lang/Object;",
133                 "new",
134                 NULL
135         },
136         {
137                 ICMD_ANEWARRAY,
138                 BUILTIN_newarray,
139         "(ILjava/lang/Class;)[Ljava/lang/Object;",
140                 "newarray",
141                 NULL
142         },
143         {
144                 ICMD_NEWARRAY,
145                 BUILTIN_newarray_boolean,
146                 "(I)[Z",
147                 "newarray_boolean",
148                 NULL
149         },
150         {
151                 ICMD_NEWARRAY,
152                 BUILTIN_newarray_byte,
153                 "(I)[B",
154                 "newarray_byte",
155                 NULL
156         },
157         {
158                 ICMD_NEWARRAY,
159                 BUILTIN_newarray_char,
160                 "(I)[C",
161                 "newarray_char",
162                 NULL
163         },
164         {
165                 ICMD_NEWARRAY,
166                 BUILTIN_newarray_short,
167                 "(I)[S",
168                 "newarray_short",
169                 NULL
170         },
171         {
172                 ICMD_NEWARRAY,
173                 BUILTIN_newarray_int,
174                 "(I)[I",
175                 "newarray_int",
176                 NULL
177         },
178         {
179                 ICMD_NEWARRAY,
180                 BUILTIN_newarray_long,
181                 "(I)[J",
182                 "newarray_long",
183                 NULL
184         },
185         {
186                 ICMD_NEWARRAY,
187                 BUILTIN_newarray_float,
188                 "(I)[F",
189                 "newarray_float",
190                 NULL
191         },
192         {
193                 ICMD_NEWARRAY,
194                 BUILTIN_newarray_double,
195                 "(I)[D",
196                 "newarray_double",
197                 NULL
198         },
199         {
200                 ICMD_CHECKCAST,
201                 BUILTIN_arraycheckcast,
202                 "([Ljava/lang/Object;[Ljava/lang/Object;)[Ljava/lang/Object;",
203                 "arraycheckcast",
204                 NULL
205         },
206         {
207                 ICMD_INSTANCEOF,
208                 BUILTIN_arrayinstanceof,
209                 "([Ljava/lang/Object;[Ljava/lang/Object;)I",
210                 "arrayinstanceof",
211                 NULL
212         },
213         {
214                 ICMD_AASTORE,
215                 BUILTIN_canstore,
216                 "([Ljava/lang/Object;Ljava/lang/Object;)I",
217                 "canstore",
218                 NULL
219         },
220
221 #if defined(USE_THREADS)
222         {
223                 ICMD_MONITORENTER,
224                 BUILTIN_monitorenter,
225                 "(Ljava/lang/Object;)V",
226                 "monitorenter",
227                 NULL
228         },
229         {
230                 ICMD_MONITOREXIT,
231                 BUILTIN_monitorexit,
232                 "(Ljava/lang/Object;)V",
233                 "monitorexit",
234                 NULL
235         },
236 #endif
237 };
238
239
240 /* automatically replaced functions *******************************************/
241
242 static builtintable_entry builtintable_automatic[] = {
243
244 #if !(SUPPORT_LONG && SUPPORT_LONG_CMP)
245         {
246                 ICMD_LCMP,
247                 BUILTIN_lcmp,
248                 "(JJ)I",
249                 "lcmp",
250                 NULL
251         },
252 #endif
253
254 #if !(SUPPORT_LONG && SUPPORT_LONG_LOGICAL)
255         {
256                 ICMD_LAND,
257                 BUILTIN_land,
258                 "(JJ)J",
259                 "land",
260                 NULL
261         },
262         {
263                 ICMD_LOR,
264                 BUILTIN_lor,
265                 "(JJ)J",
266                 "lor",
267                 NULL
268         },
269         {
270                 ICMD_LXOR,
271                 BUILTIN_lxor,
272                 "(JJ)J",
273                 "lxor",
274                 NULL
275         },
276 #endif /* !(SUPPORT_LONG && SUPPORT_LONG_LOGICAL) */
277
278 #if !(SUPPORT_LONG && SUPPORT_LONG_SHIFT)
279         {
280                 ICMD_LSHL,
281                 BUILTIN_lshl,
282                 "(JI)J",
283                 "lshl",
284                 NULL
285         },
286         {
287                 ICMD_LSHR,
288                 BUILTIN_lshr,
289                 "(JI)J",
290                 "lshr",
291                 NULL
292         },
293         {
294                 ICMD_LUSHR,
295                 BUILTIN_lushr,
296                 "(JI)J",
297                 "lushr",
298                 NULL
299         },
300 #endif /* !(SUPPORT_LONG && SUPPORT_LONG_SHIFT) */
301
302 #if !(SUPPORT_LONG && SUPPORT_LONG_ADD)
303         {
304                 ICMD_LADD,
305                 BUILTIN_ladd,
306                 "(JJ)J",
307                 "ladd",
308                 NULL
309         },
310         {
311                 ICMD_LSUB,
312                 BUILTIN_lsub,
313                 "(JJ)J",
314                 "lsub",
315                 NULL
316         },
317         {
318                 ICMD_LNEG,
319                 BUILTIN_lneg,
320                 "(J)J",
321                 "lneg",
322                 NULL
323         },
324 #endif /* !(SUPPORT_LONG && SUPPORT_LONG_ADD) */
325
326 #if !(SUPPORT_LONG && SUPPORT_LONG_MUL)
327         {
328                 ICMD_LMUL,
329                 BUILTIN_lmul,
330                 "(JJ)J",
331                 "lmul",
332                 NULL
333         },
334 #endif
335
336 #if !(SUPPORT_FLOAT && SUPPORT_I2F)
337         {
338                 ICMD_I2F,
339                 BUILTIN_i2f,
340                 "(I)F",
341                 "i2f",
342                 NULL
343         },
344 #endif
345
346 #if !(SUPPORT_DOUBLE && SUPPORT_I2D)
347         {
348                 ICMD_I2D,
349                 BUILTIN_i2d,
350                 "(I)D",
351                 "i2d",
352                 NULL
353         },
354 #endif
355
356 #if !(SUPPORT_LONG && SUPPORT_FLOAT && SUPPORT_L2F)
357         {
358                 ICMD_L2F,
359                 BUILTIN_l2f,
360                 "(J)F",
361                 "l2f",
362                 NULL
363         },
364 #endif
365
366 #if !(SUPPORT_LONG && SUPPORT_DOUBLE && SUPPORT_L2D)
367         {
368                 ICMD_L2D,
369                 BUILTIN_l2d,
370                 "(J)D",
371                 "l2d",
372                 NULL
373         },
374 #endif
375
376 #if !(SUPPORT_FLOAT && SUPPORT_F2I)
377         {
378                 ICMD_F2I,
379                 BUILTIN_f2i,
380                 "(F)I",
381                 "f2i",
382                 NULL
383         },
384 #endif
385
386 #if !(SUPPORT_FLOAT && SUPPORT_LONG && SUPPORT_F2L)
387         {
388                 ICMD_F2L,
389                 BUILTIN_f2l,
390                 "(F)J",
391                 "f2l",
392                 NULL
393         },
394 #endif
395
396 #if !(SUPPORT_DOUBLE && SUPPORT_D2I)
397         {
398                 ICMD_D2I,
399                 BUILTIN_d2i,
400                 "(D)I",
401                 "d2i",
402                 NULL
403         },
404 #endif
405
406 #if !(SUPPORT_DOUBLE && SUPPORT_LONG && SUPPORT_D2L)
407         {
408                 ICMD_D2L,
409                 BUILTIN_d2l,
410                 "(D)J",
411                 "d2l",
412                 NULL
413         },
414 #endif
415
416
417         /* float functions ********************************************************/
418
419 #if !SUPPORT_FLOAT
420         {
421                 ICMD_FADD,
422                 BUILTIN_fadd,
423                 "(FF)F",
424                 "fadd",
425                 NULL
426         },
427         {
428                 ICMD_FSUB,
429                 BUILTIN_fsub,
430                 "(FF)F",
431                 "fsub",
432                 NULL
433         },
434         {
435                 ICMD_FMUL,
436                 BUILTIN_fmul,
437                 "(FF)F",
438                 "fmul",
439                 NULL
440         },
441         {
442                 ICMD_FDIV,
443                 BUILTIN_fdiv,
444                 "(FF)F",
445                 "fdiv",
446                 NULL
447         },
448         {
449                 ICMD_FNEG,
450                 BUILTIN_fneg,
451                 "(F)F",
452                 "fneg",
453                 NULL
454         },
455         {
456                 ICMD_FCMPL,
457                 BUILTIN_fcmpl,
458                 "(FF)I",
459                 "fcmpl",
460                 NULL
461         },
462         {
463                 ICMD_FCMPG,
464                 BUILTIN_fcmpg,
465                 "(FF)I",
466                 "fcmpg",
467                 NULL
468         },
469 #endif /* !SUPPORT_FLOAT */
470
471
472         /* double functions *******************************************************/
473
474 #if !SUPPORT_DOUBLE
475         {
476                 ICMD_DADD,
477                 BUILTIN_dadd,
478                 "(DD)D",
479                 "dadd",
480                 NULL
481         },
482         {
483                 ICMD_DSUB,
484                 BUILTIN_dsub,
485                 "(DD)D",
486                 "dsub",
487                 NULL
488         },
489         {
490                 ICMD_DMUL,
491                 BUILTIN_dmul,
492                 "(DD)D",
493                 "dmul",
494                 NULL
495         },
496         {
497                 ICMD_DDIV,
498                 BUILTIN_ddiv,
499                 "(DD)D",
500                 "ddiv",
501                 NULL
502         },
503         {
504                 ICMD_DNEG,
505                 BUILTIN_dneg,
506                 "(D)D",
507                 "dneg",
508                 NULL
509         },
510         {
511                 ICMD_DCMPL,
512                 BUILTIN_dcmpl,
513                 "(DD)I",
514                 "dcmpl",
515                 NULL
516         },
517         {
518                 ICMD_DCMPG,
519                 BUILTIN_dcmpg,
520                 "(DD)I",
521                 "dcmpg",
522                 NULL
523         },
524 #endif /* !SUPPORT_DOUBLE */
525
526
527         /* float/double functions *************************************************/
528
529 #if !(SUPPORT_FLOAT && SUPPORT_DOUBLE)
530         {
531                 ICMD_F2D,
532                 BUILTIN_f2d,
533                 "(F)D",
534                 "f2d",
535                 NULL
536         },
537         {
538                 ICMD_D2F,
539                 BUILTIN_d2f,
540                 "(D)F",
541                 "d2f",
542                 NULL
543         },
544 #endif /* !(SUPPORT_FLOAT && SUPPORT_DOUBLE) */
545
546
547         /* prevent a compiler warning if everything is supported (e.g. i386) */
548
549         {
550                 255,
551                 NULL,
552                 NULL,
553                 NULL,
554                 NULL
555         },
556 };
557
558
559 /*
560  * These are local overrides for various environment variables in Emacs.
561  * Please do not remove this and leave it at the end of the file, where
562  * Emacs will automagically detect them.
563  * ---------------------------------------------------------------------
564  * Local variables:
565  * mode: c
566  * indent-tabs-mode: t
567  * c-basic-offset: 4
568  * tab-width: 4
569  * End:
570  */