a6bd7ad34a77e1293838c2dc4e9c3f51ee531d46
[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 8295 2007-08-11 17:57:24Z michi $
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 "vmcore/linker.h"
47
48
49 /* function prototypes ********************************************************/
50
51 /* machine dependent initialization */
52 s4   asm_md_init(void);
53
54 /* 
55    invokes the compiler for untranslated JavaVM methods.
56    Register R0 contains a pointer to the method info structure
57    (prepared by createcompilerstub).
58 */
59 void asm_call_jit_compiler(void);
60
61 #if defined(ENABLE_JIT)
62 java_object_t *asm_vm_call_method(void *pv, uint64_t *array, int32_t stackargs);
63 int32_t        asm_vm_call_method_int(void *pv, uint64_t *array, int32_t stackargs);
64
65 int64_t        asm_vm_call_method_long(void *pv, uint64_t *array, int32_t stackargs);
66 float          asm_vm_call_method_float(void *pv, uint64_t *array, int32_t stackargs);
67 double         asm_vm_call_method_double(void *pv, uint64_t *array, int32_t stackargs);
68
69 void   asm_vm_call_method_exception_handler(void);
70 void   asm_vm_call_method_end(void);
71 #endif
72
73 #if defined(ENABLE_INTRP)
74 java_objectheader *intrp_asm_vm_call_method(methodinfo *m, s4 vmargscount,
75                                                                                         vm_arg *vmargs);
76
77 s4     intrp_asm_vm_call_method_int(methodinfo *m, s4 vmargscount,
78                                                                         vm_arg *vmargs);
79 s8     intrp_asm_vm_call_method_long(methodinfo *m, s4 vmargscount,
80                                                                          vm_arg *vmargs);
81 float  intrp_asm_vm_call_method_float(methodinfo *m, s4 vmargscount,
82                                                                           vm_arg *vmargs);
83 double intrp_asm_vm_call_method_double(methodinfo *m, s4 vmargscount,
84                                                                            vm_arg *vmargs);
85 #endif
86
87 /* exception handling functions */
88
89 #if defined(ENABLE_JIT)
90 void asm_handle_exception(void);
91 void asm_handle_nat_exception(void);
92 #endif
93
94 /* stub for throwing AbstractMethodError's */
95 #if defined(ENABLE_JIT)
96 void asm_abstractmethoderror(void);
97 #endif
98
99 #if defined(ENABLE_INTRP)
100 void intrp_asm_abstractmethoderror(void);
101 #endif
102
103 /* wrapper for code patching functions */
104 void asm_patcher_wrapper(void);
105
106 long asm_compare_and_swap(volatile long *p, long oldval, long newval);
107 void asm_memory_barrier(void);
108
109 /* cache flush function */
110 void asm_cacheflush(u1 *addr, s4 nbytes);
111
112 u8 asm_get_cycle_count(void);
113
114 #endif /* _ASMPART_H */
115
116
117 /*
118  * These are local overrides for various environment variables in Emacs.
119  * Please do not remove this and leave it at the end of the file, where
120  * Emacs will automagically detect them.
121  * ---------------------------------------------------------------------
122  * Local variables:
123  * mode: c
124  * indent-tabs-mode: t
125  * c-basic-offset: 4
126  * tab-width: 4
127  * End:
128  * vim:noexpandtab:sw=4:ts=4:
129  */