* Removed all Id tags.
[cacao.git] / src / vm / vm.h
1 /* src/vm/vm.h - basic JVM 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 */
26
27
28 #ifndef _VM_H
29 #define _VM_H
30
31 #include "config.h"
32
33 #include <stdarg.h>
34
35 #include "vm/types.h"
36
37 #include "native/jni.h"
38
39 #include "vm/global.h"
40
41 #include "vmcore/class.h"
42 #include "vmcore/method.h"
43
44
45 /* export global variables ****************************************************/
46
47 extern _Jv_JavaVM *_Jv_jvm;
48 extern _Jv_JNIEnv *_Jv_env;
49
50 extern bool vm_initializing;
51 extern bool vm_exiting;
52
53 extern char      *mainstring;
54 extern classinfo *mainclass;
55
56 #if defined(ENABLE_INTRP)
57 extern u1 *intrp_main_stack;
58 #endif
59
60
61 /* function prototypes ********************************************************/
62
63 void usage(void);
64 void vm_printconfig(void);
65
66 bool vm_createjvm(JavaVM **p_vm, void **p_env, void *vm_args);
67 bool vm_create(JavaVMInitArgs *vm_args);
68 void vm_run(JavaVM *vm, JavaVMInitArgs *vm_args);
69 s4   vm_destroy(JavaVM *vm);
70 void vm_exit(s4 status);
71 void vm_shutdown(s4 status);
72
73 void vm_exit_handler(void);
74
75 void vm_abort(const char *text, ...);
76
77 /* Java method calling functions */
78
79 uint64_t *vm_array_from_objectarray(methodinfo *m, java_handle_t *o,
80                                                                         java_handle_objectarray_t *params);
81
82 java_handle_t *vm_call_method(methodinfo *m, java_handle_t *o, ...);
83 java_handle_t *vm_call_method_valist(methodinfo *m, java_handle_t *o,
84                                                                                  va_list ap);
85 java_handle_t *vm_call_method_jvalue(methodinfo *m, java_handle_t *o,
86                                                                                  const jvalue *args);
87
88 java_handle_t     *vm_call_array(methodinfo *m, uint64_t *array);
89 int32_t            vm_call_int_array(methodinfo *m, uint64_t *array);
90 int64_t            vm_call_long_array(methodinfo *m, uint64_t *array);
91 float              vm_call_float_array(methodinfo *m, uint64_t *array);
92 double             vm_call_double_array(methodinfo *m, uint64_t *array);
93
94 int32_t vm_call_method_int(methodinfo *m, java_handle_t *o, ...);
95 int32_t vm_call_method_int_valist(methodinfo *m, java_handle_t *o, va_list ap);
96 int32_t vm_call_method_int_jvalue(methodinfo *m, java_handle_t *o, const jvalue *args);
97
98 int64_t vm_call_method_long(methodinfo *m, java_handle_t *o, ...);
99 int64_t vm_call_method_long_valist(methodinfo *m, java_handle_t *o, va_list ap);
100 int64_t vm_call_method_long_jvalue(methodinfo *m, java_handle_t *o, const jvalue *args);
101
102 float   vm_call_method_float(methodinfo *m, java_handle_t *o, ...);
103 float   vm_call_method_float_valist(methodinfo *m, java_handle_t *o, va_list ap);
104 float   vm_call_method_float_jvalue(methodinfo *m, java_handle_t *o, const jvalue *args);
105
106 double  vm_call_method_double(methodinfo *m, java_handle_t *o, ...);
107 double  vm_call_method_double_valist(methodinfo *m, java_handle_t *o, va_list ap);
108 double  vm_call_method_double_jvalue(methodinfo *m, java_handle_t *o, const jvalue *args);
109
110 #endif /* _VM_H */
111
112 /*
113  * These are local overrides for various environment variables in Emacs.
114  * Please do not remove this and leave it at the end of the file, where
115  * Emacs will automagically detect them.
116  * ---------------------------------------------------------------------
117  * Local variables:
118  * mode: c
119  * indent-tabs-mode: t
120  * c-basic-offset: 4
121  * tab-width: 4
122  * End:
123  */