e5a1e57a7732ec55999a3cace835fe45844aa8ea
[cacao.git] / src / vm / jit / asmpart.h
1 /* vm/jit/asmpart.h - prototypes for machine specfic functions
2
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
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., 59 Temple Place - Suite 330, Boston, MA
23    02111-1307, USA.
24
25    Contact: cacao@complang.tuwien.ac.at
26
27    Authors: Reinhard Grafl
28             Andreas Krall
29
30    Changes: Christian Thalinger
31
32    $Id: asmpart.h 1683 2004-12-05 21:33:36Z jowenn $
33
34 */
35
36
37 #ifndef _ASMPART_H
38 #define _ASMPART_H
39
40 #include "native/jni.h"
41 #include "vm/global.h"
42
43 #if defined(USE_THREADS)
44 # if defined(NATIVE_THREADS)
45 #  include "threads/native/threads.h"
46 # else
47 #  include "threads/green/threads.h"
48 # endif
49 #endif
50
51
52 typedef struct castinfo castinfo;
53
54 struct castinfo {
55         s4 super_baseval;
56         s4 super_diffval;
57         s4 sub_baseval;
58 };
59
60
61 #if defined(__ALPHA__)
62 /* 
63    determines if the byte support instruction set (21164a and higher)
64    is available.
65 */
66 int has_no_x_instr_set();
67
68 void synchronize_caches();
69 #endif
70
71
72 /* 
73    invokes the compiler for untranslated JavaVM methods.
74    Register R0 contains a pointer to the method info structure
75    (prepared by createcompilerstub).
76 */
77 void asm_call_jit_compiler();
78
79
80 /* 
81    This function calls a Java-method (which possibly needs compilation)
82    with up to 4 parameters. This function calls a Java-method (which
83    possibly needs compilation) with up to 4 parameters.
84 */
85
86 /* 
87    This function calls a Java-method (which possibly needs compilation)
88    with up to 4 parameters. This function calls a Java-method (which
89    possibly needs compilation) with up to 4 parameters. 
90    also supports a return value
91 */
92 java_objectheader *asm_calljavafunction(methodinfo *m, void *arg1, void *arg2,
93                                         void *arg3, void *arg4);
94 java_objectheader *asm_calljavafunction2(methodinfo *m, u4 count, u4 size, void *callblock);
95 jdouble asm_calljavafunction2double(methodinfo *m, u4 count, u4 size, void *callblock);
96 jlong asm_calljavafunction2long(methodinfo *m, u4 count, u4 size, void *callblock);
97
98 /* We need these two labels in codegen.inc to add the asm_calljavafunction*'s
99    into the methodtable */
100 #if defined(__I386__) || defined(__X86_64__)
101 void calljava_xhandler();
102 void calljava_xhandler2();
103 #endif
104
105
106 void asm_handle_exception();
107 void asm_handle_nat_exception();
108
109 void asm_check_clinit();
110
111 void asm_handle_builtin_exception(classinfo *);
112 void asm_throw_and_handle_exception();
113 #ifdef __ALPHA__
114 void asm_throw_and_handle_nat_exception();
115 void asm_refillin_and_handle_exception();
116 void asm_throw_and_handle_arrayindexoutofbounds_exception();
117 #endif
118 void asm_throw_and_handle_hardware_arithmetic_exception();
119
120 java_objectarray* Java_java_lang_VMSecurityManager_getClassContext(JNIEnv *env, jclass clazz);
121 stacktraceelement *asm_get_stackTrace();
122
123 /*java_lang_ClassLoader* Java_java_lang_VMSecurityManager_currentClassLoader(JNIEnv *env, jclass clazz);*/
124
125 void *asm_switchstackandcall(void *stack, void *func, void **stacktopsave, void * p);
126
127 void asm_builtin_trace();
128 void asm_builtin_exittrace();
129
130 #if defined(USE_THREADS) && defined(NATIVE_THREADS)
131 extern threadcritnode asm_criticalsections;
132 #endif
133
134 void asm_getclassvalues_atomic(vftbl_t *super, vftbl_t *sub, castinfo *out);
135
136 void asm_prepare_native_stackinfo(void*ret,void*stackbegin);
137 void asm_remove_native_stackinfo();
138
139 #if defined(USE_THREADS) && !defined(NATIVE_THREADS)
140 void asm_perform_threadswitch(u1 **from, u1 **to, u1 **stackTop);
141 u1*  asm_initialize_thread_stack(void *func, u1 *stack);
142 #endif
143
144 #endif /* _ASMPART_H */
145
146
147 /*
148  * These are local overrides for various environment variables in Emacs.
149  * Please do not remove this and leave it at the end of the file, where
150  * Emacs will automagically detect them.
151  * ---------------------------------------------------------------------
152  * Local variables:
153  * mode: c
154  * indent-tabs-mode: t
155  * c-basic-offset: 4
156  * tab-width: 4
157  * End:
158  */