* Added x86_64 defines
[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 2949 2005-07-09 12:20:02Z 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__)
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
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)
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 #if !defined(__POWERPC__) && !defined(__X86_64__)
214         {
215                 ICMD_AASTORE,
216                 BUILTIN_aastore,
217                 "([Ljava/lang/Object;ILjava/lang/Object;)V",
218                 "aastore",
219                 NULL
220         },
221 #endif
222         {
223                 ICMD_AASTORE,
224                 BUILTIN_canstore,
225                 "([Ljava/lang/Object;Ljava/lang/Object;)I",
226                 "canstore",
227                 NULL
228         },
229
230 #if defined(USE_THREADS)
231         {
232                 ICMD_MONITORENTER,
233                 BUILTIN_monitorenter,
234                 "(Ljava/lang/Object;)V",
235                 "monitorenter",
236                 NULL
237         },
238         {
239                 ICMD_MONITOREXIT,
240                 BUILTIN_monitorexit,
241                 "(Ljava/lang/Object;)V",
242                 "monitorexit",
243                 NULL
244         },
245 #endif
246
247
248         /* assembler code patching functions **************************************/
249
250         {
251                 ICMD_NEW,
252                 PATCHER_builtin_new,
253                 "(Ljava/lang/Class;)Ljava/lang/Object;",
254                 "new (NOT RESOLVED)",
255                 NULL
256         },
257         {
258                 ICMD_ANEWARRAY,
259                 PATCHER_builtin_newarray,
260                 "(ILjava/lang/Class;)[Ljava/lang/Object;",
261                 "newarray (NOT RESOLVED)",
262                 NULL
263         },
264         {
265                 ICMD_CHECKCAST,
266                 PATCHER_builtin_arraycheckcast,
267                 "([Ljava/lang/Class;[Ljava/lang/Class;)[Ljava/lang/Object;",
268                 "arraycheckcast (NOT RESOLVED)",
269                 NULL
270         },
271         {
272                 ICMD_INSTANCEOF,
273                 PATCHER_builtin_arrayinstanceof,
274                 "([Ljava/lang/Class;[Ljava/lang/Class;)I",
275                 "arrayinstanceof (NOT RESOLVED)",
276                 NULL
277         },
278 };
279
280
281 /* automatically replaced functions *******************************************/
282
283 static builtintable_entry builtintable_automatic[] = {
284
285 #if !(SUPPORT_LONG && SUPPORT_LONG_CMP)
286         {
287                 ICMD_LCMP,
288                 BUILTIN_lcmp,
289                 "(JJ)I",
290                 "lcmp",
291                 NULL
292         },
293 #endif
294
295 #if !(SUPPORT_LONG && SUPPORT_LONG_LOGICAL)
296         {
297                 ICMD_LAND,
298                 BUILTIN_land,
299                 "(JJ)J",
300                 "land",
301                 NULL
302         },
303         {
304                 ICMD_LOR,
305                 BUILTIN_lor,
306                 "(JJ)J",
307                 "lor",
308                 NULL
309         },
310         {
311                 ICMD_LXOR,
312                 BUILTIN_lxor,
313                 "(JJ)J",
314                 "lxor",
315                 NULL
316         },
317 #endif /* !(SUPPORT_LONG && SUPPORT_LONG_LOGICAL) */
318
319 #if !(SUPPORT_LONG && SUPPORT_LONG_SHIFT)
320         {
321                 ICMD_LSHL,
322                 BUILTIN_lshl,
323                 "(JI)J",
324                 "lshl",
325                 NULL
326         },
327         {
328                 ICMD_LSHR,
329                 BUILTIN_lshr,
330                 "(JI)J",
331                 "lshr",
332                 NULL
333         },
334         {
335                 ICMD_LUSHR,
336                 BUILTIN_lushr,
337                 "(JI)J",
338                 "lushr",
339                 NULL
340         },
341 #endif /* !(SUPPORT_LONG && SUPPORT_LONG_SHIFT) */
342
343 #if !(SUPPORT_LONG && SUPPORT_LONG_ADD)
344         {
345                 ICMD_LADD,
346                 BUILTIN_ladd,
347                 "(JJ)J",
348                 "ladd",
349                 NULL
350         },
351         {
352                 ICMD_LSUB,
353                 BUILTIN_lsub,
354                 "(JJ)J",
355                 "lsub",
356                 NULL
357         },
358         {
359                 ICMD_LNEG,
360                 BUILTIN_lneg,
361                 "(J)J",
362                 "lneg",
363                 NULL
364         },
365 #endif /* !(SUPPORT_LONG && SUPPORT_LONG_ADD) */
366
367 #if !(SUPPORT_LONG && SUPPORT_LONG_MUL)
368         {
369                 ICMD_LMUL,
370                 BUILTIN_lmul,
371                 "(JJ)J",
372                 "lmul",
373                 NULL
374         },
375 #endif
376
377 #if !(SUPPORT_FLOAT && SUPPORT_IFCVT)
378         {
379                 ICMD_I2F,
380                 BUILTIN_i2f,
381                 "(I)F",
382                 "i2f",
383                 NULL
384         },
385 #endif
386
387 #if !(SUPPORT_DOUBLE && SUPPORT_IFCVT)
388         {
389                 ICMD_I2D,
390                 BUILTIN_i2d,
391                 "(I)D",
392                 "i2d",
393                 NULL
394         },
395 #endif
396
397 #if !(SUPPORT_FLOAT && SUPPORT_FICVT)
398         {
399                 ICMD_F2I,
400                 BUILTIN_f2i,
401                 "(F)I",
402                 "f2i",
403                 NULL
404         },
405 #endif
406
407 #if !(SUPPORT_DOUBLE && SUPPORT_FICVT)
408         {
409                 ICMD_D2I,
410                 BUILTIN_d2i,
411                 "(D)I",
412                 "d2i",
413                 NULL
414         },
415 #endif
416
417 #if !(SUPPORT_LONG && SUPPORT_FLOAT && SUPPORT_LONG_FCVT)
418         {
419                 ICMD_L2F,
420                 BUILTIN_l2f,
421                 "(J)F",
422                 "l2f",
423                 NULL
424         },
425 #endif
426
427 #if !(SUPPORT_LONG && SUPPORT_DOUBLE && SUPPORT_LONG_FCVT)
428         {
429                 ICMD_L2D,
430                 BUILTIN_l2d,
431                 "(J)D",
432                 "l2d",
433                 NULL
434         },
435 #endif
436
437 #if !(SUPPORT_FLOAT && SUPPORT_LONG && SUPPORT_LONG_ICVT)
438         {
439                 ICMD_F2L,
440                 BUILTIN_f2l,
441                 "(F)J",
442                 "f2l",
443                 NULL
444         },
445 #endif
446
447 #if !(SUPPORT_DOUBLE && SUPPORT_LONG && SUPPORT_LONG_ICVT)
448         {
449                 ICMD_D2L,
450                 BUILTIN_d2l,
451                 "(D)J",
452                 "d2l",
453                 NULL
454         },
455 #endif
456
457
458         /* float functions ********************************************************/
459
460 #if !SUPPORT_FLOAT
461         {
462                 ICMD_FADD,
463                 BUILTIN_fadd,
464                 "(FF)F",
465                 "fadd",
466                 NULL
467         },
468         {
469                 ICMD_FSUB,
470                 BUILTIN_fsub,
471                 "(FF)F",
472                 "fsub",
473                 NULL
474         },
475         {
476                 ICMD_FMUL,
477                 BUILTIN_fmul,
478                 "(FF)F",
479                 "fmul",
480                 NULL
481         },
482         {
483                 ICMD_FDIV,
484                 BUILTIN_fdiv,
485                 "(FF)F",
486                 "fdiv",
487                 NULL
488         },
489         {
490                 ICMD_FNEG,
491                 BUILTIN_fneg,
492                 "(F)F",
493                 "fneg",
494                 NULL
495         },
496         {
497                 ICMD_FCMPL,
498                 BUILTIN_fcmpl,
499                 "(FF)I",
500                 "fcmpl",
501                 NULL
502         },
503         {
504                 ICMD_FCMPG,
505                 BUILTIN_fcmpg,
506                 "(FF)I",
507                 "fcmpg",
508                 NULL
509         },
510 #endif /* !SUPPORT_FLOAT */
511
512
513         /* double functions *******************************************************/
514
515 #if !SUPPORT_DOUBLE
516         {
517                 ICMD_DADD,
518                 BUILTIN_dadd,
519                 "(DD)D",
520                 "dadd",
521                 NULL
522         },
523         {
524                 ICMD_DSUB,
525                 BUILTIN_dsub,
526                 "(DD)D",
527                 "dsub",
528                 NULL
529         },
530         {
531                 ICMD_DMUL,
532                 BUILTIN_dmul,
533                 "(DD)D",
534                 "dmul",
535                 NULL
536         },
537         {
538                 ICMD_DDIV,
539                 BUILTIN_ddiv,
540                 "(DD)D",
541                 "ddiv",
542                 NULL
543         },
544         {
545                 ICMD_DNEG,
546                 BUILTIN_dneg,
547                 "(D)D",
548                 "dneg",
549                 NULL
550         },
551         {
552                 ICMD_DCMPL,
553                 BUILTIN_dcmpl,
554                 "(DD)I",
555                 "dcmpl",
556                 NULL
557         },
558         {
559                 ICMD_DCMPG,
560                 BUILTIN_dcmpg,
561                 "(DD)I",
562                 "dcmpg",
563                 NULL
564         },
565 #endif /* !SUPPORT_DOUBLE */
566
567
568         /* float/double functions *************************************************/
569
570 #if !(SUPPORT_FLOAT && SUPPORT_DOUBLE)
571         {
572                 ICMD_F2D,
573                 BUILTIN_f2d,
574                 "(F)D",
575                 "f2d",
576                 NULL
577         },
578         {
579                 ICMD_D2F,
580                 BUILTIN_d2f,
581                 "(D)F",
582                 "d2f",
583                 NULL
584         },
585 #endif /* !(SUPPORT_FLOAT && SUPPORT_DOUBLE) */
586
587
588         /* prevent a compiler warning if everything is supported (e.g. i386) */
589
590         {
591                 255,
592                 NULL,
593                 NULL,
594                 NULL,
595                 NULL
596         },
597 };
598
599
600 /*
601  * These are local overrides for various environment variables in Emacs.
602  * Please do not remove this and leave it at the end of the file, where
603  * Emacs will automagically detect them.
604  * ---------------------------------------------------------------------
605  * Local variables:
606  * mode: c
607  * indent-tabs-mode: t
608  * c-basic-offset: 4
609  * tab-width: 4
610  * End:
611  */