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