1 /* src/vm/vm.hpp - basic JVM functions
3 Copyright (C) 1996-2005, 2006, 2007, 2008
4 CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
6 This file is part of CACAO.
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License as
10 published by the Free Software Foundation; either version 2, or (at
11 your option) any later version.
13 This program is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
34 // We need the JNI types for the VM class.
35 #include "native/jni.hpp"
40 * Represent an instance of a VM.
44 // This is _the_ VM instance.
58 // Constructor, Destructor.
63 static bool create(JavaVM** p_vm, void** p_env, void* vm_args);
64 static VM* get_current() { return _vm; }
66 // Getters for private members.
67 JavaVM* get_javavm() { return _javavm; }
68 JNIEnv* get_jnienv() { return _jnienv; }
69 bool is_initializing() { return _initializing; }
70 bool is_created() { return _created; }
71 bool is_exiting() { return _exiting; }
72 int64_t get_starttime() { return _starttime; }
74 // Instance functions.
75 void abort(const char* text, ...);
76 void abort_errnum(int errnum, const char* text, ...);
77 void abort_errno(const char* text, ...);
82 JavaVM* VM_get_javavm();
83 JNIEnv* VM_get_jnienv();
84 bool VM_is_initializing();
86 int64_t VM_get_starttime();
92 #include "vm/global.h"
93 #include "vm/method.h"
96 /* These C methods are the exported interface. ********************************/
102 bool VM_create(JavaVM** p_vm, void** p_env, void* vm_args);
109 /* export global variables ****************************************************/
111 #if defined(ENABLE_INTRP)
112 extern uint8_t* intrp_main_stack;
116 /* function prototypes ********************************************************/
124 bool vm_create(JavaVMInitArgs *vm_args);
125 void vm_run(JavaVM *vm, JavaVMInitArgs *vm_args);
126 int32_t vm_destroy(JavaVM *vm);
127 void vm_exit(int32_t status);
128 void vm_shutdown(int32_t status);
130 void vm_exit_handler(void);
132 void vm_abort_disassemble(void *pc, int count, const char *text, ...);
134 /* Java method calling functions */
136 java_handle_t *vm_call_method(methodinfo *m, java_handle_t *o, ...);
137 java_handle_t *vm_call_method_valist(methodinfo *m, java_handle_t *o,
139 java_handle_t *vm_call_method_jvalue(methodinfo *m, java_handle_t *o,
142 int32_t vm_call_method_int(methodinfo *m, java_handle_t *o, ...);
143 int32_t vm_call_method_int_valist(methodinfo *m, java_handle_t *o, va_list ap);
144 int32_t vm_call_method_int_jvalue(methodinfo *m, java_handle_t *o, const jvalue *args);
146 int64_t vm_call_method_long(methodinfo *m, java_handle_t *o, ...);
147 int64_t vm_call_method_long_valist(methodinfo *m, java_handle_t *o, va_list ap);
148 int64_t vm_call_method_long_jvalue(methodinfo *m, java_handle_t *o, const jvalue *args);
150 float vm_call_method_float(methodinfo *m, java_handle_t *o, ...);
151 float vm_call_method_float_valist(methodinfo *m, java_handle_t *o, va_list ap);
152 float vm_call_method_float_jvalue(methodinfo *m, java_handle_t *o, const jvalue *args);
154 double vm_call_method_double(methodinfo *m, java_handle_t *o, ...);
155 double vm_call_method_double_valist(methodinfo *m, java_handle_t *o, va_list ap);
156 double vm_call_method_double_jvalue(methodinfo *m, java_handle_t *o, const jvalue *args);
158 java_handle_t *vm_call_method_objectarray(methodinfo *m, java_handle_t *o, java_handle_objectarray_t *params);
161 // Legacy C interface.
162 void vm_abort(const char* text, ...);
163 void vm_abort_errnum(int errnum, const char* text, ...);
164 void vm_abort_errno(const char* text, ...);
174 * These are local overrides for various environment variables in Emacs.
175 * Please do not remove this and leave it at the end of the file, where
176 * Emacs will automagically detect them.
177 * ---------------------------------------------------------------------
180 * indent-tabs-mode: t
184 * vim:noexpandtab:sw=4:ts=4: