Merged with tip.
[cacao.git] / src / vm / vm.h
index 8210f638a30965aab37969b1b19fd9f3a9b00eb5..a669d89dafcccdc58c75b57eace90888aff87430 100644 (file)
@@ -1,9 +1,7 @@
 /* src/vm/vm.h - basic JVM functions
 
-   Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
-   C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
-   E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
-   J. Wenninger, Institut f. Computersprachen - TU Wien
+   Copyright (C) 1996-2005, 2006, 2007, 2008
+   CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
 
    This file is part of CACAO.
 
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   Contact: cacao@cacaojvm.org
-
-   Authors: Christian Thalinger
-
-   Changes:
-
-   $Id: finalizer.c 4357 2006-01-22 23:33:38Z twisti $
-
 */
 
 
 #define _VM_H
 
 #include "config.h"
+
+#include <stdarg.h>
+#include <stdint.h>
+
 #include "vm/types.h"
 
 #include "native/jni.h"
+
 #include "vm/global.h"
 
+#include "vmcore/class.h"
+#include "vmcore/method.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /* export global variables ****************************************************/
 
+extern _Jv_JavaVM *_Jv_jvm;
 extern _Jv_JNIEnv *_Jv_env;
 
 extern bool vm_initializing;
+extern bool vm_created;
 extern bool vm_exiting;
 
+#if defined(ENABLE_INTRP)
 extern u1 *intrp_main_stack;
-
-extern void **stackbottom;
-
-extern char *mainstring;
-extern classinfo *mainclass;
-
-
-/* vm_arg **********************************************************************
-
-   Datastructure for arguments to call Java methods via vm_call_method
-   functions.
-
-*******************************************************************************/
-
-typedef struct vm_arg vm_arg;
-
-struct vm_arg {
-       u8 type;
-       u8 data;
-};
+#endif
 
 
 /* function prototypes ********************************************************/
 
 void usage(void);
 
+bool vm_createjvm(JavaVM **p_vm, void **p_env, void *vm_args);
 bool vm_create(JavaVMInitArgs *vm_args);
+void vm_run(JavaVM *vm, JavaVMInitArgs *vm_args);
 s4   vm_destroy(JavaVM *vm);
 void vm_exit(s4 status);
 void vm_shutdown(s4 status);
 
 void vm_exit_handler(void);
 
+void vm_abort(const char *text, ...);
+void vm_abort_errnum(int errnum, const char *text, ...);
+void vm_abort_errno(const char *text, ...);
+void vm_abort_disassemble(void *pc, int count, const char *text, ...);
+
 /* Java method calling functions */
-java_objectheader *vm_call_method(methodinfo *m, java_objectheader *o, ...);
-java_objectheader *vm_call_method_valist(methodinfo *m, java_objectheader *o,
+
+java_handle_t *vm_call_method(methodinfo *m, java_handle_t *o, ...);
+java_handle_t *vm_call_method_valist(methodinfo *m, java_handle_t *o,
                                                                                 va_list ap);
-java_objectheader *vm_call_method_jvalue(methodinfo *m, java_objectheader *o,
-                                                                                jvalue *args);
-java_objectheader *vm_call_method_vmarg(methodinfo *m, s4 vmargscount,
-                                                                               vm_arg *vmargs);
-
-s4 vm_call_method_int(methodinfo *m, java_objectheader *o, ...);
-s4 vm_call_method_int_valist(methodinfo *m, java_objectheader *o, va_list ap);
-s4 vm_call_method_int_jvalue(methodinfo *m, java_objectheader *o, jvalue *args);
-s4 vm_call_method_int_vmarg(methodinfo *m, s4 vmargscount, vm_arg *vmargs);
-
-s8 vm_call_method_long(methodinfo *m, java_objectheader *o, ...);
-s8 vm_call_method_long_valist(methodinfo *m, java_objectheader *o, va_list ap);
-s8 vm_call_method_long_jvalue(methodinfo *m, java_objectheader *o, jvalue *args);
-s8 vm_call_method_long_vmarg(methodinfo *m, s4 vmargscount, vm_arg *vmargs);
-
-float vm_call_method_float(methodinfo *m, java_objectheader *o, ...);
-float vm_call_method_float_valist(methodinfo *m, java_objectheader *o,
-                                                                 va_list ap);
-float vm_call_method_float_jvalue(methodinfo *m, java_objectheader *o,
-                                                                 jvalue *args);
-float vm_call_method_float_vmarg(methodinfo *m, s4 vmargscount, vm_arg *vmargs);
-
-double vm_call_method_double(methodinfo *m, java_objectheader *o, ...);
-double vm_call_method_double_valist(methodinfo *m, java_objectheader *o,
-                                                                       va_list ap);
-double vm_call_method_double_jvalue(methodinfo *m, java_objectheader *o,
-                                                                       jvalue *args);
-double vm_call_method_double_vmarg(methodinfo *m, s4 vmargscount,
-                                                                  vm_arg *vmargs);
+java_handle_t *vm_call_method_jvalue(methodinfo *m, java_handle_t *o,
+                                                                                const jvalue *args);
+
+int32_t vm_call_method_int(methodinfo *m, java_handle_t *o, ...);
+int32_t vm_call_method_int_valist(methodinfo *m, java_handle_t *o, va_list ap);
+int32_t vm_call_method_int_jvalue(methodinfo *m, java_handle_t *o, const jvalue *args);
+
+int64_t vm_call_method_long(methodinfo *m, java_handle_t *o, ...);
+int64_t vm_call_method_long_valist(methodinfo *m, java_handle_t *o, va_list ap);
+int64_t vm_call_method_long_jvalue(methodinfo *m, java_handle_t *o, const jvalue *args);
+
+float   vm_call_method_float(methodinfo *m, java_handle_t *o, ...);
+float   vm_call_method_float_valist(methodinfo *m, java_handle_t *o, va_list ap);
+float   vm_call_method_float_jvalue(methodinfo *m, java_handle_t *o, const jvalue *args);
+
+double  vm_call_method_double(methodinfo *m, java_handle_t *o, ...);
+double  vm_call_method_double_valist(methodinfo *m, java_handle_t *o, va_list ap);
+double  vm_call_method_double_jvalue(methodinfo *m, java_handle_t *o, const jvalue *args);
+
+java_handle_t *vm_call_method_objectarray(methodinfo *m, java_handle_t *o, java_handle_objectarray_t *params);
+
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* _VM_H */
 
+
 /*
  * These are local overrides for various environment variables in Emacs.
  * Please do not remove this and leave it at the end of the file, where
@@ -131,4 +120,5 @@ double vm_call_method_double_vmarg(methodinfo *m, s4 vmargscount,
  * c-basic-offset: 4
  * tab-width: 4
  * End:
+ * vim:noexpandtab:sw=4:ts=4:
  */