* don't include "md.h", not needed
[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 2772 2005-06-22 09:24:37Z 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
78 #if !SUPPORT_DIVISION
79         {
80                 ICMD_IDIV,
81                 BUILTIN_idiv,
82                 "(II)I",
83                 "idiv",
84                 NULL
85         },
86         {
87                 ICMD_IREM,
88                 BUILTIN_irem,
89                 "(II)I",
90                 "irem",
91                 NULL
92         },
93 #endif
94
95 #if !(SUPPORT_DIVISION && SUPPORT_LONG && SUPPORT_LONG_DIV)
96         {
97                 ICMD_LDIV,
98                 BUILTIN_ldiv,
99                 "(JJ)J",
100                 "ldiv",
101                 NULL
102         },
103         {
104                 ICMD_LREM,
105                 BUILTIN_lrem,
106                 "(JJ)J",
107                 "lrem",
108                 NULL
109         },
110 #endif
111
112         {
113                 ICMD_FREM,
114                 BUILTIN_frem,
115                 "(FF)F",
116                 "frem",
117                 NULL
118         },
119         {
120                 ICMD_DREM,
121                 BUILTIN_drem,
122                 "(DD)D",
123                 "drem",
124                 NULL
125         },
126
127
128         /* internal functions *****************************************************/
129
130         {
131                 ICMD_NEW,
132                 BUILTIN_new,
133                 "(Ljava/lang/Class;)Ljava/lang/Object;",
134                 "new",
135                 NULL
136         },
137         {
138                 ICMD_ANEWARRAY,
139                 BUILTIN_newarray,
140         "(ILjava/lang/Class;)[Ljava/lang/Object;",
141                 "newarray",
142                 NULL
143         },
144         {
145                 ICMD_NEWARRAY,
146                 BUILTIN_newarray_boolean,
147                 "(I)[Z",
148                 "newarray_boolean",
149                 NULL
150         },
151         {
152                 ICMD_NEWARRAY,
153                 BUILTIN_newarray_byte,
154                 "(I)[B",
155                 "newarray_byte",
156                 NULL
157         },
158         {
159                 ICMD_NEWARRAY,
160                 BUILTIN_newarray_char,
161                 "(I)[C",
162                 "newarray_char",
163                 NULL
164         },
165         {
166                 ICMD_NEWARRAY,
167                 BUILTIN_newarray_short,
168                 "(I)[S",
169                 "newarray_short",
170                 NULL
171         },
172         {
173                 ICMD_NEWARRAY,
174                 BUILTIN_newarray_int,
175                 "(I)[I",
176                 "newarray_int",
177                 NULL
178         },
179         {
180                 ICMD_NEWARRAY,
181                 BUILTIN_newarray_long,
182                 "(I)[J",
183                 "newarray_long",
184                 NULL
185         },
186         {
187                 ICMD_NEWARRAY,
188                 BUILTIN_newarray_float,
189                 "(I)[F",
190                 "newarray_float",
191                 NULL
192         },
193         {
194                 ICMD_NEWARRAY,
195                 BUILTIN_newarray_double,
196                 "(I)[D",
197                 "newarray_double",
198                 NULL
199         },
200         {
201                 ICMD_CHECKCAST,
202                 BUILTIN_arraycheckcast,
203                 "([Ljava/lang/Object;[Ljava/lang/Object;)[Ljava/lang/Object;",
204                 "arraycheckcast",
205                 NULL
206         },
207         {
208                 ICMD_INSTANCEOF,
209                 BUILTIN_arrayinstanceof,
210                 "([Ljava/lang/Object;[Ljava/lang/Object;)I",
211                 "arrayinstanceof",
212                 NULL
213         },
214         {
215                 ICMD_AASTORE,
216                 BUILTIN_aastore,
217                 "([Ljava/lang/Object;ILjava/lang/Object;)V",
218                 "aastore",
219                 NULL
220         },
221
222 #if defined(USE_THREADS)
223         {
224                 ICMD_MONITORENTER,
225                 BUILTIN_monitorenter,
226                 "(Ljava/lang/Object;)V",
227                 "monitorenter",
228                 NULL
229         },
230         {
231                 ICMD_MONITOREXIT,
232                 BUILTIN_monitorexit,
233                 "(Ljava/lang/Object;)V",
234                 "monitorexit",
235                 NULL
236         },
237 #endif
238
239
240         /* assembler code patching functions **************************************/
241
242         {
243                 ICMD_NEW,
244                 PATCHER_builtin_new,
245                 "(Ljava/lang/Class;)Ljava/lang/Object;",
246                 "new (NOT RESOLVED)",
247                 NULL
248         },
249         {
250                 ICMD_ANEWARRAY,
251                 PATCHER_builtin_newarray,
252                 "(ILjava/lang/Class;)[Ljava/lang/Object;",
253                 "newarray (NOT RESOLVED)",
254                 NULL
255         },
256         {
257                 ICMD_CHECKCAST,
258                 PATCHER_builtin_arraycheckcast,
259                 "([Ljava/lang/Class;[Ljava/lang/Class;)[Ljava/lang/Object;",
260                 "arraycheckcast (NOT RESOLVED)",
261                 NULL
262         },
263         {
264                 ICMD_INSTANCEOF,
265                 PATCHER_builtin_arrayinstanceof,
266                 "([Ljava/lang/Class;[Ljava/lang/Class;)I",
267                 "arrayinstanceof (NOT RESOLVED)",
268                 NULL
269         },
270 };
271
272
273 /* automatically replaced functions *******************************************/
274
275 static builtintable_entry builtintable_automatic[] = {
276
277 #if !(SUPPORT_LONG && SUPPORT_LONG_CMP)
278         {
279                 ICMD_LCMP,
280                 BUILTIN_lcmp,
281                 "(JJ)I",
282                 "lcmp",
283                 NULL
284         },
285 #endif
286
287 #if !(SUPPORT_LONG && SUPPORT_LONG_LOGICAL)
288         {
289                 ICMD_LAND,
290                 BUILTIN_land,
291                 "(JJ)J",
292                 "land",
293                 NULL
294         },
295         {
296                 ICMD_LOR,
297                 BUILTIN_lor,
298                 "(JJ)J",
299                 "lor",
300                 NULL
301         },
302         {
303                 ICMD_LXOR,
304                 BUILTIN_lxor,
305                 "(JJ)J",
306                 "lxor",
307                 NULL
308         },
309 #endif /* !(SUPPORT_LONG && SUPPORT_LONG_LOGICAL) */
310
311 #if !(SUPPORT_LONG && SUPPORT_LONG_SHIFT)
312         {
313                 ICMD_LSHL,
314                 BUILTIN_lshl,
315                 "(JI)J",
316                 "lshl",
317                 NULL
318         },
319         {
320                 ICMD_LSHR,
321                 BUILTIN_lshr,
322                 "(JI)J",
323                 "lshr",
324                 NULL
325         },
326         {
327                 ICMD_LUSHR,
328                 BUILTIN_lushr,
329                 "(JI)J",
330                 "lushr",
331                 NULL
332         },
333 #endif /* !(SUPPORT_LONG && SUPPORT_LONG_SHIFT) */
334
335 #if !(SUPPORT_LONG && SUPPORT_LONG_ADD)
336         {
337                 ICMD_LADD,
338                 BUILTIN_ladd,
339                 "(JJ)J",
340                 "ladd",
341                 NULL
342         },
343         {
344                 ICMD_LSUB,
345                 BUILTIN_lsub,
346                 "(JJ)J",
347                 "lsub",
348                 NULL
349         },
350         {
351                 ICMD_LNEG,
352                 BUILTIN_lneg,
353                 "(J)J",
354                 "lneg",
355                 NULL
356         },
357 #endif /* !(SUPPORT_LONG && SUPPORT_LONG_ADD) */
358
359 #if !(SUPPORT_LONG && SUPPORT_LONG_MUL)
360         {
361                 ICMD_LMUL,
362                 BUILTIN_lmul,
363                 "(JJ)J",
364                 "lmul",
365                 NULL
366         },
367 #endif
368
369 #if !(SUPPORT_FLOAT && SUPPORT_IFCVT)
370         {
371                 ICMD_I2F,
372                 BUILTIN_i2f,
373                 "(I)F",
374                 "i2f",
375                 NULL
376         },
377 #endif
378
379 #if !(SUPPORT_DOUBLE && SUPPORT_IFCVT)
380         {
381                 ICMD_I2D,
382                 BUILTIN_i2d,
383                 "(I)D",
384                 "i2d",
385                 NULL
386         },
387 #endif
388
389 #if !(SUPPORT_FLOAT && SUPPORT_FICVT)
390         {
391                 ICMD_F2I,
392                 BUILTIN_f2i,
393                 "(F)I",
394                 "f2i",
395                 NULL
396         },
397 #endif
398
399 #if !(SUPPORT_DOUBLE && SUPPORT_FICVT)
400         {
401                 ICMD_D2I,
402                 BUILTIN_d2i,
403                 "(D)I",
404                 "d2i",
405                 NULL
406         },
407 #endif
408
409 #if !(SUPPORT_LONG && SUPPORT_FLOAT && SUPPORT_LONG_FCVT)
410         {
411                 ICMD_L2F,
412                 BUILTIN_l2f,
413                 "(J)F",
414                 "l2f",
415                 NULL
416         },
417 #endif
418
419 #if !(SUPPORT_LONG && SUPPORT_DOUBLE && SUPPORT_LONG_FCVT)
420         {
421                 ICMD_L2D,
422                 BUILTIN_l2d,
423                 "(J)D",
424                 "l2d",
425                 NULL
426         },
427 #endif
428
429 #if !(SUPPORT_FLOAT && SUPPORT_LONG && SUPPORT_LONG_ICVT)
430         {
431                 ICMD_F2L,
432                 BUILTIN_f2l,
433                 "(F)J",
434                 "f2l",
435                 NULL
436         },
437 #endif
438
439 #if !(SUPPORT_DOUBLE && SUPPORT_LONG && SUPPORT_LONG_ICVT)
440         {
441                 ICMD_D2L,
442                 BUILTIN_d2l,
443                 "(D)J",
444                 "d2l",
445                 NULL
446         },
447 #endif
448
449
450         /* float functions ********************************************************/
451
452 #if !SUPPORT_FLOAT
453         {
454                 ICMD_FADD,
455                 BUILTIN_fadd,
456                 "(FF)F",
457                 "fadd",
458                 NULL
459         },
460         {
461                 ICMD_FSUB,
462                 BUILTIN_fsub,
463                 "(FF)F",
464                 "fsub",
465                 NULL
466         },
467         {
468                 ICMD_FMUL,
469                 BUILTIN_fmul,
470                 "(FF)F",
471                 "fmul",
472                 NULL
473         },
474         {
475                 ICMD_FDIV,
476                 BUILTIN_fdiv,
477                 "(FF)F",
478                 "fdiv",
479                 NULL
480         },
481         {
482                 ICMD_FNEG,
483                 BUILTIN_fneg,
484                 "(F)F",
485                 "fneg",
486                 NULL
487         },
488         {
489                 ICMD_FCMPL,
490                 BUILTIN_fcmpl,
491                 "(FF)I",
492                 "fcmpl",
493                 NULL
494         },
495         {
496                 ICMD_FCMPG,
497                 BUILTIN_fcmpg,
498                 "(FF)I",
499                 "fcmpg",
500                 NULL
501         },
502 #endif /* !SUPPORT_FLOAT */
503
504
505         /* double functions *******************************************************/
506
507 #if !SUPPORT_DOUBLE
508         {
509                 ICMD_DADD,
510                 BUILTIN_dadd,
511                 "(DD)D",
512                 "dadd",
513                 NULL
514         },
515         {
516                 ICMD_DSUB,
517                 BUILTIN_dsub,
518                 "(DD)D",
519                 "dsub",
520                 NULL
521         },
522         {
523                 ICMD_DMUL,
524                 BUILTIN_dmul,
525                 "(DD)D",
526                 "dmul",
527                 NULL
528         },
529         {
530                 ICMD_DDIV,
531                 BUILTIN_ddiv,
532                 "(DD)D",
533                 "ddiv",
534                 NULL
535         },
536         {
537                 ICMD_DNEG,
538                 BUILTIN_dneg,
539                 "(D)D",
540                 "dneg",
541                 NULL
542         },
543         {
544                 ICMD_DCMPL,
545                 BUILTIN_dcmpl,
546                 "(DD)I",
547                 "dcmpl",
548                 NULL
549         },
550         {
551                 ICMD_DCMPG,
552                 BUILTIN_dcmpg,
553                 "(DD)I",
554                 "dcmpg",
555                 NULL
556         },
557 #endif /* !SUPPORT_DOUBLE */
558
559
560         /* float/double functions *************************************************/
561
562 #if !(SUPPORT_FLOAT && SUPPORT_DOUBLE)
563         {
564                 ICMD_F2D,
565                 BUILTIN_f2d,
566                 "(F)D",
567                 "f2d",
568                 NULL
569         },
570         {
571                 ICMD_D2F,
572                 BUILTIN_d2f,
573                 "(D)F",
574                 "d2f",
575                 NULL
576         },
577 #endif /* !(SUPPORT_FLOAT && SUPPORT_DOUBLE) */
578
579
580         /* prevent a compiler warning if everything is supported (e.g. i386) */
581
582         {
583                 255,
584                 NULL,
585                 NULL,
586                 NULL,
587                 NULL
588         },
589 };
590
591
592 /*
593  * These are local overrides for various environment variables in Emacs.
594  * Please do not remove this and leave it at the end of the file, where
595  * Emacs will automagically detect them.
596  * ---------------------------------------------------------------------
597  * Local variables:
598  * mode: c
599  * indent-tabs-mode: t
600  * c-basic-offset: 4
601  * tab-width: 4
602  * End:
603  */