* src/vm/global.h (jni_callblock): Removed.
authortwisti <none@none>
Sat, 4 Mar 2006 17:15:44 +0000 (17:15 +0000)
committertwisti <none@none>
Sat, 4 Mar 2006 17:15:44 +0000 (17:15 +0000)
* src/vm/vm.c (vm/vm.h): Added.
(vm_call_method_intern): New function.
(vm_call_method_intern_int): Likewise.
(vm_call_method): Likewise.
(vm_call_method_int): Likewise.
(vm_call_method_long): Likewise.
(vm_call_method_float): Likewise.
(vm_call_method_double): Likewise.
* src/vm/vm.h (vm_arg): Structure added.
(vm_call_method_intern): New function.
(vm_call_method_intern_int): Likewise.
(vm_call_method): Likewise.
(vm_call_method_int): Likewise.
(vm_call_method_long): Likewise.
(vm_call_method_float): Likewise.
(vm_call_method_double): Likewise.

* src/vm/jit/tools/genoffsets.c (vm/vm.h): Added.
(sizejniblock): Renamed to sizevmarg.
(offjniitemtype): Renamed to offvmargtype.
(offjniitem): Renamed to offvmargdata.
* src/vm/jit/x86_64/asmpart.S (asm_calljavafunction2): Pointer to
vm_arg block is now in a2. Use new defines.

* src/vm/jit/stacktrace.c (vm/vm.h): Added.
(ASM_CALLJAVAFUNCTION): Replaced with vm_call_method_intern.
* src/vm/exceptions.c: Likewise.
* src/vm/properties.c: Likewise.
* src/vm/loader.c: Likewise.
* src/vm/finalizer.c: Likewise.
* src/vm/initialize.c: Likewise.
* src/cacao/cacao.c: Likewise.
* src/native/vm/VMClassLoader.c: Likewise.
* src/threads/native/threads.c: Likewise.

* src/cacaoh/headers.c (asm_calljavafunction): Removed.
(intrp_asm_calljavafunction): Likewise.
(vm_call_method_intern): New function.

* src/native/jni.c (fill_callblock_from_vargs): Renamed to
_Jv_jni_vmargs_from_vargs.
(fill_callblock_from_objectarray): Renamed to
_Jv_jni_vmargs_from_objectarray.
(_Jv_jni_vmargs_from_objectarray): New function.
(_Jv_jni_CallVoidMethodA): Likewise.
(ASM_CALLJAVAFUNCTION2): Replaced with appropriate vm_call_method
function.
(NewObjectA): Implemented.
(CallVoidMethodA): Likewise.
(CallNonvirtualVoidMethodA): Likewise.
(CallStaticVoidMethodA): Likewise.

17 files changed:
src/cacao/cacao.c
src/cacaoh/headers.c
src/native/jni.c
src/native/native.c
src/native/vm/VMClassLoader.c
src/threads/native/threads.c
src/vm/exceptions.c
src/vm/finalizer.c
src/vm/global.h
src/vm/initialize.c
src/vm/jit/stacktrace.c
src/vm/jit/tools/genoffsets.c
src/vm/jit/x86_64/asmpart.S
src/vm/loader.c
src/vm/properties.c
src/vm/vm.c
src/vm/vm.h

index 01a3c40f5da90d8dc2ba2ee5b2bcca22ea165719..58b4a9c9130f9d279dff83110c8f2faa29fcd185 100644 (file)
@@ -31,7 +31,7 @@
             Philipp Tomsich
             Christian Thalinger
 
-   $Id: cacao.c 4542 2006-02-21 13:39:51Z twisti $
+   $Id: cacao.c 4552 2006-03-04 17:15:44Z twisti $
 
 */
 
