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