1 /* builtin.h - prototypes of builtin functions
3 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
4 R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
5 M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
6 P. Tomsich, J. Wenninger
8 This file is part of CACAO.
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.
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.
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
25 Contact: cacao@complang.tuwien.ac.at
27 Authors: Reinhard Grafl
29 $Id: builtin.h 716 2003-12-07 21:59:12Z twisti $
38 /* define infinity for floating point numbers */
40 #define FLT_NAN 0x7fc00000
41 #define FLT_POSINF 0x7f800000
42 #define FLT_NEGINF 0xff800000
44 /* define infinity for double floating point numbers */
46 #define DBL_NAN 0x7ff8000000000000LL
47 #define DBL_POSINF 0x7ff0000000000000LL
48 #define DBL_NEGINF 0xfff0000000000000LL
51 typedef struct builtin_descriptor {
56 extern builtin_descriptor builtin_desc[];
57 extern java_objectheader* exceptionptr;
60 /* function prototypes */
62 s4 builtin_instanceof(java_objectheader *obj, classinfo *class);
63 s4 builtin_isanysubclass (classinfo *sub, classinfo *super);
64 s4 builtin_isanysubclass_vftbl (vftbl *sub, vftbl *super);
65 s4 builtin_checkcast(java_objectheader *obj, classinfo *class);
66 s4 asm_builtin_checkcast(java_objectheader *obj, classinfo *class);
68 s4 builtin_arrayinstanceof(java_objectheader *obj, vftbl *target);
70 s4 asm_builtin_arrayinstanceof(java_objectheader *obj, classinfo *class); /* XXX ? */
72 s4 builtin_checkarraycast(java_objectheader *obj, vftbl *target);
73 s4 asm_builtin_checkarraycast(java_objectheader *obj, vftbl *target);
75 java_objectheader *builtin_throw_exception(java_objectheader *exception);
76 java_objectheader *builtin_trace_exception(java_objectheader *exceptionptr,
78 int *pos, int noindent);
80 java_objectheader *builtin_new(classinfo *c);
83 java_arrayheader *builtin_newarray(s4 size, vftbl *arrayvftbl);
84 java_objectarray *builtin_anewarray(s4 size, classinfo *component);
86 void asm_builtin_newarray(s4 size, vftbl *arrayvftbl);
88 java_booleanarray *builtin_newarray_boolean(s4 size);
89 java_chararray *builtin_newarray_char(s4 size);
90 java_floatarray *builtin_newarray_float(s4 size);
91 java_doublearray *builtin_newarray_double(s4 size);
92 java_bytearray *builtin_newarray_byte(s4 size);
93 java_shortarray *builtin_newarray_short(s4 size);
94 java_intarray *builtin_newarray_int(s4 size);
95 java_longarray *builtin_newarray_long(s4 size);
96 java_arrayheader *builtin_nmultianewarray(int n,
97 vftbl *arrayvftbl, long *dims);
99 s4 builtin_canstore(java_objectarray *a, java_objectheader *o);
100 void asm_builtin_aastore(java_objectarray *a, s4 index, java_objectheader *o);
102 #ifdef TRACE_ARGS_NUM
103 #if TRACE_ARGS_NUM == 6
104 void builtin_trace_args(s8 a0, s8 a1, s8 a2, s8 a3, s8 a4, s8 a5, methodinfo *method);
106 void builtin_trace_args(s8 a0, s8 a1, s8 a2, s8 a3, s8 a4, s8 a5, s8 a6, s8 a7, methodinfo *method);
109 void builtin_displaymethodstart(methodinfo *method);
110 void builtin_displaymethodstop(methodinfo *method, s8 l, double d, float f);
111 /* void builtin_displaymethodstop(methodinfo *method); */
112 void builtin_displaymethodexception(methodinfo *method);
114 void builtin_monitorenter(java_objectheader *o);
115 void asm_builtin_monitorenter(java_objectheader *o);
116 void builtin_monitorexit(java_objectheader *o);
117 void asm_builtin_monitorexit(java_objectheader *o);
119 s4 builtin_idiv(s4 a, s4 b);
120 s4 asm_builtin_idiv(s4 a, s4 b);
121 s4 builtin_irem(s4 a, s4 b);
122 s4 asm_builtin_irem(s4 a, s4 b);
124 s8 builtin_ladd(s8 a, s8 b);
125 s8 builtin_lsub(s8 a, s8 b);
126 s8 builtin_lmul(s8 a, s8 b);
127 s8 builtin_ldiv(s8 a, s8 b);
128 s8 asm_builtin_ldiv(s8 a, s8 b);
129 s8 builtin_lrem(s8 a, s8 b);
130 s8 asm_builtin_lrem(s8 a, s8 b);
131 s8 builtin_lshl(s8 a, s4 b);
132 s8 builtin_lshr(s8 a, s4 b);
133 s8 builtin_lushr(s8 a, s4 b);
134 s8 builtin_land(s8 a, s8 b);
135 s8 builtin_lor(s8 a, s8 b);
136 s8 builtin_lxor(s8 a, s8 b);
137 s8 builtin_lneg(s8 a);
138 s4 builtin_lcmp(s8 a, s8 b);
140 float builtin_fadd(float a, float b);
141 float builtin_fsub(float a, float b);
142 float builtin_fmul(float a, float b);
143 float builtin_fdiv(float a, float b);
144 float builtin_frem(float a, float b);
145 float builtin_fneg(float a);
146 s4 builtin_fcmpl(float a, float b);
147 s4 builtin_fcmpg(float a, float b);
149 double builtin_dadd(double a, double b);
150 double builtin_dsub(double a, double b);
151 double builtin_dmul(double a, double b);
152 double builtin_ddiv(double a, double b);
153 double builtin_drem(double a, double b);
154 double builtin_dneg(double a);
155 s4 builtin_dcmpl(double a, double b);
156 s4 builtin_dcmpg(double a, double b);
158 s8 builtin_i2l(s4 i);
159 float builtin_i2f(s4 i);
160 double builtin_i2d(s4 i);
161 s4 builtin_l2i(s8 l);
162 float builtin_l2f(s8 l);
163 double builtin_l2d(s8 l);
165 s4 builtin_f2i(float a);
166 s4 asm_builtin_f2i(float a);
167 s8 builtin_f2l(float a);
168 s8 asm_builtin_f2l(float a);
170 double builtin_f2d(float a);
172 s4 builtin_d2i(double a);
173 s4 asm_builtin_d2i(double a);
174 s8 builtin_d2l(double a);
175 s8 asm_builtin_d2l(double a);
177 float builtin_d2f(double a);
180 /* conversion helper functions */
182 inline float intBitsToFloat(s4 i);
183 inline float longBitsToDouble(s8 l);
185 java_arrayheader *builtin_clone_array(void *env, java_arrayheader *o);
187 #endif /* _BUILTIN_H */
191 * These are local overrides for various environment variables in Emacs.
192 * Please do not remove this and leave it at the end of the file, where
193 * Emacs will automagically detect them.
194 * ---------------------------------------------------------------------
197 * indent-tabs-mode: t