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