* src/vm/jit/m68k/linux/md-abi.h: Prepared 8 byte stackslots.
[cacao.git] / src / vm / jit / asmpart.h
1 /* src/vm/jit/asmpart.h - prototypes for machine specfic functions
2
3    Copyright (C) 1996-2005, 2006, 2007 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    $Id: asmpart.h 8128 2007-06-21 16:29:53Z tbfg $
26
27 */
28
29
30 #ifndef _ASMPART_H
31 #define _ASMPART_H
32
33 #include "config.h"
34
35 #include <stdint.h>
36
37 #include "vm/types.h"
38
39 #if defined(ENABLE_THREADS)
40 # include "threads/critical.h"
41 #endif
42
43 #include "vm/global.h"
44 #include "vm/vm.h"
45
46 #include "vm/jit/replace.h"
47
48 #include "vmcore/linker.h"
49
50
51 /* some macros ****************************************************************/
52
53 #if defined(ENABLE_JIT)
54 # if defined(ENABLE_INTRP)
55
56 #  define ASM_GETCLASSVALUES_ATOMIC(super,sub,out) \
57     do { \
58         if (opt_intrp) \
59             intrp_asm_getclassvalues_atomic((super), (sub), (out)); \
60         else \
61             asm_getclassvalues_atomic((super), (sub), (out)); \
62     } while (0)
63
64 # else /* defined(ENABLE_INTRP) */
65
66 #  define ASM_GETCLASSVALUES_ATOMIC(super,sub,out) \
67     asm_getclassvalues_atomic((super), (sub), (out))
68
69 # endif /* defined(ENABLE_INTRP) */
70
71 #else /* defined(ENABLE_JIT) */
72
73 #  define ASM_GETCLASSVALUES_ATOMIC(super,sub,out) \
74     intrp_asm_getclassvalues_atomic((super), (sub), (out))
75
76 #endif /* defined(ENABLE_JIT) */
77
78
79 /* function prototypes ********************************************************/
80
81 /* machine dependent initialization */
82 s4   asm_md_init(void);
83
84 /* 
85    invokes the compiler for untranslated JavaVM methods.
86    Register R0 contains a pointer to the method info structure
87    (prepared by createcompilerstub).
88 */
89 void asm_call_jit_compiler(void);
90
91 #if defined(ENABLE_JIT)
92 #if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__) && !defined(__M68K__)
93 java_objectheader *asm_vm_call_method(methodinfo *m, s4 vmargscount,
94                                                                           vm_arg *vmargs);
95 s4     asm_vm_call_method_int(methodinfo *m, s4 vmargscount, vm_arg *vmargs);
96 s8     asm_vm_call_method_long(methodinfo *m, s4 vmargscount, vm_arg *vmargs);
97 float  asm_vm_call_method_float(methodinfo *m, s4 vmargscount, vm_arg *vmargs);
98 double asm_vm_call_method_double(methodinfo *m, s4 vmargscount, vm_arg *vmargs);
99
100 void   asm_vm_call_method_exception_handler(void);
101
102 void   asm_vm_call_method_end(void);
103 #else
104 java_objectheader *asm_vm_call_method(void *pv, uint64_t *array, int32_t stackargs);
105 int32_t            asm_vm_call_method_int(void *pv, uint64_t *array, int32_t stackargs);
106
107 int64_t            asm_vm_call_method_long(void *pv, uint64_t *array, int32_t stackargs);
108 float              asm_vm_call_method_float(void *pv, uint64_t *array, int32_t stackargs);
109 double             asm_vm_call_method_double(void *pv, uint64_t *array, int32_t stackargs);
110
111 void   asm_vm_call_method_exception_handler(void);
112 void   asm_vm_call_method_end(void);
113 #endif
114
115 #endif
116
117 #if defined(ENABLE_INTRP)
118 java_objectheader *intrp_asm_vm_call_method(methodinfo *m, s4 vmargscount,
119                                                                                         vm_arg *vmargs);
120
121 s4     intrp_asm_vm_call_method_int(methodinfo *m, s4 vmargscount,
122                                                                         vm_arg *vmargs);
123 s8     intrp_asm_vm_call_method_long(methodinfo *m, s4 vmargscount,
124                                                                          vm_arg *vmargs);
125 float  intrp_asm_vm_call_method_float(methodinfo *m, s4 vmargscount,
126                                                                           vm_arg *vmargs);
127 double intrp_asm_vm_call_method_double(methodinfo *m, s4 vmargscount,
128                                                                            vm_arg *vmargs);
129 #endif
130
131 /* exception handling functions */
132
133 #if defined(ENABLE_JIT)
134 void asm_handle_exception(void);
135 void asm_handle_nat_exception(void);
136 #endif
137
138 /* stub for throwing AbstractMethodError's */
139 #if defined(ENABLE_JIT)
140 void asm_abstractmethoderror(void);
141 #endif
142
143 #if defined(ENABLE_INTRP)
144 void intrp_asm_abstractmethoderror(void);
145 #endif
146
147 /* wrapper for code patching functions */
148 void asm_patcher_wrapper(void);
149
150 /* functions for on-stack replacement */
151 #if defined(ENABLE_REPLACEMENT)
152 void asm_replacement_out(void);
153 void asm_replacement_in(executionstate_t *es, replace_safestack_t *st);
154 #endif
155
156 long asm_compare_and_swap(volatile long *p, long oldval, long newval);
157 void asm_memory_barrier(void);
158
159 #if defined(ENABLE_THREADS)
160 extern critical_section_node_t asm_criticalsections;
161 #endif
162
163 #if defined(ENABLE_JIT)
164 void asm_getclassvalues_atomic(vftbl_t *super, vftbl_t *sub, castinfo *out);
165 #endif
166
167 #if defined(ENABLE_INTRP)
168 void intrp_asm_getclassvalues_atomic(vftbl_t *super, vftbl_t *sub, castinfo *out);
169 #endif
170
171 /* cache flush function */
172 void asm_cacheflush(u1 *addr, s4 nbytes);
173
174 u8 asm_get_cycle_count(void);
175
176 #endif /* _ASMPART_H */
177
178
179 /*
180  * These are local overrides for various environment variables in Emacs.
181  * Please do not remove this and leave it at the end of the file, where
182  * Emacs will automagically detect them.
183  * ---------------------------------------------------------------------
184  * Local variables:
185  * mode: c
186  * indent-tabs-mode: t
187  * c-basic-offset: 4
188  * tab-width: 4
189  * End:
190  * vim:noexpandtab:sw=4:ts=4:
191  */