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