Merged r5573, r5574, r5577, r5578, and r5579 from trunk.
[cacao.git] / src / vm / vm.h
1 /* src/vm/vm.h - basic JVM 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: Christian Thalinger
28
29    Changes:
30
31    $Id: finalizer.c 4357 2006-01-22 23:33:38Z twisti $
32
33 */
34
35
36 #ifndef _VM_H
37 #define _VM_H
38
39 #include "config.h"
40 #include "vm/types.h"
41
42 #include "native/jni.h"
43 #include "vm/global.h"
44
45
46 /* export global variables ****************************************************/
47
48 extern _Jv_JavaVM *_Jv_jvm;
49 extern _Jv_JNIEnv *_Jv_env;
50
51 extern bool vm_initializing;
52 extern bool vm_exiting;
53
54 extern u1 *intrp_main_stack;
55
56 extern void **stackbottom;
57
58 extern char *mainstring;
59 extern classinfo *mainclass;
60
61
62 /* vm_arg **********************************************************************
63
64    Datastructure for arguments to call Java methods via vm_call_method
65    functions.
66
67 *******************************************************************************/
68
69 typedef struct vm_arg vm_arg;
70
71 struct vm_arg {
72         u8 type;
73
74         union {
75                 u8     l;
76                 float  f;
77                 double d;
78         } data;
79 };
80
81
82 /* function prototypes ********************************************************/
83
84 void usage(void);
85
86 bool vm_create(JavaVMInitArgs *vm_args);
87 void vm_run(JavaVM *vm, JavaVMInitArgs *vm_args);
88 s4   vm_destroy(JavaVM *vm);
89 void vm_exit(s4 status);
90 void vm_shutdown(s4 status);
91
92 void vm_exit_handler(void);
93
94 void vm_abort(const char *text, ...);
95
96 /* Java method calling functions */
97 java_objectheader *vm_call_method(methodinfo *m, java_objectheader *o, ...);
98 java_objectheader *vm_call_method_valist(methodinfo *m, java_objectheader *o,
99                                                                                  va_list ap);
100 java_objectheader *vm_call_method_jvalue(methodinfo *m, java_objectheader *o,
101                                                                                  jvalue *args);
102 java_objectheader *vm_call_method_vmarg(methodinfo *m, s4 vmargscount,
103                                                                                 vm_arg *vmargs);
104
105 s4 vm_call_method_int(methodinfo *m, java_objectheader *o, ...);
106 s4 vm_call_method_int_valist(methodinfo *m, java_objectheader *o, va_list ap);
107 s4 vm_call_method_int_jvalue(methodinfo *m, java_objectheader *o, jvalue *args);
108 s4 vm_call_method_int_vmarg(methodinfo *m, s4 vmargscount, vm_arg *vmargs);
109
110 s8 vm_call_method_long(methodinfo *m, java_objectheader *o, ...);
111 s8 vm_call_method_long_valist(methodinfo *m, java_objectheader *o, va_list ap);
112 s8 vm_call_method_long_jvalue(methodinfo *m, java_objectheader *o, jvalue *args);
113 s8 vm_call_method_long_vmarg(methodinfo *m, s4 vmargscount, vm_arg *vmargs);
114
115 float vm_call_method_float(methodinfo *m, java_objectheader *o, ...);
116 float vm_call_method_float_valist(methodinfo *m, java_objectheader *o,
117                                                                   va_list ap);
118 float vm_call_method_float_jvalue(methodinfo *m, java_objectheader *o,
119                                                                   jvalue *args);
120 float vm_call_method_float_vmarg(methodinfo *m, s4 vmargscount, vm_arg *vmargs);
121
122 double vm_call_method_double(methodinfo *m, java_objectheader *o, ...);
123 double vm_call_method_double_valist(methodinfo *m, java_objectheader *o,
124                                                                         va_list ap);
125 double vm_call_method_double_jvalue(methodinfo *m, java_objectheader *o,
126                                                                         jvalue *args);
127 double vm_call_method_double_vmarg(methodinfo *m, s4 vmargscount,
128                                                                    vm_arg *vmargs);
129
130 #endif /* _VM_H */
131
132 /*
133  * These are local overrides for various environment variables in Emacs.
134  * Please do not remove this and leave it at the end of the file, where
135  * Emacs will automagically detect them.
136  * ---------------------------------------------------------------------
137  * Local variables:
138  * mode: c
139  * indent-tabs-mode: t
140  * c-basic-offset: 4
141  * tab-width: 4
142  * End:
143  */