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