@@ -110,7 +110,7 @@ static void setup_debugger_process(char* transport) {
        if (!m)
                throw_main_exception_exit();
 
-       ASM_CALLJAVAFUNCTION(m, o, NULL, NULL, NULL);
+       (void) vm_call_method_intern(m, o, NULL, NULL, NULL);
 
        /* configure(transport,NULL) */
        m = class_resolveclassmethod(
@@ -122,7 +122,7 @@ static void setup_debugger_process(char* transport) {
 
        s = javastring_new_char(transport);
 
-       ASM_CALLJAVAFUNCTION(m, o, s, NULL, NULL);
+       (void) vm_call_method_intern(m, o, s, NULL, NULL);
 
        if (!m)
                throw_main_exception_exit();
@@ -137,7 +137,7 @@ static void setup_debugger_process(char* transport) {
        if (!m)
                throw_main_exception_exit();
 
-       ASM_CALLJAVAFUNCTION(m, o, NULL, NULL, NULL);
+       (void) vm_call_method_intern(m, o, NULL, NULL, NULL);
 }
 #endif
 
@@ -179,7 +179,7 @@ static char *getmainclassnamefromjar(char *mainstring)
 
        s = javastring_new_char(mainstring);
 
-       ASM_CALLJAVAFUNCTION(m, o, s, NULL, NULL);
+       (void) vm_call_method_intern(m, o, s, NULL, NULL);
 
        if (*exceptionptr)
                throw_main_exception_exit();
@@ -195,7 +195,7 @@ static char *getmainclassnamefromjar(char *mainstring)
        if (!m)
                throw_main_exception_exit();
 
-       ASM_CALLJAVAFUNCTION_ADR(o, m, o, NULL, NULL, NULL);
+       o = vm_call_method_intern(m, o, NULL, NULL, NULL);
 
        if (o == NULL) {
                fprintf(stderr, "Could not get manifest from %s (invalid or corrupt jarfile?)\n", mainstring);
@@ -214,7 +214,7 @@ static char *getmainclassnamefromjar(char *mainstring)
        if (!m)
                throw_main_exception_exit();
 
-       ASM_CALLJAVAFUNCTION_ADR(o, m, o, NULL, NULL, NULL);
+       o = vm_call_method_intern(m, o, NULL, NULL, NULL);
 
        if (o == NULL) {
                fprintf(stderr, "Could not get main attributes from %s (invalid or corrupt jarfile?)\n", mainstring);
@@ -235,7 +235,7 @@ static char *getmainclassnamefromjar(char *mainstring)
 
        s = javastring_new_char("Main-Class");
 
-       ASM_CALLJAVAFUNCTION_ADR(o, m, o, s, NULL, NULL);
+       o = vm_call_method_intern(m, o, s, NULL, NULL);
 
        if (!o)
                throw_main_exception_exit();
@@ -411,7 +411,7 @@ int main(int argc, char **argv)
                                                                                  &jvmti_jdwp_EventCallbacks,
                                                                                  sizeof(jvmti_jdwp_EventCallbacks))){
                                                log_text("unable to setup event callbacks");
-                                               cacao_exit(1);                                          
+                                               vm_exit(1);
                                        }
 
                                        /* setup listening process (JDWP) */
@@ -432,7 +432,7 @@ int main(int argc, char **argv)
 #endif
                /* here we go... */
 
-               ASM_CALLJAVAFUNCTION(m, oa, NULL, NULL, NULL);
+               (void) vm_call_method_intern(m, oa, NULL, NULL, NULL);
 
                /* exception occurred? */
 
index 0805b2dd413f495a9f30a1af2c9a679b2946cc2a..3f8b9c8e30980499b7ec60570b6a110c6fd22c75 100644 (file)
@@ -30,7 +30,7 @@
             Philipp Tomsich
             Christian Thalinger
 
-   $Id: headers.c 4433 2006-02-04 20:15:23Z twisti $
+   $Id: headers.c 4552 2006-03-04 17:15:44Z twisti $
 
 */
 
@@ -97,19 +97,9 @@ java_objectheader *native_new_and_init_int(classinfo *c, s4 i) { return NULL; }
 java_objectheader *native_new_and_init_throwable(classinfo *c, java_lang_Throwable *t) { return NULL; }
 
 
-#if defined(ENABLE_JIT)
-java_objectheader *asm_calljavafunction(methodinfo *m,
-                                                                               void *arg1, void *arg2,
-                                                                               void *arg3, void *arg4)
-{ return NULL; }
-#endif
-
-#if defined(ENABLE_INTRP)
-java_objectheader *intrp_asm_calljavafunction(methodinfo *m,
-                                                                                         void *arg1, void *arg2,
-                                                                                         void *arg3, void *arg4)
+java_objectheader *vm_call_method_intern(methodinfo *m, void *a0, void *a1,
+                                                                                void *a2, void *a3)
 { return NULL; }
-#endif
 
 
 /* code patching functions */
index 100565efbe0f0eab526003ba7e832befb0ebe03b..d43b716e9044556b51b99278cf69fe25f2865942 100644 (file)
@@ -32,7 +32,7 @@
             Christian Thalinger
                        Edwin Steiner
 
-   $Id: jni.c 4530 2006-02-21 09:11:53Z twisti $
+   $Id: jni.c 4552 2006-03-04 17:15:44Z twisti $
 
 */
 
@@ -111,8 +111,6 @@ static JavaVM ptr_jvm = (JavaVM) &JNI_JavaVMTable;
 void *ptr_env = (void*) &JNI_JNIEnvTable;
 
 
-#define PTR_TO_ITEM(ptr)   ((u8)(size_t)(ptr))
-
 /* global variables ***********************************************************/
 
 /* global reference table *****************************************************/
@@ -233,9 +231,14 @@ bool jni_init(void)
 }
 
 
-static void fill_callblock_from_vargs(void *obj, methoddesc *descr,
-                                                                         jni_callblock blk[], va_list data,
-                                                                         s4 rettype)
+/* _Jv_jni_fill_vmargs_from_vargs **********************************************
+
+   XXX
+
+*******************************************************************************/
+
+static void _Jv_jni_vmargs_from_vargs(java_objectheader *o, methoddesc *descr,
+                                                                         vm_arg *vmargs, va_list ap)
 {
        typedesc *paramtypes;
        s4        i;
@@ -246,10 +249,10 @@ static void fill_callblock_from_vargs(void *obj, methoddesc *descr,
 
        i = 0;
 
-       if (obj != NULL) {
+       if (o != NULL) {
                /* the `this' pointer */
-               blk[0].itemtype = TYPE_ADR;
-               blk[0].item = PTR_TO_ITEM(obj);
+               vmargs[0].type = TYPE_ADR;
+               vmargs[0].data = (u8) (ptrint) o;
 
                paramtypes++;
                i++;
@@ -262,55 +265,50 @@ static void fill_callblock_from_vargs(void *obj, methoddesc *descr,
                case PRIMITIVETYPE_CHAR:
                case PRIMITIVETYPE_SHORT: 
                case PRIMITIVETYPE_BOOLEAN: 
-                       blk[i].itemtype = TYPE_INT;
-                       blk[i].item = (s8) va_arg(data, s4);
-                       break;
-
                case PRIMITIVETYPE_INT:
-                       blk[i].itemtype = TYPE_INT;
-                       blk[i].item = (s8) va_arg(data, s4);
+                       vmargs[i].type = TYPE_INT;
+                       vmargs[i].data = (s8) va_arg(ap, s4);
                        break;
 
                case PRIMITIVETYPE_LONG:
-                       blk[i].itemtype = TYPE_LNG;
-                       blk[i].item = (s8) va_arg(data, s8);
+                       vmargs[i].type = TYPE_LNG;
+                       vmargs[i].data = (s8) va_arg(ap, s8);
                        break;
 
                case PRIMITIVETYPE_FLOAT:
-                       blk[i].itemtype = TYPE_FLT;
+                       vmargs[i].type = TYPE_FLT;
 #if defined(__ALPHA__)
                        /* this keeps the assembler function much simpler */
 
-                       *((jdouble *) (&blk[i].item)) = (jdouble) va_arg(data, jdouble);
+                       *((jdouble *) (&vmargs[i].data)) = (jdouble) va_arg(ap, jdouble);
 #else
-                       *((jfloat *) (&blk[i].item)) = (jfloat) va_arg(data, jdouble);
+                       *((jfloat *) (&vmargs[i].data)) = (jfloat) va_arg(ap, jdouble);
 #endif
                        break;
 
                case PRIMITIVETYPE_DOUBLE:
-                       blk[i].itemtype = TYPE_DBL;
-                       *((jdouble *) (&blk[i].item)) = (jdouble) va_arg(data, jdouble);
+                       vmargs[i].type = TYPE_DBL;
+                       *((jdouble *) (&vmargs[i].data)) = (jdouble) va_arg(ap, jdouble);
                        break;
 
                case TYPE_ADR: 
-                       blk[i].itemtype = TYPE_ADR;
-                       blk[i].item = PTR_TO_ITEM(va_arg(data, void*));
+                       vmargs[i].type = TYPE_ADR;
+                       vmargs[i].data = (u8) (ptrint) va_arg(ap, void*);
                        break;
                }
        }
+}
 
-       /* The standard doesn't say anything about return value checking,
-          but it appears to be useful. */
 
-       if (rettype != descr->returntype.decltype)
-               log_text("\n====\nWarning call*Method called for function with wrong return type\n====");
-}
+/* _Jv_jni_vmargs_from_objectarray *********************************************
 
+   XXX
 
-/* XXX it could be considered if we should do typechecking here in the future */
+*******************************************************************************/
 
-static bool fill_callblock_from_objectarray(void *obj, methoddesc *descr,
-                                                                                       jni_callblock blk[],
+static bool _Jv_jni_vmargs_from_objectarray(java_objectheader *o,
+                                                                                       methoddesc *descr,
+                                                                                       vm_arg *vmargs,
                                                                                        java_objectarray *params)
 {
        java_objectheader *param;
@@ -327,10 +325,10 @@ static bool fill_callblock_from_objectarray(void *obj, methoddesc *descr,
 
        i = 0;
 
-       if (obj) {
+       if (o != NULL) {
                /* this pointer */
-               blk[0].itemtype = TYPE_ADR;
-               blk[0].item = PTR_TO_ITEM(obj);
+               vmargs[0].type = TYPE_ADR;
+               vmargs[0].data = (u8) (ptrint) o;
 
                paramtypes++;
                paramcount--;
@@ -345,11 +343,12 @@ static bool fill_callblock_from_objectarray(void *obj, methoddesc *descr,
                case TYPE_FLOAT:
                case TYPE_DOUBLE:
                        param = params->data[j];
-                       if (!param)
+
+                       if (param == NULL)
                                goto illegal_arg;
 
                        /* internally used data type */
-                       blk[i].itemtype = paramtypes->type;
+                       vmargs[i].type = paramtypes->type;
 
                        /* convert the value according to its declared type */
 
@@ -358,77 +357,77 @@ static bool fill_callblock_from_objectarray(void *obj, methoddesc *descr,
                        switch (paramtypes->decltype) {
                        case PRIMITIVETYPE_BOOLEAN:
                                if (c == primitivetype_table[paramtypes->decltype].class_wrap)
-                                       blk[i].item = (s8) ((java_lang_Boolean *) param)->value;
+                                       vmargs[i].data = (s8) ((java_lang_Boolean *) param)->value;
                                else
                                        goto illegal_arg;
                                break;
 
                        case PRIMITIVETYPE_BYTE:
                                if (c == primitivetype_table[paramtypes->decltype].class_wrap)
-                                       blk[i].item = (s8) ((java_lang_Byte *) param)->value;
+                                       vmargs[i].data = (s8) ((java_lang_Byte *) param)->value;
                                else
                                        goto illegal_arg;
                                break;
 
                        case PRIMITIVETYPE_CHAR:
                                if (c == primitivetype_table[paramtypes->decltype].class_wrap)
-                                       blk[i].item = (s8) ((java_lang_Character *) param)->value;
+                                       vmargs[i].data = (s8) ((java_lang_Character *) param)->value;
                                else
                                        goto illegal_arg;
                                break;
 
                        case PRIMITIVETYPE_SHORT:
                                if (c == primitivetype_table[paramtypes->decltype].class_wrap)
-                                       blk[i].item = (s8) ((java_lang_Short *) param)->value;
+                                       vmargs[i].data = (s8) ((java_lang_Short *) param)->value;
                                else if (c == primitivetype_table[PRIMITIVETYPE_BYTE].class_wrap)
-                                       blk[i].item = (s8) ((java_lang_Byte *) param)->value;
+                                       vmargs[i].data = (s8) ((java_lang_Byte *) param)->value;
                                else
                                        goto illegal_arg;
                                break;
 
                        case PRIMITIVETYPE_INT:
                                if (c == primitivetype_table[paramtypes->decltype].class_wrap)
-                                       blk[i].item = (s8) ((java_lang_Integer *) param)->value;
+                                       vmargs[i].data = (s8) ((java_lang_Integer *) param)->value;
                                else if (c == primitivetype_table[PRIMITIVETYPE_SHORT].class_wrap)
-                                       blk[i].item = (s8) ((java_lang_Short *) param)->value;
+                                       vmargs[i].data = (s8) ((java_lang_Short *) param)->value;
                                else if (c == primitivetype_table[PRIMITIVETYPE_BYTE].class_wrap)
-                                       blk[i].item = (s8) ((java_lang_Byte *) param)->value;
+                                       vmargs[i].data = (s8) ((java_lang_Byte *) param)->value;
                                else
                                        goto illegal_arg;
                                break;
 
                        case PRIMITIVETYPE_LONG:
                                if (c == primitivetype_table[paramtypes->decltype].class_wrap)
-                                       blk[i].item = (s8) ((java_lang_Long *) param)->value;
+                                       vmargs[i].data = (s8) ((java_lang_Long *) param)->value;
                                else if (c == primitivetype_table[PRIMITIVETYPE_INT].class_wrap)
-                                       blk[i].item = (s8) ((java_lang_Integer *) param)->value;
+                                       vmargs[i].data = (s8) ((java_lang_Integer *) param)->value;
                                else if (c == primitivetype_table[PRIMITIVETYPE_SHORT].class_wrap)
-                                       blk[i].item = (s8) ((java_lang_Short *) param)->value;
+                                       vmargs[i].data = (s8) ((java_lang_Short *) param)->value;
                                else if (c == primitivetype_table[PRIMITIVETYPE_BYTE].class_wrap)
-                                       blk[i].item = (s8) ((java_lang_Byte *) param)->value;
+                                       vmargs[i].data = (s8) ((java_lang_Byte *) param)->value;
                                else
                                        goto illegal_arg;
                                break;
 
                        case PRIMITIVETYPE_FLOAT:
                                if (c == primitivetype_table[paramtypes->decltype].class_wrap)
-                                       *((jfloat *) (&blk[i].item)) = (jfloat) ((java_lang_Float *) param)->value;
+                                       *((jfloat *) (&vmargs[i].data)) = (jfloat) ((java_lang_Float *) param)->value;
                                else
                                        goto illegal_arg;
                                break;
 
                        case PRIMITIVETYPE_DOUBLE:
                                if (c == primitivetype_table[paramtypes->decltype].class_wrap)
-                                       *((jdouble *) (&blk[i].item)) = (jdouble) ((java_lang_Double *) param)->value;
+                                       *((jdouble *) (&vmargs[i].data)) = (jdouble) ((java_lang_Double *) param)->value;
                                else if (c == primitivetype_table[PRIMITIVETYPE_FLOAT].class_wrap)
-                                       *((jfloat *) (&blk[i].item)) = (jfloat) ((java_lang_Float *) param)->value;
+                                       *((jfloat *) (&vmargs[i].data)) = (jfloat) ((java_lang_Float *) param)->value;
                                else
                                        goto illegal_arg;
                                break;
 
                        default:
                                goto illegal_arg;
-                       } /* end declared type switch */
+                       }
                        break;
                
                        case TYPE_ADDRESS:
@@ -445,15 +444,14 @@ static bool fill_callblock_from_objectarray(void *obj, methoddesc *descr,
                                                        goto illegal_arg;
                                        }
                                }
-                               blk[i].itemtype = TYPE_ADR;
-                               blk[i].item = PTR_TO_ITEM(params->data[j]);
-                               break;                  
+                               vmargs[i].type = TYPE_ADR;
+                               vmargs[i].data = (u8) (ptrint) params->data[j];
+                               break;
 
                        default:
                                goto illegal_arg;
-               } /* end param type switch */
-
-       } /* end param loop */
+               }
+       }
 
 /*     if (rettype) */
 /*             *rettype = descr->returntype.decltype; */
@@ -466,6 +464,76 @@ illegal_arg:
 }
 
 
+/* _Jv_jni_vmargs_from_objectarray *********************************************
+
+   XXX
+
+*******************************************************************************/
+
+static void _Jv_jni_vmargs_from_args(java_objectheader *o, methoddesc *descr,
+                                                                        vm_arg *vmargs, jvalue *args)
+{
+       typedesc *paramtypes;
+       s4        i;
+       s4        j;
+
+       paramtypes = descr->paramtypes;
+
+       /* if method is non-static fill first block and skip `this' pointer */
+
+       i = 0;
+
+       if (o != NULL) {
+               /* the `this' pointer */
+               vmargs[0].type = TYPE_ADR;
+               vmargs[0].data = (u8) (ptrint) o;
+
+               paramtypes++;
+               i++;
+       } 
+
+       for (j = 0; i < descr->paramcount; i++, j++, paramtypes++) {
+               switch (paramtypes->decltype) {
+               /* primitive types */
+               case PRIMITIVETYPE_BOOLEAN: 
+               case PRIMITIVETYPE_BYTE:
+               case PRIMITIVETYPE_CHAR:
+               case PRIMITIVETYPE_SHORT: 
+               case PRIMITIVETYPE_INT:
+                       vmargs[i].type = TYPE_INT;
+                       vmargs[i].data = (s8) args[j].i;
+                       break;
+
+               case PRIMITIVETYPE_LONG:
+                       vmargs[i].type = TYPE_LNG;
+                       vmargs[i].data = (s8) args[j].j;
+                       break;
+
+               case PRIMITIVETYPE_FLOAT:
+                       vmargs[i].type = TYPE_FLT;
+#if defined(__ALPHA__)
+                       /* this keeps the assembler function much simpler */
+
+                       *((jdouble *) (&vmargs[i].data)) = (jdouble) args[j].f;
+#else
+                       *((jfloat *) (&vmargs[i].data)) = args[j].f;
+#endif
+                       break;
+
+               case PRIMITIVETYPE_DOUBLE:
+                       vmargs[i].type = TYPE_DBL;
+                       *((jdouble *) (&vmargs[i].data)) = args[j].d;
+                       break;
+
+               case TYPE_ADR: 
+                       vmargs[i].type = TYPE_ADR;
+                       vmargs[i].data = (u8) (ptrint) args[j].l;
+                       break;
+               }
+       }
+}
+
+
 /* _Jv_jni_CallObjectMethod ****************************************************
 
    Internal function to call Java Object methods.
@@ -478,7 +546,7 @@ static java_objectheader *_Jv_jni_CallObjectMethod(java_objectheader *o,
 {
        methodinfo        *resm;
        s4                 paramcount;
-       jni_callblock     *blk;
+       vm_arg            *vmargs;
        java_objectheader *ret;
        s4                 dumpsize;
 
@@ -514,15 +582,13 @@ static java_objectheader *_Jv_jni_CallObjectMethod(java_objectheader *o,
 
        paramcount = resm->parseddesc->paramcount;
 
-       blk = DMNEW(jni_callblock, paramcount);
+       vmargs = DMNEW(vm_arg, paramcount);
 
-       fill_callblock_from_vargs(o, resm->parseddesc, blk, ap, TYPE_ADR);
+       _Jv_jni_vmargs_from_vargs(o, resm->parseddesc, vmargs, ap);
 
        STATISTICS(jnicallXmethodnvokation());
 
-       ASM_CALLJAVAFUNCTION2_ADR(ret, resm, paramcount,
-                                                         paramcount * sizeof(jni_callblock),
-                                                         blk);
+       ret = vm_call_method(resm, paramcount, vmargs);
 
        /* release dump area */
 
@@ -542,11 +608,11 @@ static java_objectheader *_Jv_jni_CallObjectMethod(java_objectheader *o,
 static jint _Jv_jni_CallIntMethod(java_objectheader *o, vftbl_t *vftbl,
                                                                  methodinfo *m, va_list ap, s4 type)
 {
-       methodinfo    *resm;
-       s4             paramcount;
-       jni_callblock *blk;
-       jint           ret;
-       s4             dumpsize;
+       methodinfo *resm;
+       s4          paramcount;
+       vm_arg     *vmargs;
+       jint        ret;
+       s4          dumpsize;
 
        STATISTICS(jniinvokation());
 
@@ -580,15 +646,13 @@ static jint _Jv_jni_CallIntMethod(java_objectheader *o, vftbl_t *vftbl,
 
        paramcount = resm->parseddesc->paramcount;
 
-       blk = DMNEW(jni_callblock, paramcount);
+       vmargs = DMNEW(vm_arg, paramcount);
 
-       fill_callblock_from_vargs(o, resm->parseddesc, blk, ap, type);
+       _Jv_jni_vmargs_from_vargs(o, resm->parseddesc, vmargs, ap);
 
        STATISTICS(jnicallXmethodnvokation());
 
-       ASM_CALLJAVAFUNCTION2_INT(ret, resm, paramcount,
-                                                         paramcount * sizeof(jni_callblock),
-                                                         blk);
+       ret = vm_call_method_int(resm, paramcount, vmargs);
 
        /* release dump area */
 
@@ -607,11 +671,11 @@ static jint _Jv_jni_CallIntMethod(java_objectheader *o, vftbl_t *vftbl,
 static jlong _Jv_jni_CallLongMethod(java_objectheader *o, vftbl_t *vftbl,
                                                                        methodinfo *m, va_list ap)
 {
-       methodinfo    *resm;
-       s4             paramcount;
-       jni_callblock *blk;
-       jlong          ret;
-       s4             dumpsize;
+       methodinfo *resm;
+       s4          paramcount;
+       vm_arg     *vmargs;
+       jlong       ret;
+       s4          dumpsize;
 
        STATISTICS(jniinvokation());
 
@@ -645,15 +709,13 @@ static jlong _Jv_jni_CallLongMethod(java_objectheader *o, vftbl_t *vftbl,
 
        paramcount = resm->parseddesc->paramcount;
 
-       blk = DMNEW(jni_callblock, paramcount);
+       vmargs = DMNEW(vm_arg, paramcount);
 
-       fill_callblock_from_vargs(o, resm->parseddesc, blk, ap, PRIMITIVETYPE_LONG);
+       _Jv_jni_vmargs_from_vargs(o, resm->parseddesc, vmargs, ap);
 
        STATISTICS(jnicallXmethodnvokation());
 
-       ASM_CALLJAVAFUNCTION2_LONG(ret, resm, paramcount,
-                                                          paramcount * sizeof(jni_callblock),
-                                                          blk);
+       ret = vm_call_method_long(resm, paramcount, vmargs);
 
        /* release dump area */
 
@@ -672,11 +734,11 @@ static jlong _Jv_jni_CallLongMethod(java_objectheader *o, vftbl_t *vftbl,
 static jfloat _Jv_jni_CallFloatMethod(java_objectheader *o, vftbl_t *vftbl,
                                                                          methodinfo *m, va_list ap)
 {
-       methodinfo    *resm;
-       s4             paramcount;
-       jni_callblock *blk;
-       jdouble        ret;
-       s4             dumpsize;
+       methodinfo *resm;
+       s4          paramcount;
+       vm_arg     *vmargs;
+       jdouble     ret;
+       s4          dumpsize;
 
        /* Class initialization is done by the JIT compiler.  This is ok
           since a static method always belongs to the declaring class. */
@@ -703,16 +765,13 @@ static jfloat _Jv_jni_CallFloatMethod(java_objectheader *o, vftbl_t *vftbl,
 
        paramcount = resm->parseddesc->paramcount;
 
-       blk = DMNEW(jni_callblock, paramcount);
+       vmargs = DMNEW(vm_arg, paramcount);
 
-       fill_callblock_from_vargs(o, resm->parseddesc, blk, ap,
-                                                         PRIMITIVETYPE_FLOAT);
+       _Jv_jni_vmargs_from_vargs(o, resm->parseddesc, vmargs, ap);
 
        STATISTICS(jnicallXmethodnvokation());
 
-       ASM_CALLJAVAFUNCTION2_FLOAT(ret, resm, paramcount,
-                                                               paramcount * sizeof(jni_callblock),
-                                                               blk);
+       ret = vm_call_method_float(resm, paramcount, vmargs);
 
        /* release dump area */
 
@@ -731,11 +790,11 @@ static jfloat _Jv_jni_CallFloatMethod(java_objectheader *o, vftbl_t *vftbl,
 static jdouble _Jv_jni_CallDoubleMethod(java_objectheader *o, vftbl_t *vftbl,
                                                                                methodinfo *m, va_list ap)
 {
-       methodinfo    *resm;
-       s4             paramcount;
-       jni_callblock *blk;
-       jfloat         ret;
-       s4             dumpsize;
+       methodinfo *resm;
+       s4          paramcount;
+       vm_arg     *vmargs;
+       jfloat      ret;
+       s4          dumpsize;
 
        /* Class initialization is done by the JIT compiler.  This is ok
           since a static method always belongs to the declaring class. */
@@ -762,16 +821,13 @@ static jdouble _Jv_jni_CallDoubleMethod(java_objectheader *o, vftbl_t *vftbl,
 
        paramcount = resm->parseddesc->paramcount;
 
-       blk = DMNEW(jni_callblock, paramcount);
+       vmargs = DMNEW(vm_arg, paramcount);
 
-       fill_callblock_from_vargs(o, resm->parseddesc, blk, ap,
-                                                         PRIMITIVETYPE_DOUBLE);
+       _Jv_jni_vmargs_from_vargs(o, resm->parseddesc, vmargs, ap);
 
        STATISTICS(jnicallXmethodnvokation());
 
-       ASM_CALLJAVAFUNCTION2_DOUBLE(ret, resm, paramcount,
-                                                                paramcount * sizeof(jni_callblock),
-                                                                blk);
+       ret = vm_call_method_double(resm, paramcount, vmargs);
 
        /* release dump area */
 
@@ -790,10 +846,10 @@ static jdouble _Jv_jni_CallDoubleMethod(java_objectheader *o, vftbl_t *vftbl,
 static void _Jv_jni_CallVoidMethod(java_objectheader *o, vftbl_t *vftbl,
                                                                   methodinfo *m, va_list ap)
 {      
-       methodinfo    *resm;
-       s4             paramcount;
-       jni_callblock *blk;
-       s4             dumpsize;
+       methodinfo *resm;
+       s4          paramcount;
+       vm_arg     *vmargs;
+       s4          dumpsize;
 
        if (m == NULL) {
                exceptions_throw_nullpointerexception();
@@ -825,15 +881,71 @@ static void _Jv_jni_CallVoidMethod(java_objectheader *o, vftbl_t *vftbl,
 
        paramcount = resm->parseddesc->paramcount;
 
-       blk = DMNEW(jni_callblock, paramcount);
+       vmargs = DMNEW(vm_arg, paramcount);
 
-       fill_callblock_from_vargs(o, resm->parseddesc, blk, ap, TYPE_VOID);
+       _Jv_jni_vmargs_from_vargs(o, resm->parseddesc, vmargs, ap);
 
        STATISTICS(jnicallXmethodnvokation());
 
-       ASM_CALLJAVAFUNCTION2(resm, paramcount,
-                                                 paramcount * sizeof(jni_callblock),
-                                                 blk);
+       (void) vm_call_method(resm, paramcount, vmargs);
+
+       /* release dump area */
+
+       dump_release(dumpsize);
+}
+
+
+/* _Jv_jni_CallVoidMethodA *****************************************************
+
+   Internal function to call Java void methods.
+
+*******************************************************************************/
+
+static void _Jv_jni_CallVoidMethodA(java_objectheader *o, vftbl_t *vftbl,
+                                                                       methodinfo *m, jvalue *args)
+{      
+       methodinfo *resm;
+       s4          paramcount;
+       vm_arg     *vmargs;
+       s4          dumpsize;
+
+       if (m == NULL) {
+               exceptions_throw_nullpointerexception();
+               return;
+       }
+
+       /* Class initialization is done by the JIT compiler.  This is ok
+          since a static method always belongs to the declaring class. */
+
+       if (m->flags & ACC_STATIC) {
+               /* For static methods we reset the object. */
+
+               if (o != NULL)
+                       o = NULL;
+
+               /* for convenience */
+
+               resm = m;
+
+       } else {
+               /* For instance methods we make a virtual function table lookup. */
+
+               resm = method_vftbl_lookup(vftbl, m);
+       }
+
+       /* mark start of dump memory area */
+
+       dumpsize = dump_size();
+
+       paramcount = resm->parseddesc->paramcount;
+
+       vmargs = DMNEW(vm_arg, paramcount);
+
+       _Jv_jni_vmargs_from_args(o, resm->parseddesc, vmargs, args);
+
+       STATISTICS(jnicallXmethodnvokation());
+
+       (void) vm_call_method(resm, paramcount, vmargs);
 
        /* release dump area */
 
@@ -856,7 +968,7 @@ java_objectheader *_Jv_jni_invokeNative(methodinfo *m, java_objectheader *o,
                                                                                java_objectarray *params)
 {
        methodinfo        *resm;
-       jni_callblock     *blk;
+       vm_arg            *vmargs;
        java_objectheader *ro;
        s4                 argcount;
        s4                 paramcount;
@@ -878,9 +990,7 @@ java_objectheader *_Jv_jni_invokeNative(methodinfo *m, java_objectheader *o,
           class the method belongs to. For static methods the obj
           parameter is ignored. */
 
-       if (!(m->flags & ACC_STATIC) && o &&
-               (!builtin_instanceof(o, m->class)))
-       {
+       if (!(m->flags & ACC_STATIC) && o && (!builtin_instanceof(o, m->class))) {
                *exceptionptr =
                        new_exception_message(string_java_lang_IllegalArgumentException,
                                                                  "Object parameter of wrong type in Java_java_lang_reflect_Method_invokeNative");
@@ -919,16 +1029,14 @@ java_objectheader *_Jv_jni_invokeNative(methodinfo *m, java_objectheader *o,
                resm = m;
        }
 
-       blk = MNEW(jni_callblock, argcount);
+       vmargs = MNEW(vm_arg, argcount);
 
-       if (!fill_callblock_from_objectarray(o, resm->parseddesc, blk, params))
+       if (!_Jv_jni_vmargs_from_objectarray(o, resm->parseddesc, vmargs, params))
                return NULL;
 
        switch (resm->parseddesc->returntype.decltype) {
        case TYPE_VOID:
-               ASM_CALLJAVAFUNCTION2(resm, argcount,
-                                                         argcount * sizeof(jni_callblock),
-                                                         blk);
+               (void) vm_call_method(resm, argcount, vmargs);
 
                ro = NULL;
                break;
@@ -937,9 +1045,7 @@ java_objectheader *_Jv_jni_invokeNative(methodinfo *m, java_objectheader *o,
                s4 i;
                java_lang_Boolean *bo;
 
-               ASM_CALLJAVAFUNCTION2_INT(i, resm, argcount,
-                                                                 argcount * sizeof(jni_callblock),
-                                                                 blk);
+               i = vm_call_method_int(resm, argcount, vmargs);
 
                ro = builtin_new(class_java_lang_Boolean);
 
@@ -954,9 +1060,7 @@ java_objectheader *_Jv_jni_invokeNative(methodinfo *m, java_objectheader *o,
                s4 i;
                java_lang_Byte *bo;
 
-               ASM_CALLJAVAFUNCTION2_INT(i, resm, argcount,
-                                                                 argcount * sizeof(jni_callblock),
-                                                                 blk);
+               i = vm_call_method_int(resm, argcount, vmargs);
 
                ro = builtin_new(class_java_lang_Byte);
 
@@ -971,9 +1075,7 @@ java_objectheader *_Jv_jni_invokeNative(methodinfo *m, java_objectheader *o,
                s4 i;
                java_lang_Character *co;
 
-               ASM_CALLJAVAFUNCTION2_INT(i, resm, argcount,
-                                                                 argcount * sizeof(jni_callblock),
-                                                                 blk);
+               i = vm_call_method_int(resm, argcount, vmargs);
 
                ro = builtin_new(class_java_lang_Character);
 
@@ -988,9 +1090,7 @@ java_objectheader *_Jv_jni_invokeNative(methodinfo *m, java_objectheader *o,
                s4 i;
                java_lang_Short *so;
 
-               ASM_CALLJAVAFUNCTION2_INT(i, resm, argcount,
-                                                                 argcount * sizeof(jni_callblock),
-                                                                 blk);
+               i = vm_call_method_int(resm, argcount, vmargs);
 
                ro = builtin_new(class_java_lang_Short);
 
@@ -1005,9 +1105,7 @@ java_objectheader *_Jv_jni_invokeNative(methodinfo *m, java_objectheader *o,
                s4 i;
                java_lang_Integer *io;
 
-               ASM_CALLJAVAFUNCTION2_INT(i, resm, argcount,
-                                                                 argcount * sizeof(jni_callblock),
-                                                                 blk);
+               i = vm_call_method_int(resm, argcount, vmargs);
 
                ro = builtin_new(class_java_lang_Integer);
 
@@ -1022,9 +1120,7 @@ java_objectheader *_Jv_jni_invokeNative(methodinfo *m, java_objectheader *o,
                s8 l;
                java_lang_Long *lo;
 
-               ASM_CALLJAVAFUNCTION2_LONG(l, resm, argcount,
-                                                                  argcount * sizeof(jni_callblock),
-                                                                  blk);
+               l = vm_call_method_long(resm, argcount, vmargs);
 
                ro = builtin_new(class_java_lang_Long);
 
@@ -1039,9 +1135,7 @@ java_objectheader *_Jv_jni_invokeNative(methodinfo *m, java_objectheader *o,
                float f;
                java_lang_Float *fo;
 
-               ASM_CALLJAVAFUNCTION2_FLOAT(f, resm, argcount,
-                                                                       argcount * sizeof(jni_callblock),
-                                                                       blk);
+               f = vm_call_method_float(resm, argcount, vmargs);
 
                ro = builtin_new(class_java_lang_Float);
 
@@ -1056,9 +1150,7 @@ java_objectheader *_Jv_jni_invokeNative(methodinfo *m, java_objectheader *o,
                double d;
                java_lang_Double *_do;
 
-               ASM_CALLJAVAFUNCTION2_DOUBLE(d, resm, argcount,
-                                                                        argcount * sizeof(jni_callblock),
-                                                                        blk);
+               d = vm_call_method_double(resm, argcount, vmargs);
 
                ro = builtin_new(class_java_lang_Double);
 
@@ -1070,21 +1162,19 @@ java_objectheader *_Jv_jni_invokeNative(methodinfo *m, java_objectheader *o,
        break;
 
        case TYPE_ADR:
-               ASM_CALLJAVAFUNCTION2_ADR(ro, resm, argcount,
-                                                                 argcount * sizeof(jni_callblock),
-                                                                 blk);
+               ro = vm_call_method(resm, argcount, vmargs);
                break;
 
        default:
                /* if this happens the exception has already been set by
                   fill_callblock_from_objectarray */
 
-               MFREE(blk, jni_callblock, argcount);
+               MFREE(vmargs, vm_arg, argcount);
 
                return NULL;
        }
 
-       MFREE(blk, jni_callblock, argcount);
+       MFREE(vmargs, vm_arg, argcount);
 
        if (*exceptionptr) {
                java_objectheader *cause;
@@ -1359,7 +1449,7 @@ void ExceptionDescribe(JNIEnv *env)
 
                /* print the stacktrace */
 
-               ASM_CALLJAVAFUNCTION(m, e, NULL, NULL, NULL);
+               (void) vm_call_method_intern(m, e, NULL, NULL, NULL);
        }
 }
 
@@ -1620,7 +1710,7 @@ jobject NewObject(JNIEnv *env, jclass clazz, jmethodID methodID, ...)
 
        o = builtin_new(clazz);
        
-       if (!o)
+       if (o == NULL)
                return NULL;
 
        /* call constructor */
@@ -1656,7 +1746,7 @@ jobject NewObjectV(JNIEnv* env, jclass clazz, jmethodID methodID, va_list args)
 
        o = builtin_new(clazz);
        
-       if (!o)
+       if (o == NULL)
                return NULL;
 
        /* call constructor */
@@ -1667,21 +1757,37 @@ jobject NewObjectV(JNIEnv* env, jclass clazz, jmethodID methodID, va_list args)
 }
 
 
-/*********************************************************************************** 
+/* NewObjectA ***************************************************************** 
 
-       Constructs a new Java object
-       arguments that are to be passed to the constructor are placed in 
-       args array of jvalues 
+   Programmers place all arguments that are to be passed to the
+   constructor in an args array of jvalues that immediately follows
+   the methodID argument. NewObjectA() accepts the arguments in this
+   array, and, in turn, passes them to the Java method that the
+   programmer wishes to invoke.
 
-***********************************************************************************/
+*******************************************************************************/
 
 jobject NewObjectA(JNIEnv* env, jclass clazz, jmethodID methodID, jvalue *args)
 {
+       java_objectheader *o;
+       methodinfo        *m;
+
        STATISTICS(jniinvokation());
 
-       log_text("JNI-Call: NewObjectA: IMPLEMENT ME!");
+       m = (methodinfo *) methodID;
 
-       return NewLocalRef(env, NULL);
+       /* create object */
+
+       o = builtin_new(clazz);
+       
+       if (o == NULL)
+               return NULL;
+
+       /* call constructor */
+
+       _Jv_jni_CallVoidMethodA(o, o->vftbl, m, args);
+
+       return NewLocalRef(env, o);
 }
 
 
@@ -2286,7 +2392,13 @@ void CallVoidMethodV(JNIEnv *env, jobject obj, jmethodID methodID, va_list args)
 
 void CallVoidMethodA(JNIEnv *env, jobject obj, jmethodID methodID, jvalue *args)
 {
-       log_text("JNI-Call: CallVoidMethodA: IMPLEMENT ME!");
+       java_objectheader *o;
+       methodinfo        *m;
+
+       o = (java_objectheader *) obj;
+       m = (methodinfo *) methodID;
+
+       _Jv_jni_CallVoidMethodA(o, o->vftbl, m, args);
 }
 
 
@@ -2736,8 +2848,16 @@ void CallNonvirtualVoidMethodV(JNIEnv *env, jobject obj, jclass clazz, jmethodID
 
 
 void CallNonvirtualVoidMethodA(JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, jvalue * args)
-{
-       log_text("JNI-Call: CallNonvirtualVoidMethodA: IMPLEMENT ME!");
+{      
+       java_objectheader *o;
+       classinfo         *c;
+       methodinfo        *m;
+
+       o = (java_objectheader *) obj;
+       c = (classinfo *) clazz;
+       m = (methodinfo *) methodID;
+
+       _Jv_jni_CallVoidMethodA(o, c->vftbl, m, args);
 }
 
 
@@ -3382,7 +3502,11 @@ void CallStaticVoidMethodV(JNIEnv *env, jclass clazz, jmethodID methodID, va_lis
 
 void CallStaticVoidMethodA(JNIEnv *env, jclass clazz, jmethodID methodID, jvalue * args)
 {
-       log_text("JNI-Call: CallStaticVoidMethodA: IMPLEMENT ME!");
+       methodinfo *m;
+
+       m = (methodinfo *) methodID;
+
+       _Jv_jni_CallVoidMethodA(NULL, NULL, m, args);
 }
 
 
@@ -5060,7 +5184,7 @@ jobject NewGlobalRef(JNIEnv* env, jobject lobj)
        builtin_monitorenter(*global_ref_table);
 #endif
        
-       ASM_CALLJAVAFUNCTION_ADR(o, getmid, *global_ref_table, lobj, NULL, NULL);
+       o = vm_call_method_intern(getmid, *global_ref_table, lobj, NULL, NULL);
 
        refcount = (java_lang_Integer *) o;
 
@@ -5074,7 +5198,8 @@ jobject NewGlobalRef(JNIEnv* env, jobject lobj)
                        return NULL;
                }
 
-               ASM_CALLJAVAFUNCTION(putmid, *global_ref_table, lobj, newval, NULL);
+               (void) vm_call_method_intern(putmid, *global_ref_table, lobj, newval,
+                                                                        NULL);
 
        } else {
                /* we can access the object itself, as we are in a
@@ -5109,8 +5234,7 @@ void DeleteGlobalRef(JNIEnv* env, jobject globalRef)
        builtin_monitorenter(*global_ref_table);
 #endif
 
-       ASM_CALLJAVAFUNCTION_ADR(o, getmid, *global_ref_table, globalRef, NULL,
-                                                        NULL);
+       o = vm_call_method_intern(getmid, *global_ref_table, globalRef, NULL, NULL);
 
        refcount = (java_lang_Integer *) o;
 
@@ -5125,8 +5249,8 @@ void DeleteGlobalRef(JNIEnv* env, jobject globalRef)
        val = refcount->value - 1;
 
        if (val == 0) {
-               ASM_CALLJAVAFUNCTION(removemid, *global_ref_table, refcount, NULL,
-                                                        NULL);
+               (void) vm_call_method_intern(removemid, *global_ref_table, refcount,
+                                                                        NULL, NULL);
 
        } else {
                /* we do not create a new object, but set the new value into
index 715dc0f019dffe921f17ffb19fcaf847fbcdda2c..c84345063fe876efcf7d05711a83abf53e9256c7 100644 (file)
@@ -30,7 +30,7 @@
 
    Changes: Christian Thalinger
 
-   $Id: native.c 4541 2006-02-21 13:37:48Z twisti $
+   $Id: native.c 4552 2006-03-04 17:15:44Z twisti $
 
 */
 
@@ -58,6 +58,7 @@
 #include "vm/options.h"
 #include "vm/resolve.h"
 #include "vm/stringlocal.h"
+#include "vm/vm.h"
 #include "vm/jit/asmpart.h"
 #include "vm/jit/jit.h"
 
@@ -794,7 +795,7 @@ java_objectheader *native_new_and_init(classinfo *c)
 
        /* call initializer */
 
-       ASM_CALLJAVAFUNCTION(m, o, NULL, NULL, NULL);
+       (void) vm_call_method_intern(m, o, NULL, NULL, NULL);
 
        return o;
 }
@@ -830,7 +831,7 @@ java_objectheader *native_new_and_init_string(classinfo *c, java_lang_String *s)
 
        /* call initializer */
 
-       ASM_CALLJAVAFUNCTION(m, o, s, NULL, NULL);
+       (void) vm_call_method_intern(m, o, s, NULL, NULL);
 
        return o;
 }
@@ -862,7 +863,7 @@ java_objectheader *native_new_and_init_int(classinfo *c, s4 i)
 
        /* call initializer */
 
-       ASM_CALLJAVAFUNCTION(m, o, (void *) (ptrint) i, NULL, NULL);
+       (void) vm_call_method_intern(m, o, (void *) (ptrint) i, NULL, NULL);
 
        return o;
 }
@@ -894,7 +895,7 @@ java_objectheader *native_new_and_init_throwable(classinfo *c, java_lang_Throwab
 
        /* call initializer */
 
-       ASM_CALLJAVAFUNCTION(m, o, t, NULL, NULL);
+       (void) vm_call_method_intern(m, o, t, NULL, NULL);
 
        return o;
 }
index 52c5675ffc30d7e01c60826d9b739223f484e034..653c5579f731daa8fd5db54d8d10c3377f385c74 100644 (file)
             Christian Thalinger
             Edwin Steiner
 
-   $Id: VMClassLoader.c 4487 2006-02-12 02:18:20Z edwin $
+   $Id: VMClassLoader.c 4552 2006-03-04 17:15:44Z twisti $
 
 */
 
 
+#include "config.h"
+
 #include <sys/stat.h>
 
-#include "config.h"
 #include "vm/types.h"
 
 #include "mm/memory.h"
@@ -60,6 +61,7 @@
 #include "vm/statistics.h"
 #include "vm/stringlocal.h"
 #include "vm/suck.h"
+#include "vm/vm.h"
 #include "vm/zip.h"
 #include "vm/jit/asmpart.h"
 
@@ -396,9 +398,9 @@ JNIEXPORT java_util_Vector* JNICALL Java_java_lang_VMClassLoader_nativeGetResour
                /* if a resource was found, add it to the vector */
 
                if (path) {
-                       ASM_CALLJAVAFUNCTION_INT(ret, m, o, path, NULL, NULL);
+                       ret = vm_call_method_intern_int(m, o, path, NULL, NULL);
 
-                       if (!ret)
+                       if (ret == 0)
                                return NULL;
                }
        }
index 18fe81d74675cc1c5693598debfcfe5b0b973ae5..81684dd3e93ac6c402a52c5ff504db0772898254 100644 (file)
@@ -29,7 +29,7 @@
    Changes: Christian Thalinger
                        Edwin Steiner
 
-   $Id: threads.c 4534 2006-02-21 09:31:25Z twisti $
+   $Id: threads.c 4552 2006-03-04 17:15:44Z twisti $
 
 */
 
@@ -630,8 +630,8 @@ bool threads_init(u1 *stackbottom)
        if (!method)
                return false;
 
-       ASM_CALLJAVAFUNCTION(method, mainthread, mainthreadobj, threadname,
-                                                (void *) 5);
+       (void) vm_call_method_intern(method, mainthread, mainthreadobj, threadname,
+                                                                (void *) 5);
 
        if (*exceptionptr)
                return false;
@@ -651,7 +651,7 @@ bool threads_init(u1 *stackbottom)
        if (!method)
                return false;
 
-       ASM_CALLJAVAFUNCTION(method, threadgroup, mainthread, NULL, NULL);
+       (void) vm_call_method_intern(method, threadgroup, mainthread, NULL, NULL);
 
        if (*exceptionptr)
                return false;
@@ -781,7 +781,7 @@ static void *threads_startup_thread(void *t)
                if (!method)
                        throw_exception();
 
-               ASM_CALLJAVAFUNCTION(method, thread, NULL, NULL, NULL);
+               (void) vm_call_method_intern(method, thread, NULL, NULL, NULL);
 
        } 
        else {
index b8c7248091c358a0e10780f8194f549474a93bcc..cf2c5c7c34ee28908538a87938129689f41ac1a9 100644 (file)
@@ -28,7 +28,7 @@
 
    Changes: Edwin Steiner
 
-   $Id: exceptions.c 4550 2006-03-01 17:00:33Z twisti $
+   $Id: exceptions.c 4552 2006-03-04 17:15:44Z twisti $
 
 */
 
@@ -54,6 +54,7 @@
 #include "vm/loader.h"
 #include "vm/options.h"
 #include "vm/stringlocal.h"
+#include "vm/vm.h"
 #include "vm/jit/asmpart.h"
 #include "vm/jit/jit.h"
 #include "vm/jit/methodheader.h"
@@ -188,7 +189,7 @@ static void throw_exception_exit_intern(bool doexit)
                /* print the stacktrace */
 
                if (pss) {
-                       ASM_CALLJAVAFUNCTION(pss, xptr, NULL, NULL, NULL);
+                       (void) vm_call_method_intern(pss, xptr, NULL, NULL, NULL);
 
                        /* This normally means, we are EXTREMLY out of memory or have a   */
                        /* serious problem while printStackTrace. But may be another      */
@@ -962,20 +963,20 @@ java_objectheader *new_arrayindexoutofboundsexception(s4 index)
                                                                 class_java_lang_Object,
                                                                 true);
 
-       if (!m)
+       if (m == NULL)
                return *exceptionptr;
 
-       ASM_CALLJAVAFUNCTION_ADR(o, m, (void *) (ptrint) index, NULL, NULL, NULL);
+       o = vm_call_method_intern(m, (void *) (ptrint) index, NULL, NULL, NULL);
 
        s = (java_lang_String *) o;
 
-       if (!s)
+       if (s == NULL)
                return *exceptionptr;
 
        e = new_exception_javastring(string_java_lang_ArrayIndexOutOfBoundsException,
                                                                 s);
 
-       if (!e)
+       if (e == NULL)
                return *exceptionptr;
 
        return e;
index 84ffbcb72cc30a9854cae384a503f96dc331e896..9a03be8a2040f092b50c68f9f33654a386e0b398 100644 (file)
@@ -28,7 +28,7 @@
 
    Changes:
 
-   $Id: finalizer.c 4357 2006-01-22 23:33:38Z twisti $
+   $Id: finalizer.c 4552 2006-03-04 17:15:44Z twisti $
 
 */
 
@@ -48,6 +48,7 @@
 #include "vm/global.h"
 #include "vm/options.h"
 #include "vm/stringlocal.h"
+#include "vm/vm.h"
 #include "vm/jit/asmpart.h"
 
 
@@ -193,7 +194,7 @@ void finalizer_run(void *o, void *p)
 
        /* call the finalizer function */
 
-       ASM_CALLJAVAFUNCTION(ob->vftbl->class->finalizer, ob, NULL, NULL, NULL);
+       vm_call_method_intern(ob->vftbl->class->finalizer, ob, NULL, NULL, NULL);
 
        /* if we had an exception in the finalizer, ignore it */
 
index 57156bd1e4200302ec567041ecba5246e07d42e5..27ed990e265fe7c3480b0c0f8df9f9bfd94f35d6 100644 (file)
@@ -33,7 +33,7 @@
             Joseph Wenninger
             Christian Thalinger
 
-   $Id: global.h 4551 2006-03-03 00:00:39Z twisti $
+   $Id: global.h 4552 2006-03-04 17:15:44Z twisti $
 
 */
 
@@ -200,16 +200,6 @@ typedef struct java_objectarray java_objectarray;
 #define ACC_MIRANDA         0x8000
 
 
-/* data structure for calls from c code to java methods */
-
-struct jni_callblock {
-       u8 itemtype;
-       u8 item;
-};
-
-typedef struct jni_callblock jni_callblock;
-
-
 /* data structures of the runtime system **************************************/
 
 /* java_objectheader ***********************************************************
index 24e98905da297332fd68a93e06abe16389955bb1..36a2e12089f4e004261e1dbbda55d2a01d437f56 100644 (file)
@@ -30,7 +30,7 @@
             Andreas Krall
             Christian Thalinger
 
-   $Id: initialize.c 4357 2006-01-22 23:33:38Z twisti $
+   $Id: initialize.c 4552 2006-03-04 17:15:44Z twisti $
 
 */
 
@@ -50,6 +50,7 @@
 #include "vm/options.h"
 #include "vm/statistics.h"
 #include "vm/stringlocal.h"
+#include "vm/vm.h"
 #include "vm/jit/asmpart.h"
 
 
@@ -205,7 +206,7 @@ static bool initialize_class_intern(classinfo *c)
 
        /* now call the initializer */
 
-       ASM_CALLJAVAFUNCTION(m, NULL, NULL, NULL, NULL);
+       (void) vm_call_method_intern(m, NULL, NULL, NULL, NULL);
 
 #if defined(USE_THREADS) && !defined(NATIVE_THREADS)
        assert(blockInts == 0);
index bd731178f1aff88d23f779620132d35a4195fada..cd4f4187340d11f792bbc2c2d13bb3aad99c0bf1 100644 (file)
@@ -29,7 +29,7 @@
    Changes: Christian Thalinger
             Edwin Steiner
 
-   $Id: stacktrace.c 4533 2006-02-21 09:25:16Z twisti $
+   $Id: stacktrace.c 4552 2006-03-04 17:15:44Z twisti $
 
 */
 
@@ -68,6 +68,7 @@
 #include "vm/loader.h"
 #include "vm/options.h"
 #include "vm/stringlocal.h"
+#include "vm/vm.h"
 #include "vm/jit/asmpart.h"
 #include "vm/jit/codegen-common.h"
 #include "vm/jit/methodheader.h"
@@ -561,7 +562,7 @@ java_objectheader *stacktrace_inline_fillInStackTrace(u1 *pv, u1 *sp, u1 *ra,
 
        /* call function */
 
-       ASM_CALLJAVAFUNCTION(m, o, NULL, NULL, NULL);
+       (void) vm_call_method_intern(m, o, NULL, NULL, NULL);
 
        /* remove stackframeinfo */
 
index 19c9646f21894639fa7b7f797681e328a39ff263..0b9606bc93343acdd78e0b47800939459ccce3e8 100644 (file)
 
    Changes:
 
-   $Id: genoffsets.c 4357 2006-01-22 23:33:38Z twisti $
+   $Id: genoffsets.c 4552 2006-03-04 17:15:44Z twisti $
 
 */
 
 
+#include "config.h"
+
 #include <stdio.h>
 
 #include "vm/types.h"
 
-#include "vm/global.h"
 #include "mm/memory.h"
+#include "vm/class.h"
+#include "vm/global.h"
 #include "vm/linker.h"
 #include "vm/method.h"
-#include "vm/class.h"
+#include "vm/vm.h"
 #include "vm/jit/asmpart.h"
 #include "vm/jit/stacktrace.h"
 
@@ -52,7 +55,7 @@ int main(int argc, char **argv)
 
     printf("/* define some sizeof()'s */\n\n");
 
-       printf("#define sizejniblock               %3d\n", (s4) sizeof(jni_callblock));
+       printf("#define sizevmarg                  %3d\n", (s4) sizeof(vm_arg));
        printf("#define sizestackframeinfo         %3d\n", (s4) sizeof(stackframeinfo));
 
     printf("\n\n/* define some offsets */\n\n");
@@ -69,8 +72,8 @@ int main(int argc, char **argv)
        printf("#define offclassvftbl              %3d\n", (s4) OFFSET(classinfo, vftbl));
        printf("\n\n");
 
-       printf("#define offjniitemtype             %3d\n", (s4) OFFSET(jni_callblock, itemtype));
-       printf("#define offjniitem                 %3d\n", (s4) OFFSET(jni_callblock, item));
+       printf("#define offvmargtype               %3d\n", (s4) OFFSET(vm_arg, type));
+       printf("#define offvmargdata               %3d\n", (s4) OFFSET(vm_arg, data));
        printf("\n\n");
 
        printf("#define offcast_super_baseval      %3d\n", (s4) OFFSET(castinfo, super_baseval));
index 3221295687cba2f23f2c9a4ab11aa585c498e90b..47c34ad0ce64f46793112fb623b3752a7388e9c3 100644 (file)
@@ -30,7 +30,7 @@
 
    Changes:
 
-   $Id: asmpart.S 4530 2006-02-21 09:11:53Z twisti $
+   $Id: asmpart.S 4552 2006-03-04 17:15:44Z twisti $
 
 */
 
@@ -196,25 +196,25 @@ L_asm_calljavafunction2:                /* required for PIC code              */
        jle     L_copy_done
 
        mov     a1,itmp3                    /* arg count                          */
-       mov     a3,itmp2                    /* pointer to arg block               */
+       mov     a2,itmp2                    /* pointer to arg block               */
 
        mov     itmp2,%r14                  /* save argument block pointer        */
        mov     itmp3,%r15                  /* save argument count                */
 
-       sub     $sizejniblock,itmp2         /* initialize pointer (smaller code)  */
+       sub     $sizevmarg,itmp2            /* initialize pointer (smaller code)  */
        add     $1,itmp3                    /* initialize argument count          */
        xor     %r12,%r12                   /* initialize integer argument counter*/
        xor     %r13,%r13                   /* initialize float argument counter  */
 
 L_register_copy:
-       add     $sizejniblock,itmp2       /* goto next argument block             */
-       dec     itmp3                     /* argument count - 1                   */
+       add     $sizevmarg,itmp2            /* goto next argument block           */
+       dec     itmp3                       /* argument count - 1                 */
        jz      L_register_copy_done
-       andb    $0x02,offjniitemtype(itmp2) /* is this a float/double type?       */
-       jnz     L_register_handle_float   /* yes, handle it                       */
+       andb    $0x02,offvmargtype(itmp2)   /* is this a float/double type?       */
+       jnz     L_register_handle_float     /* yes, handle it                     */
 
-       cmp     $INT_ARG_CNT,%r12         /* are we out of integer argument       */
-       je      L_register_copy           /* register? yes, next loop             */
+       cmp     $INT_ARG_CNT,%r12           /* are we out of integer argument     */
+       je      L_register_copy             /* register? yes, next loop           */
 
        lea     jumptable_integer(%rip),%rbp
        mov     0(%rbp,%r12,8),%rbx
@@ -238,31 +238,31 @@ L_register_copy_done:
 
        and     $0xfffffffffffffffe,%rbp  /* keep stack 16-byte aligned           */
        shl     $3,%rbp                   /* calculate stack size                 */
-       sub     %rbp,sp                 /* stack frame for arguments            */
-       mov     sp,%rbx                 /* use %rbx as temp sp                  */
+       sub     %rbp,sp                   /* stack frame for arguments            */
+       mov     sp,%rbx                   /* use %rbx as temp sp                  */
 
-       sub     $sizejniblock,%r14        /* initialize pointer (smaller code)    */
+       sub     $sizevmarg,%r14           /* initialize pointer (smaller code)    */
        add     $1,%r15                   /* initialize argument count            */
                
 L_stack_copy_loop:
-       add     $sizejniblock,%r14        /* goto next argument block             */
+       add     $sizevmarg,%r14           /* goto next argument block             */
        dec     %r15                      /* are there any arguments left?        */
        jz      L_copy_done               /* no test needed after dec             */
 
-       andb    $0x02,offjniitemtype(%r14) /* is this a float/double type?        */
+       andb    $0x02,offvmargtype(%r14)    /* is this a float/double type?       */
        jnz     L_stack_handle_float
-       dec     %r12                      /* arguments assigned to registers      */
+       dec     %r12                        /* arguments assigned to registers    */
        jge     L_stack_copy_loop
        jmp     L_stack_copy
 
 L_stack_handle_float:
-       dec     %r13                      /* arguments assigned to registers      */
+       dec     %r13                        /* arguments assigned to registers    */
        jge     L_stack_copy_loop
 
 L_stack_copy:
-    mov     offjniitem(%r14),itmp3    /* copy s8 argument onto stack          */
-    mov     itmp3,0(%rbx)
-    add     $8,%rbx                   /* increase sp to next argument         */
+       mov     offvmargdata(%r14),itmp3    /* copy s8 argument onto stack        */
+       mov     itmp3,0(%rbx)
+       add     $8,%rbx                     /* increase sp to next argument       */
        jmp     L_stack_copy_loop
 
 L_copy_done:
@@ -298,22 +298,22 @@ jumptable_integer:
        .quad   handle_a5
 
 handle_a0:
-       mov     offjniitem(itmp2),a0
+       mov     offvmargdata(itmp2),a0
        jmp     L_register_copy
 handle_a1:
-       mov     offjniitem(itmp2),a1
+       mov     offvmargdata(itmp2),a1
        jmp     L_register_copy
 handle_a2:
-       mov     offjniitem(itmp2),a2
+       mov     offvmargdata(itmp2),a2
        jmp     L_register_copy
 handle_a3:
-       mov     offjniitem(itmp2),a3
+       mov     offvmargdata(itmp2),a3
        jmp     L_register_copy
 handle_a4:
-       mov     offjniitem(itmp2),a4
+       mov     offvmargdata(itmp2),a4
        jmp     L_register_copy
 handle_a5:
-       mov     offjniitem(itmp2),a5
+       mov     offvmargdata(itmp2),a5
        jmp     L_register_copy
 
 
@@ -328,28 +328,28 @@ jumptable_float:
        .quad   handle_fa7
 
 handle_fa0:
-       movq    offjniitem(itmp2),fa0
+       movq    offvmargdata(itmp2),fa0
        jmp     L_register_copy
 handle_fa1:
-       movq    offjniitem(itmp2),fa1
+       movq    offvmargdata(itmp2),fa1
        jmp     L_register_copy
 handle_fa2:
-       movq    offjniitem(itmp2),fa2
+       movq    offvmargdata(itmp2),fa2
        jmp     L_register_copy
 handle_fa3:
-       movq    offjniitem(itmp2),fa3
+       movq    offvmargdata(itmp2),fa3
        jmp     L_register_copy
 handle_fa4:
-       movq    offjniitem(itmp2),fa4
+       movq    offvmargdata(itmp2),fa4
        jmp     L_register_copy
 handle_fa5:
-       movq    offjniitem(itmp2),fa5
+       movq    offvmargdata(itmp2),fa5
        jmp     L_register_copy
 handle_fa6:
-       movq    offjniitem(itmp2),fa6
+       movq    offvmargdata(itmp2),fa6
        jmp     L_register_copy
 handle_fa7:
-       movq    offjniitem(itmp2),fa7
+       movq    offvmargdata(itmp2),fa7
        jmp     L_register_copy
 
 
@@ -455,7 +455,7 @@ L_asm_call_jit_compiler_exception:
        call    builtin_asm_get_exceptionptrptr@PLT
        mov     v0,itmp2                    /* v0 == xptr                         */
 #else
-       lea     _no_threads_exceptionptr,itmp2
+       lea     _no_threads_exceptionptr(%rip),itmp2
 #endif
        mov     (itmp2),xptr                /* get the exception pointer          */
        movl    $0,(itmp2)                  /* clear exception pointer            */
@@ -674,7 +674,7 @@ L_asm_wrapper_patcher_exception:
        call    builtin_asm_get_exceptionptrptr@PLT
        mov     v0,itmp2                    /* v0 == xptr                         */
 #else
-       lea     _no_threads_exceptionptr,itmp2
+       mov     _no_threads_exceptionptr,itmp2
 #endif
        mov     (itmp2),xptr                /* get the exception pointer          */
        movl    $0,(itmp2)                  /* clear exception pointer            */
index f785c2e527f4266ab64f0b78333e3e79aae3f0ec..68b5c8ea0d020767e2e2abd1fc63b16d98a58f54 100644 (file)
@@ -32,7 +32,7 @@
             Edwin Steiner
             Christian Thalinger
 
-   $Id: loader.c 4540 2006-02-21 13:35:53Z twisti $
+   $Id: loader.c 4552 2006-03-04 17:15:44Z twisti $
 
 */
 
@@ -69,6 +69,7 @@
 #include "vm/statistics.h"
 #include "vm/stringlocal.h"
 #include "vm/suck.h"
+#include "vm/vm.h"
 
 #if defined(ENABLE_ZLIB)
 # include "vm/zip.h"
@@ -1423,7 +1424,7 @@ classinfo *load_class_from_sysloader(utf *name)
        if (!m)
                return false;
 
-       ASM_CALLJAVAFUNCTION_ADR(cl, m, NULL, NULL, NULL, NULL);
+       cl = vm_call_method_intern(m, NULL, NULL, NULL, NULL);
 
        if (!cl)
                return false;
@@ -1552,7 +1553,7 @@ classinfo *load_class_from_classloader(utf *name, java_objectheader *cl)
 
                s = javastring_new_slash_to_dot(name);
 
-               ASM_CALLJAVAFUNCTION_ADR(o, lc, cl, s, NULL, NULL);
+               o = vm_call_method_intern(lc, cl, s, NULL, NULL);
 
                c = (classinfo *) o;
 
index cfe531d16e10289dc6487e79cbaff853b9fd8c53..fb91c9cb87be2ee22ef71857fbfbf2c76f7cd1bf 100644 (file)
@@ -28,7 +28,7 @@
 
    Changes:
 
-   $Id: properties.c 4435 2006-02-04 23:59:54Z twisti $
+   $Id: properties.c 4552 2006-03-04 17:15:44Z twisti $
 
 */
 
@@ -48,6 +48,7 @@
 #include "vm/method.h"
 #include "vm/options.h"
 #include "vm/stringlocal.h"
+#include "vm/vm.h"
 #include "vm/jit/asmpart.h"
 
 
@@ -168,7 +169,7 @@ void properties_system_add(char *key, char *value)
        k = javastring_new_char(key);
        v = javastring_new_char(value);
 
-       ASM_CALLJAVAFUNCTION(mput, psystem, k, v, NULL);
+       (void) vm_call_method_intern(mput, psystem, k, v, NULL);
 }
 
 
index 54ca08a4fd2e0ed839b9aac175440335b174cfd3..8095558656b274cb563ba7eb8ea78f31c5d542fe 100644 (file)
@@ -64,6 +64,7 @@
 #include "vm/signallocal.h"
 #include "vm/stringlocal.h"
 #include "vm/suck.h"
+#include "vm/vm.h"
 #include "vm/jit/asmpart.h"
 #include "vm/jit/profile/profile.h"
 
@@ -1201,7 +1202,7 @@ void vm_exit(s4 status)
 
        /* call the exit function with passed exit status */
 
-       ASM_CALLJAVAFUNCTION(m, (void *) (ptrint) status, NULL, NULL, NULL);
+       (void) vm_call_method_intern(m, (void *) (ptrint) status, NULL, NULL, NULL);
 
        /* this should never happen */
 
@@ -1287,6 +1288,190 @@ void vm_exit_handler(void)
 }
 
 
+/* vm_call_method_intern *******************************************************
+
+   Calls a Java method with a fixed number of arguments (namely 4) and
+   returns an address.
+
+*******************************************************************************/
+
+java_objectheader *vm_call_method_intern(methodinfo *m, void *a0, void *a1,
+                                                                                void *a2, void *a3)
+{
+       java_objectheader *o;
+
+#if defined(ENABLE_JIT)
+# if defined(ENABLE_INTRP)
+       if (opt_intrp)
+               o = intrp_asm_calljavafunction(m, a0, a1, a2, a3);
+       else
+# endif
+               o = asm_calljavafunction(m, a0, a1, a2, a3);
+#else
+       o = intrp_asm_calljavafunction(m, a0, a1, a2, a3);
+#endif
+
+       return o;
+}
+
+
+/* vm_call_method_intern_int ***************************************************
+
+   Calls a Java method with a fixed number of arguments (namely 4) and
+   returns an integer (s4).
+
+*******************************************************************************/
+
+s4 vm_call_method_intern_int(methodinfo *m, void *a0, void *a1, void *a2,
+                                                        void *a3)
+{
+       s4 i;
+
+#if defined(ENABLE_JIT)
+# if defined(ENABLE_INTRP)
+       if (opt_intrp)
+               i = intrp_asm_calljavafunction_int(m, a0, a1, a2, a3);
+       else
+# endif
+               i = asm_calljavafunction_int(m, a0, a1, a2, a3);
+#else
+       i = intrp_asm_calljavafunction_int(m, a0, a1, a2, a3);
+#endif
+
+       return i;
+}
+
+
+/* vm_call_method **************************************************************
+
+   Calls a Java method with a variable number of arguments and returns
+   an address.
+
+*******************************************************************************/
+
+java_objectheader *vm_call_method(methodinfo *m, u4 count, vm_arg *vmargs)
+{
+       java_objectheader *o;
+
+#if defined(ENABLE_JIT)
+# if defined(ENABLE_INTRP)
+       if (opt_intrp)
+               o = intrp_asm_calljavafunction2(m, count, vmargs);
+       else
+# endif
+               o = asm_calljavafunction2(m, count, vmargs);
+#else
+       o = intrp_asm_calljavafunction(m, count, vmargs);
+#endif
+
+       return o;
+}
+
+
+/* vm_call_method_int **********************************************************
+
+   Calls a Java method with a variable number of arguments and returns
+   an integer (s4).
+
+*******************************************************************************/
+
+s4 vm_call_method_int(methodinfo *m, u4 count, vm_arg *vmargs)
+{
+       s4 i;
+
+#if defined(ENABLE_JIT)
+# if defined(ENABLE_INTRP)
+       if (opt_intrp)
+               i = intrp_asm_calljavafunction2int(m, count, vmargs);
+       else
+# endif
+               i = asm_calljavafunction2int(m, count, vmargs);
+#else
+       i = intrp_asm_calljavafunction2int(m, count, vmargs);
+#endif
+
+       return i;
+}
+
+
+/* vm_call_method_long *********************************************************
+
+   Calls a Java method with a variable number of arguments and returns
+   a long (s8).
+
+*******************************************************************************/
+
+s8 vm_call_method_long(methodinfo *m, u4 count, vm_arg *vmargs)
+{
+       s8 l;
+
+#if defined(ENABLE_JIT)
+# if defined(ENABLE_INTRP)
+       if (opt_intrp)
+               l = intrp_asm_calljavafunction2long(m, count, vmargs);
+       else
+# endif
+               l = asm_calljavafunction2long(m, count, vmargs);
+#else
+       l = intrp_asm_calljavafunction2long(m, count, vmargs);
+#endif
+
+       return l;
+}
+
+
+/* vm_call_method_float ********************************************************
+
+   Calls a Java method with a variable number of arguments and returns
+   an float.
+
+*******************************************************************************/
+
+float vm_call_method_float(methodinfo *m, u4 count, vm_arg *vmargs)
+{
+       float f;
+
+#if defined(ENABLE_JIT)
+# if defined(ENABLE_INTRP)
+       if (opt_intrp)
+               f = intrp_asm_calljavafunction2float(m, count, vmargs);
+       else
+# endif
+               f = asm_calljavafunction2float(m, count, vmargs);
+#else
+       f = intrp_asm_calljavafunction2float(m, count, vmargs);
+#endif
+
+       return f;
+}
+
+
+/* vm_call_method_double *******************************************************
+
+   Calls a Java method with a variable number of arguments and returns
+   a double.
+
+*******************************************************************************/
+
+double vm_call_method_double(methodinfo *m, u4 count, vm_arg *vmargs)
+{
+       double d;
+
+#if defined(ENABLE_JIT)
+# if defined(ENABLE_INTRP)
+       if (opt_intrp)
+               d = intrp_asm_calljavafunction2double(m, count, vmargs);
+       else
+# endif
+               d = asm_calljavafunction2double(m, count, vmargs);
+#else
+       d = intrp_asm_calljavafunction2double(m, count, vmargs);
+#endif
+
+       return d;
+}
+
+
 /*
  * 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
index 2f1cac7664abe2967e34eeb0b6945370e5823e54..4217b2ea73a05ce80cfbc8124aa17a12e1ba9add 100644 (file)
@@ -58,6 +58,21 @@ 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;
+};
+
+
 /* function prototypes ********************************************************/
 
 void usage(void);
@@ -69,6 +84,19 @@ void vm_shutdown(s4 status);
 
 void vm_exit_handler(void);
 
+/* Java method calling functions */
+java_objectheader *vm_call_method_intern(methodinfo *m, void *a0, void *a1,
+                                                                                void *a2, void *a3);
+
+s4 vm_call_method_intern_int(methodinfo *m, void *a0, void *a1, void *a2,
+                                                        void *a3);
+
+java_objectheader *vm_call_method(methodinfo *m, u4 count, vm_arg *vmargs);
+s4     vm_call_method_int(methodinfo *m, u4 count, vm_arg *vmargs);
+s8     vm_call_method_long(methodinfo *m, u4 count, vm_arg *vmargs);
+float  vm_call_method_float(methodinfo *m, u4 count, vm_arg *vmargs);
+double vm_call_method_double(methodinfo *m, u4 count, vm_arg *vmargs);
+
 #endif /* _VM_H */
 
 /*