* src/vm/vm.c (vm_call_method_intern): Removed.
authortwisti <none@none>
Sun, 5 Mar 2006 23:24:50 +0000 (23:24 +0000)
committertwisti <none@none>
Sun, 5 Mar 2006 23:24:50 +0000 (23:24 +0000)
(vm_vmargs_from_valist): Added.
(vm_vmargs_from_jvalue): Likewise.
(vm_call_method): New function.
(vm_call_method_valist): Likewise.
(vm_call_method_jvalue): Likewise.
(vm_call_method_vmarg): Likewise.
(vm_call_method_int): Likewise.
(vm_call_method_int_valist): Likewise.
(vm_call_method_int_jvalue): Likewise.
(vm_call_method_int_vmarg): Likewise.
(vm_call_method_long): Likewise.
(vm_call_method_long_valist): Likewise.
(vm_call_method_long_jvalue): Likewise.
(vm_call_method_long_vmarg): Likewise.
(vm_call_method_float): Likewise.
(vm_call_method_float_valist): Likewise.
(vm_call_method_float_jvalue): Likewise.
(vm_call_method_float_vmarg): Likewise.
(vm_call_method_double): Likewise.
(vm_call_method_double_valist): Likewise.
(vm_call_method_double_jvalue): Likewise.
(vm_call_method_double_vmarg): Likewise.
* src/vm/vm.h: Likewise.

* src/native/jni.c (_Jv_jni_fill_vmargs_from_vargs): Removed.
(_Jv_jni_vmargs_from_args): Likewise.
(_Jv_jni_CallObjectMethodA): New function.
(_Jv_jni_CallObjectMethod): Use vm_call_method.
(_Jv_jni_CallIntMethod): Likewise.
(_Jv_jni_CallLongMethod): Likewise.
(_Jv_jni_CallFloatMethod): Likewise.
(_Jv_jni_CallDoubleMethod): Likewise.
(_Jv_jni_CallVoidMethod): Likewise.
(_Jv_jni_CallVoidMethodA): Likewise.
(_Jv_jni_invokeNative): Likewise.
(CallObjectMethodA): Implemented.

* src/vm/loader.c (load_class_from_sysloader): Replaced
vm_call_method_intern by vm_call_method.
(load_class_from_classloader): Likewise.
* src/vm/finalizer.c (finalizer_run): Likewise.
* src/vm/initialize.c (initialize_class_intern): Likewise.
* src/vm/jit/stacktrace.c (stacktrace_inline_fillInStackTrace):
Likewise.
* src/vm/exceptions.c (throw_exception_exit_intern): Likewise.
(new_arrayindexoutofboundsexception): Likewise.
* src/vm/properties.c (properties_system_add): Likewise.
* src/cacao/cacao.c (setup_debugger_process): Likewise.
(getmainclassnamefromjar): Likewise.
(main): Likewise.
* src/native/vm/VMClassLoader.c (nativeGetResources): Likewise.
* src/native/native.c (native_new_and_init): Likewise.
(native_new_and_init_string): Likewise.
(native_new_and_init_int): Likewise.
(native_new_and_init_throwable): Likewise.
* src/threads/native/threads.c (threads_init): Likewise.
(threads_startup_thread): Likewise.
* src/cacaoh/headers.c: Likewise.

* src/vm/jit/x86_64/asmpart.S (asm_calljavafunction): Removed.
(asm_calljavafunction2): Renamed to asm_vm_call_method.
* src/vm/jit/intrp/asmpart.c: Likewise.
* src/vm/jit/asmpart.h: 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/initialize.c
src/vm/jit/asmpart.h
src/vm/jit/intrp/asmpart.c
src/vm/jit/stacktrace.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 58b4a9c9130f9d279dff83110c8f2faa29fcd185..f31918657925aa5ebe927c0aba8d6b57ff56ec7f 100644 (file)
@@ -31,7 +31,7 @@
             Philipp Tomsich
             Christian Thalinger
 
-   $Id: cacao.c 4552 2006-03-04 17:15:44Z twisti $
+   $Id: cacao.c 4559 2006-03-05 23:24:50Z twisti $
 
 */
 
@@ -110,7 +110,7 @@ static void setup_debugger_process(char* transport) {
        if (!m)
                throw_main_exception_exit();
 
-       (void) vm_call_method_intern(m, o, NULL, NULL, NULL);
+       (void) vm_call_method(m, o);
 
        /* configure(transport,NULL) */
        m = class_resolveclassmethod(
@@ -122,7 +122,7 @@ static void setup_debugger_process(char* transport) {
 
        s = javastring_new_char(transport);
 
-       (void) vm_call_method_intern(m, o, s, NULL, NULL);
+       (void) vm_call_method(m, o, s);
 
        if (!m)
                throw_main_exception_exit();
@@ -137,7 +137,7 @@ static void setup_debugger_process(char* transport) {
        if (!m)
                throw_main_exception_exit();
 
-       (void) vm_call_method_intern(m, o, NULL, NULL, NULL);
+       (void) vm_call_method(m, o);
 }
 #endif
 
@@ -179,7 +179,7 @@ static char *getmainclassnamefromjar(char *mainstring)
 
        s = javastring_new_char(mainstring);
 
-       (void) vm_call_method_intern(m, o, s, NULL, NULL);
+       (void) vm_call_method(m, o, s);
 
        if (*exceptionptr)
                throw_main_exception_exit();
@@ -195,7 +195,7 @@ static char *getmainclassnamefromjar(char *mainstring)
        if (!m)
                throw_main_exception_exit();
 
-       o = vm_call_method_intern(m, o, NULL, NULL, NULL);
+       o = vm_call_method(m, o);
 
        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();
 
-       o = vm_call_method_intern(m, o, NULL, NULL, NULL);
+       o = vm_call_method(m, o);
 
        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");
 
-       o = vm_call_method_intern(m, o, s, NULL, NULL);
+       o = vm_call_method(m, o, s);
 
        if (!o)
                throw_main_exception_exit();
@@ -432,7 +432,7 @@ int main(int argc, char **argv)
 #endif
                /* here we go... */
 
-               (void) vm_call_method_intern(m, oa, NULL, NULL, NULL);
+               (void) vm_call_method(m, NULL, oa);
 
                /* exception occurred? */
 
index 3f8b9c8e30980499b7ec60570b6a110c6fd22c75..fca1676476e505fab38fa23b69029df726c055c3 100644 (file)
@@ -30,7 +30,7 @@
             Philipp Tomsich
             Christian Thalinger
 
-   $Id: headers.c 4552 2006-03-04 17:15:44Z twisti $
+   $Id: headers.c 4559 2006-03-05 23:24:50Z twisti $
 
 */
 
@@ -97,8 +97,7 @@ 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; }
 
 
-java_objectheader *vm_call_method_intern(methodinfo *m, void *a0, void *a1,
-                                                                                void *a2, void *a3)
+java_objectheader *vm_call_method(methodinfo *m, java_objectheader *o, ...)
 { return NULL; }
 
 
index d43b716e9044556b51b99278cf69fe25f2865942..0e58a9a6176e855198b40ae4ffa9a9ad486d8ac6 100644 (file)
@@ -32,7 +32,7 @@
             Christian Thalinger
                        Edwin Steiner
 
-   $Id: jni.c 4552 2006-03-04 17:15:44Z twisti $
+   $Id: jni.c 4559 2006-03-05 23:24:50Z twisti $
 
 */
 
@@ -231,75 +231,6 @@ bool jni_init(void)
 }
 
 
-/* _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;
-
-       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 (; i < descr->paramcount; i++, paramtypes++) {
-               switch (paramtypes->decltype) {
-               /* primitive types */
-               case PRIMITIVETYPE_BYTE:
-               case PRIMITIVETYPE_CHAR:
-               case PRIMITIVETYPE_SHORT: 
-               case PRIMITIVETYPE_BOOLEAN: 
-               case PRIMITIVETYPE_INT:
-                       vmargs[i].type = TYPE_INT;
-                       vmargs[i].data = (s8) va_arg(ap, s4);
-                       break;
-
-               case PRIMITIVETYPE_LONG:
-                       vmargs[i].type = TYPE_LNG;
-                       vmargs[i].data = (s8) va_arg(ap, s8);
-                       break;
-
-               case PRIMITIVETYPE_FLOAT:
-                       vmargs[i].type = TYPE_FLT;
-#if defined(__ALPHA__)
-                       /* this keeps the assembler function much simpler */
-
-                       *((jdouble *) (&vmargs[i].data)) = (jdouble) va_arg(ap, jdouble);
-#else
-                       *((jfloat *) (&vmargs[i].data)) = (jfloat) va_arg(ap, jdouble);
-#endif
-                       break;
-
-               case PRIMITIVETYPE_DOUBLE:
-                       vmargs[i].type = TYPE_DBL;
-                       *((jdouble *) (&vmargs[i].data)) = (jdouble) va_arg(ap, jdouble);
-                       break;
-
-               case TYPE_ADR: 
-                       vmargs[i].type = TYPE_ADR;
-                       vmargs[i].data = (u8) (ptrint) va_arg(ap, void*);
-                       break;
-               }
-       }
-}
-
-
 /* _Jv_jni_vmargs_from_objectarray *********************************************
 
    XXX
@@ -464,91 +395,65 @@ illegal_arg:
 }
 
 
-/* _Jv_jni_vmargs_from_objectarray *********************************************
+/* _Jv_jni_CallObjectMethod ****************************************************
 
-   XXX
+   Internal function to call Java Object methods.
 
 *******************************************************************************/
 
-static void _Jv_jni_vmargs_from_args(java_objectheader *o, methoddesc *descr,
-                                                                        vm_arg *vmargs, jvalue *args)
+static java_objectheader *_Jv_jni_CallObjectMethod(java_objectheader *o,
+                                                                                                  vftbl_t *vftbl,
+                                                                                                  methodinfo *m, va_list ap)
 {
-       typedesc *paramtypes;
-       s4        i;
-       s4        j;
+       methodinfo        *resm;
+       java_objectheader *ro;
 
-       paramtypes = descr->paramtypes;
+       STATISTICS(jniinvokation());
 
-       /* if method is non-static fill first block and skip `this' pointer */
+       if (m == NULL) {
+               exceptions_throw_nullpointerexception();
+               return NULL;
+       }
 
-       i = 0;
+       /* Class initialization is done by the JIT compiler.  This is ok
+          since a static method always belongs to the declaring class. */
 
-       if (o != NULL) {
-               /* the `this' pointer */
-               vmargs[0].type = TYPE_ADR;
-               vmargs[0].data = (u8) (ptrint) o;
+       if (m->flags & ACC_STATIC) {
+               /* For static methods we reset the object. */
 
-               paramtypes++;
-               i++;
-       } 
+               if (o != NULL)
+                       o = NULL;
 
-       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;
+               /* for convenience */
 
-               case PRIMITIVETYPE_LONG:
-                       vmargs[i].type = TYPE_LNG;
-                       vmargs[i].data = (s8) args[j].j;
-                       break;
+               resm = m;
 
-               case PRIMITIVETYPE_FLOAT:
-                       vmargs[i].type = TYPE_FLT;
-#if defined(__ALPHA__)
-                       /* this keeps the assembler function much simpler */
+       } else {
+               /* For instance methods we make a virtual function table lookup. */
 
-                       *((jdouble *) (&vmargs[i].data)) = (jdouble) args[j].f;
-#else
-                       *((jfloat *) (&vmargs[i].data)) = args[j].f;
-#endif
-                       break;
+               resm = method_vftbl_lookup(vftbl, m);
+       }
 
-               case PRIMITIVETYPE_DOUBLE:
-                       vmargs[i].type = TYPE_DBL;
-                       *((jdouble *) (&vmargs[i].data)) = args[j].d;
-                       break;
+       STATISTICS(jnicallXmethodnvokation());
 
-               case TYPE_ADR: 
-                       vmargs[i].type = TYPE_ADR;
-                       vmargs[i].data = (u8) (ptrint) args[j].l;
-                       break;
-               }
-       }
+       ro = vm_call_method_valist(resm, o, ap);
+
+       return ro;
 }
 
 
-/* _Jv_jni_CallObjectMethod ****************************************************
+/* _Jv_jni_CallObjectMethod***************************************************
 
    Internal function to call Java Object methods.
 
 *******************************************************************************/
 
-static java_objectheader *_Jv_jni_CallObjectMethod(java_objectheader *o,
-                                                                                                  vftbl_t *vftbl,
-                                                                                                  methodinfo *m, va_list ap)
+static java_objectheader *_Jv_jni_CallObjectMethodA(java_objectheader *o,
+                                                                                                       vftbl_t *vftbl,
+                                                                                                       methodinfo *m, jvalue *args)
 {
        methodinfo        *resm;
-       s4                 paramcount;
-       vm_arg            *vmargs;
-       java_objectheader *ret;
-       s4                 dumpsize;
+       java_objectheader *ro;
 
        STATISTICS(jniinvokation());
 
@@ -576,25 +481,11 @@ static java_objectheader *_Jv_jni_CallObjectMethod(java_objectheader *o,
                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_vargs(o, resm->parseddesc, vmargs, ap);
-
        STATISTICS(jnicallXmethodnvokation());
 
-       ret = vm_call_method(resm, paramcount, vmargs);
-
-       /* release dump area */
-
-       dump_release(dumpsize);
+       ro = vm_call_method_jvalue(resm, o, args);
 
-       return ret;
+       return ro;
 }
 
 
@@ -606,13 +497,10 @@ 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 *m, va_list ap)
 {
        methodinfo *resm;
-       s4          paramcount;
-       vm_arg     *vmargs;
-       jint        ret;
-       s4          dumpsize;
+       jint        i;
 
        STATISTICS(jniinvokation());
 
@@ -640,25 +528,11 @@ static jint _Jv_jni_CallIntMethod(java_objectheader *o, vftbl_t *vftbl,
                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_vargs(o, resm->parseddesc, vmargs, ap);
-
        STATISTICS(jnicallXmethodnvokation());
 
-       ret = vm_call_method_int(resm, paramcount, vmargs);
+       i = vm_call_method_int_valist(resm, o, ap);
 
-       /* release dump area */
-
-       dump_release(dumpsize);
-
-       return ret;
+       return i;
 }
 
 
@@ -672,10 +546,7 @@ static jlong _Jv_jni_CallLongMethod(java_objectheader *o, vftbl_t *vftbl,
                                                                        methodinfo *m, va_list ap)
 {
        methodinfo *resm;
-       s4          paramcount;
-       vm_arg     *vmargs;
-       jlong       ret;
-       s4          dumpsize;
+       jlong       l;
 
        STATISTICS(jniinvokation());
 
@@ -703,25 +574,11 @@ static jlong _Jv_jni_CallLongMethod(java_objectheader *o, vftbl_t *vftbl,
                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_vargs(o, resm->parseddesc, vmargs, ap);
-
        STATISTICS(jnicallXmethodnvokation());
 
-       ret = vm_call_method_long(resm, paramcount, vmargs);
-
-       /* release dump area */
+       l = vm_call_method_long_valist(resm, o, ap);
 
-       dump_release(dumpsize);
-
-       return ret;
+       return l;
 }
 
 
@@ -735,10 +592,7 @@ static jfloat _Jv_jni_CallFloatMethod(java_objectheader *o, vftbl_t *vftbl,
                                                                          methodinfo *m, va_list ap)
 {
        methodinfo *resm;
-       s4          paramcount;
-       vm_arg     *vmargs;
-       jdouble     ret;
-       s4          dumpsize;
+       jfloat      f;
 
        /* Class initialization is done by the JIT compiler.  This is ok
           since a static method always belongs to the declaring class. */
@@ -759,25 +613,11 @@ static jfloat _Jv_jni_CallFloatMethod(java_objectheader *o, vftbl_t *vftbl,
                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_vargs(o, resm->parseddesc, vmargs, ap);
-
        STATISTICS(jnicallXmethodnvokation());
 
-       ret = vm_call_method_float(resm, paramcount, vmargs);
-
-       /* release dump area */
-
-       dump_release(dumpsize);
+       f = vm_call_method_float_valist(resm, o, ap);
 
-       return ret;
+       return f;
 }
 
 
@@ -791,10 +631,7 @@ static jdouble _Jv_jni_CallDoubleMethod(java_objectheader *o, vftbl_t *vftbl,
                                                                                methodinfo *m, va_list ap)
 {
        methodinfo *resm;
-       s4          paramcount;
-       vm_arg     *vmargs;
-       jfloat      ret;
-       s4          dumpsize;
+       jdouble     d;
 
        /* Class initialization is done by the JIT compiler.  This is ok
           since a static method always belongs to the declaring class. */
@@ -815,25 +652,9 @@ static jdouble _Jv_jni_CallDoubleMethod(java_objectheader *o, vftbl_t *vftbl,
                resm = method_vftbl_lookup(vftbl, m);
        }
 
-       /* mark start of dump memory area */
-
-       dumpsize = dump_size();
-
-       paramcount = resm->parseddesc->paramcount;
-
-       vmargs = DMNEW(vm_arg, paramcount);
+       d = vm_call_method_double_valist(resm, o, ap);
 
-       _Jv_jni_vmargs_from_vargs(o, resm->parseddesc, vmargs, ap);
-
-       STATISTICS(jnicallXmethodnvokation());
-
-       ret = vm_call_method_double(resm, paramcount, vmargs);
-
-       /* release dump area */
-
-       dump_release(dumpsize);
-
-       return ret;
+       return d;
 }
 
 
@@ -847,9 +668,6 @@ static void _Jv_jni_CallVoidMethod(java_objectheader *o, vftbl_t *vftbl,
                                                                   methodinfo *m, va_list ap)
 {      
        methodinfo *resm;
-       s4          paramcount;
-       vm_arg     *vmargs;
-       s4          dumpsize;
 
        if (m == NULL) {
                exceptions_throw_nullpointerexception();
@@ -875,23 +693,9 @@ static void _Jv_jni_CallVoidMethod(java_objectheader *o, vftbl_t *vftbl,
                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_vargs(o, resm->parseddesc, vmargs, ap);
-
        STATISTICS(jnicallXmethodnvokation());
 
-       (void) vm_call_method(resm, paramcount, vmargs);
-
-       /* release dump area */
-
-       dump_release(dumpsize);
+       (void) vm_call_method_valist(resm, o, ap);
 }
 
 
@@ -905,9 +709,6 @@ 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();
@@ -933,23 +734,9 @@ static void _Jv_jni_CallVoidMethodA(java_objectheader *o, vftbl_t *vftbl,
                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 */
-
-       dump_release(dumpsize);
+       (void) vm_call_method_jvalue(resm, o, args);
 }
 
 
@@ -1036,7 +823,7 @@ java_objectheader *_Jv_jni_invokeNative(methodinfo *m, java_objectheader *o,
 
        switch (resm->parseddesc->returntype.decltype) {
        case TYPE_VOID:
-               (void) vm_call_method(resm, argcount, vmargs);
+               (void) vm_call_method_vmarg(resm, argcount, vmargs);
 
                ro = NULL;
                break;
@@ -1045,7 +832,7 @@ java_objectheader *_Jv_jni_invokeNative(methodinfo *m, java_objectheader *o,
                s4 i;
                java_lang_Boolean *bo;
 
-               i = vm_call_method_int(resm, argcount, vmargs);
+               i = vm_call_method_int_vmarg(resm, argcount, vmargs);
 
                ro = builtin_new(class_java_lang_Boolean);
 
@@ -1060,7 +847,7 @@ java_objectheader *_Jv_jni_invokeNative(methodinfo *m, java_objectheader *o,
                s4 i;
                java_lang_Byte *bo;
 
-               i = vm_call_method_int(resm, argcount, vmargs);
+               i = vm_call_method_int_vmarg(resm, argcount, vmargs);
 
                ro = builtin_new(class_java_lang_Byte);
 
@@ -1075,7 +862,7 @@ java_objectheader *_Jv_jni_invokeNative(methodinfo *m, java_objectheader *o,
                s4 i;
                java_lang_Character *co;
 
-               i = vm_call_method_int(resm, argcount, vmargs);
+               i = vm_call_method_int_vmarg(resm, argcount, vmargs);
 
                ro = builtin_new(class_java_lang_Character);
 
@@ -1090,7 +877,7 @@ java_objectheader *_Jv_jni_invokeNative(methodinfo *m, java_objectheader *o,
                s4 i;
                java_lang_Short *so;
 
-               i = vm_call_method_int(resm, argcount, vmargs);
+               i = vm_call_method_int_vmarg(resm, argcount, vmargs);
 
                ro = builtin_new(class_java_lang_Short);
 
@@ -1105,7 +892,7 @@ java_objectheader *_Jv_jni_invokeNative(methodinfo *m, java_objectheader *o,
                s4 i;
                java_lang_Integer *io;
 
-               i = vm_call_method_int(resm, argcount, vmargs);
+               i = vm_call_method_int_vmarg(resm, argcount, vmargs);
 
                ro = builtin_new(class_java_lang_Integer);
 
@@ -1120,7 +907,7 @@ java_objectheader *_Jv_jni_invokeNative(methodinfo *m, java_objectheader *o,
                s8 l;
                java_lang_Long *lo;
 
-               l = vm_call_method_long(resm, argcount, vmargs);
+               l = vm_call_method_long_vmarg(resm, argcount, vmargs);
 
                ro = builtin_new(class_java_lang_Long);
 
@@ -1135,7 +922,7 @@ java_objectheader *_Jv_jni_invokeNative(methodinfo *m, java_objectheader *o,
                float f;
                java_lang_Float *fo;
 
-               f = vm_call_method_float(resm, argcount, vmargs);
+               f = vm_call_method_float_vmarg(resm, argcount, vmargs);
 
                ro = builtin_new(class_java_lang_Float);
 
@@ -1150,7 +937,7 @@ java_objectheader *_Jv_jni_invokeNative(methodinfo *m, java_objectheader *o,
                double d;
                java_lang_Double *_do;
 
-               d = vm_call_method_double(resm, argcount, vmargs);
+               d = vm_call_method_double_vmarg(resm, argcount, vmargs);
 
                ro = builtin_new(class_java_lang_Double);
 
@@ -1162,7 +949,7 @@ java_objectheader *_Jv_jni_invokeNative(methodinfo *m, java_objectheader *o,
        break;
 
        case TYPE_ADR:
-               ro = vm_call_method(resm, argcount, vmargs);
+               ro = vm_call_method_vmarg(resm, argcount, vmargs);
                break;
 
        default:
@@ -1449,7 +1236,7 @@ void ExceptionDescribe(JNIEnv *env)
 
                /* print the stacktrace */
 
-               (void) vm_call_method_intern(m, e, NULL, NULL, NULL);
+               (void) vm_call_method(m, e);
        }
 }
 
@@ -2022,11 +1809,18 @@ jobject CallObjectMethodV(JNIEnv *env, jobject obj, jmethodID methodID, va_list
 }
 
 
-jobject CallObjectMethodA(JNIEnv *env, jobject obj, jmethodID methodID, jvalue * args)
+jobject CallObjectMethodA(JNIEnv *env, jobject obj, jmethodID methodID, jvalue *args)
 {
-       log_text("JNI-Call: CallObjectMethodA: IMPLEMENT ME!");
+       java_objectheader *o;
+       methodinfo        *m;
+       java_objectheader *ret;
 
-       return NewLocalRef(env, NULL);
+       o = (java_objectheader *) obj;
+       m = (methodinfo *) methodID;
+
+       ret = _Jv_jni_CallObjectMethodA(o, o->vftbl, m, args);
+
+       return NewLocalRef(env, ret);
 }
 
 
@@ -2041,7 +1835,7 @@ jboolean CallBooleanMethod(JNIEnv *env, jobject obj, jmethodID methodID, ...)
        m = (methodinfo *) methodID;
 
        va_start(ap, methodID);
-       b = _Jv_jni_CallIntMethod(o, o->vftbl, m, ap, PRIMITIVETYPE_BOOLEAN);
+       b = _Jv_jni_CallIntMethod(o, o->vftbl, m, ap);
        va_end(ap);
 
        return b;
@@ -2057,7 +1851,7 @@ jboolean CallBooleanMethodV(JNIEnv *env, jobject obj, jmethodID methodID, va_lis
        o = (java_objectheader *) obj;
        m = (methodinfo *) methodID;
 
-       b = _Jv_jni_CallIntMethod(o, o->vftbl, m, args, PRIMITIVETYPE_BOOLEAN);
+       b = _Jv_jni_CallIntMethod(o, o->vftbl, m, args);
 
        return b;
 }
@@ -2082,7 +1876,7 @@ jbyte CallByteMethod(JNIEnv *env, jobject obj, jmethodID methodID, ...)
        m = (methodinfo *) methodID;
 
        va_start(ap, methodID);
-       b = _Jv_jni_CallIntMethod(o, o->vftbl, m, ap, PRIMITIVETYPE_BYTE);
+       b = _Jv_jni_CallIntMethod(o, o->vftbl, m, ap);
        va_end(ap);
 
        return b;
@@ -2098,7 +1892,7 @@ jbyte CallByteMethodV(JNIEnv *env, jobject obj, jmethodID methodID, va_list args
        o = (java_objectheader *) obj;
        m = (methodinfo *) methodID;
 
-       b = _Jv_jni_CallIntMethod(o, o->vftbl, m, args, PRIMITIVETYPE_BYTE);
+       b = _Jv_jni_CallIntMethod(o, o->vftbl, m, args);
 
        return b;
 }
@@ -2123,7 +1917,7 @@ jchar CallCharMethod(JNIEnv *env, jobject obj, jmethodID methodID, ...)
        m = (methodinfo *) methodID;
 
        va_start(ap, methodID);
-       c = _Jv_jni_CallIntMethod(o, o->vftbl, m, ap, PRIMITIVETYPE_CHAR);
+       c = _Jv_jni_CallIntMethod(o, o->vftbl, m, ap);
        va_end(ap);
 
        return c;
@@ -2139,7 +1933,7 @@ jchar CallCharMethodV(JNIEnv *env, jobject obj, jmethodID methodID, va_list args
        o = (java_objectheader *) obj;
        m = (methodinfo *) methodID;
 
-       c = _Jv_jni_CallIntMethod(o, o->vftbl, m, args, PRIMITIVETYPE_CHAR);
+       c = _Jv_jni_CallIntMethod(o, o->vftbl, m, args);
 
        return c;
 }
@@ -2164,7 +1958,7 @@ jshort CallShortMethod(JNIEnv *env, jobject obj, jmethodID methodID, ...)
        m = (methodinfo *) methodID;
 
        va_start(ap, methodID);
-       s = _Jv_jni_CallIntMethod(o, o->vftbl, m, ap, PRIMITIVETYPE_SHORT);
+       s = _Jv_jni_CallIntMethod(o, o->vftbl, m, ap);
        va_end(ap);
 
        return s;
@@ -2180,7 +1974,7 @@ jshort CallShortMethodV(JNIEnv *env, jobject obj, jmethodID methodID, va_list ar
        o = (java_objectheader *) obj;
        m = (methodinfo *) methodID;
 
-       s = _Jv_jni_CallIntMethod(o, o->vftbl, m, args, PRIMITIVETYPE_SHORT);
+       s = _Jv_jni_CallIntMethod(o, o->vftbl, m, args);
 
        return s;
 }
@@ -2206,7 +2000,7 @@ jint CallIntMethod(JNIEnv *env, jobject obj, jmethodID methodID, ...)
        m = (methodinfo *) methodID;
 
        va_start(ap, methodID);
-       i = _Jv_jni_CallIntMethod(o, o->vftbl, m, ap, PRIMITIVETYPE_INT);
+       i = _Jv_jni_CallIntMethod(o, o->vftbl, m, ap);
        va_end(ap);
 
        return i;
@@ -2222,7 +2016,7 @@ jint CallIntMethodV(JNIEnv *env, jobject obj, jmethodID methodID, va_list args)
        o = (java_objectheader *) obj;
        m = (methodinfo *) methodID;
 
-       i = _Jv_jni_CallIntMethod(o, o->vftbl, m, args, PRIMITIVETYPE_INT);
+       i = _Jv_jni_CallIntMethod(o, o->vftbl, m, args);
 
        return i;
 }
@@ -2462,7 +2256,7 @@ jboolean CallNonvirtualBooleanMethod(JNIEnv *env, jobject obj, jclass clazz, jme
        m = (methodinfo *) methodID;
 
        va_start(ap, methodID);
-       b = _Jv_jni_CallIntMethod(o, c->vftbl, m, ap, PRIMITIVETYPE_BOOLEAN);
+       b = _Jv_jni_CallIntMethod(o, c->vftbl, m, ap);
        va_end(ap);
 
        return b;
@@ -2480,7 +2274,7 @@ jboolean CallNonvirtualBooleanMethodV(JNIEnv *env, jobject obj, jclass clazz, jm
        c = (classinfo *) clazz;
        m = (methodinfo *) methodID;
 
-       b = _Jv_jni_CallIntMethod(o, c->vftbl, m, args, PRIMITIVETYPE_BOOLEAN);
+       b = _Jv_jni_CallIntMethod(o, c->vftbl, m, args);
 
        return b;
 }
@@ -2507,7 +2301,7 @@ jbyte CallNonvirtualByteMethod(JNIEnv *env, jobject obj, jclass clazz, jmethodID
        m = (methodinfo *) methodID;
 
        va_start(ap, methodID);
-       b = _Jv_jni_CallIntMethod(o, c->vftbl, m, ap, PRIMITIVETYPE_BYTE);
+       b = _Jv_jni_CallIntMethod(o, c->vftbl, m, ap);
        va_end(ap);
 
        return b;
@@ -2525,7 +2319,7 @@ jbyte CallNonvirtualByteMethodV(JNIEnv *env, jobject obj, jclass clazz, jmethodI
        c = (classinfo *) clazz;
        m = (methodinfo *) methodID;
 
-       b = _Jv_jni_CallIntMethod(o, c->vftbl, m, args, PRIMITIVETYPE_BYTE);
+       b = _Jv_jni_CallIntMethod(o, c->vftbl, m, args);
 
        return b;
 }
@@ -2553,7 +2347,7 @@ jchar CallNonvirtualCharMethod(JNIEnv *env, jobject obj, jclass clazz, jmethodID
        m = (methodinfo *) methodID;
 
        va_start(ap, methodID);
-       ch = _Jv_jni_CallIntMethod(o, c->vftbl, m, ap, PRIMITIVETYPE_CHAR);
+       ch = _Jv_jni_CallIntMethod(o, c->vftbl, m, ap);
        va_end(ap);
 
        return ch;
@@ -2571,7 +2365,7 @@ jchar CallNonvirtualCharMethodV(JNIEnv *env, jobject obj, jclass clazz, jmethodI
        c = (classinfo *) clazz;
        m = (methodinfo *) methodID;
 
-       ch = _Jv_jni_CallIntMethod(o, c->vftbl, m, args, PRIMITIVETYPE_CHAR);
+       ch = _Jv_jni_CallIntMethod(o, c->vftbl, m, args);
 
        return ch;
 }
@@ -2599,7 +2393,7 @@ jshort CallNonvirtualShortMethod(JNIEnv *env, jobject obj, jclass clazz, jmethod
        m = (methodinfo *) methodID;
 
        va_start(ap, methodID);
-       s = _Jv_jni_CallIntMethod(o, c->vftbl, m, ap, PRIMITIVETYPE_SHORT);
+       s = _Jv_jni_CallIntMethod(o, c->vftbl, m, ap);
        va_end(ap);
 
        return s;
@@ -2617,7 +2411,7 @@ jshort CallNonvirtualShortMethodV(JNIEnv *env, jobject obj, jclass clazz, jmetho
        c = (classinfo *) clazz;
        m = (methodinfo *) methodID;
 
-       s = _Jv_jni_CallIntMethod(o, c->vftbl, m, args, PRIMITIVETYPE_SHORT);
+       s = _Jv_jni_CallIntMethod(o, c->vftbl, m, args);
 
        return s;
 }
@@ -2645,7 +2439,7 @@ jint CallNonvirtualIntMethod(JNIEnv *env, jobject obj, jclass clazz, jmethodID m
        m = (methodinfo *) methodID;
 
        va_start(ap, methodID);
-       i = _Jv_jni_CallIntMethod(o, c->vftbl, m, ap, PRIMITIVETYPE_INT);
+       i = _Jv_jni_CallIntMethod(o, c->vftbl, m, ap);
        va_end(ap);
 
        return i;
@@ -2663,7 +2457,7 @@ jint CallNonvirtualIntMethodV(JNIEnv *env, jobject obj, jclass clazz, jmethodID
        c = (classinfo *) clazz;
        m = (methodinfo *) methodID;
 
-       i = _Jv_jni_CallIntMethod(o, c->vftbl, m, args, PRIMITIVETYPE_INT);
+       i = _Jv_jni_CallIntMethod(o, c->vftbl, m, args);
 
        return i;
 }
@@ -3188,7 +2982,7 @@ jboolean CallStaticBooleanMethod(JNIEnv *env, jclass clazz, jmethodID methodID,
        m = (methodinfo *) methodID;
 
        va_start(ap, methodID);
-       b = _Jv_jni_CallIntMethod(NULL, NULL, m, ap, PRIMITIVETYPE_BOOLEAN);
+       b = _Jv_jni_CallIntMethod(NULL, NULL, m, ap);
        va_end(ap);
 
        return b;
@@ -3202,7 +2996,7 @@ jboolean CallStaticBooleanMethodV(JNIEnv *env, jclass clazz, jmethodID methodID,
 
        m = (methodinfo *) methodID;
 
-       b = _Jv_jni_CallIntMethod(NULL, NULL, m, args, PRIMITIVETYPE_BOOLEAN);
+       b = _Jv_jni_CallIntMethod(NULL, NULL, m, args);
 
        return b;
 }
@@ -3225,7 +3019,7 @@ jbyte CallStaticByteMethod(JNIEnv *env, jclass clazz, jmethodID methodID, ...)
        m = (methodinfo *) methodID;
 
        va_start(ap, methodID);
-       b = _Jv_jni_CallIntMethod(NULL, NULL, m, ap, PRIMITIVETYPE_BYTE);
+       b = _Jv_jni_CallIntMethod(NULL, NULL, m, ap);
        va_end(ap);
 
        return b;
@@ -3239,7 +3033,7 @@ jbyte CallStaticByteMethodV(JNIEnv *env, jclass clazz, jmethodID methodID, va_li
 
        m = (methodinfo *) methodID;
 
-       b = _Jv_jni_CallIntMethod(NULL, NULL, m, args, PRIMITIVETYPE_BYTE);
+       b = _Jv_jni_CallIntMethod(NULL, NULL, m, args);
 
        return b;
 }
@@ -3262,7 +3056,7 @@ jchar CallStaticCharMethod(JNIEnv *env, jclass clazz, jmethodID methodID, ...)
        m = (methodinfo *) methodID;
 
        va_start(ap, methodID);
-       c = _Jv_jni_CallIntMethod(NULL, NULL, m, ap, PRIMITIVETYPE_CHAR);
+       c = _Jv_jni_CallIntMethod(NULL, NULL, m, ap);
        va_end(ap);
 
        return c;
@@ -3276,7 +3070,7 @@ jchar CallStaticCharMethodV(JNIEnv *env, jclass clazz, jmethodID methodID, va_li
 
        m = (methodinfo *) methodID;
 
-       c = _Jv_jni_CallIntMethod(NULL, NULL, m, args, PRIMITIVETYPE_CHAR);
+       c = _Jv_jni_CallIntMethod(NULL, NULL, m, args);
 
        return c;
 }
@@ -3299,7 +3093,7 @@ jshort CallStaticShortMethod(JNIEnv *env, jclass clazz, jmethodID methodID, ...)
        m = (methodinfo *) methodID;
 
        va_start(ap, methodID);
-       s = _Jv_jni_CallIntMethod(NULL, NULL, m, ap, PRIMITIVETYPE_SHORT);
+       s = _Jv_jni_CallIntMethod(NULL, NULL, m, ap);
        va_end(ap);
 
        return s;
@@ -3313,7 +3107,7 @@ jshort CallStaticShortMethodV(JNIEnv *env, jclass clazz, jmethodID methodID, va_
 
        m = (methodinfo *) methodID;
 
-       s = _Jv_jni_CallIntMethod(NULL, NULL, m, args, PRIMITIVETYPE_SHORT);
+       s = _Jv_jni_CallIntMethod(NULL, NULL, m, args);
 
        return s;
 }
@@ -3336,7 +3130,7 @@ jint CallStaticIntMethod(JNIEnv *env, jclass clazz, jmethodID methodID, ...)
        m = (methodinfo *) methodID;
 
        va_start(ap, methodID);
-       i = _Jv_jni_CallIntMethod(NULL, NULL, m, ap, PRIMITIVETYPE_INT);
+       i = _Jv_jni_CallIntMethod(NULL, NULL, m, ap);
        va_end(ap);
 
        return i;
@@ -3350,7 +3144,7 @@ jint CallStaticIntMethodV(JNIEnv *env, jclass clazz, jmethodID methodID, va_list
 
        m = (methodinfo *) methodID;
 
-       i = _Jv_jni_CallIntMethod(NULL, NULL, m, args, PRIMITIVETYPE_INT);
+       i = _Jv_jni_CallIntMethod(NULL, NULL, m, args);
 
        return i;
 }
@@ -5184,7 +4978,7 @@ jobject NewGlobalRef(JNIEnv* env, jobject lobj)
        builtin_monitorenter(*global_ref_table);
 #endif
        
-       o = vm_call_method_intern(getmid, *global_ref_table, lobj, NULL, NULL);
+       o = vm_call_method(getmid, *global_ref_table, lobj);
 
        refcount = (java_lang_Integer *) o;
 
@@ -5198,8 +4992,7 @@ jobject NewGlobalRef(JNIEnv* env, jobject lobj)
                        return NULL;
                }
 
-               (void) vm_call_method_intern(putmid, *global_ref_table, lobj, newval,
-                                                                        NULL);
+               (void) vm_call_method(putmid, *global_ref_table, lobj, newval);
 
        } else {
                /* we can access the object itself, as we are in a
@@ -5234,7 +5027,7 @@ void DeleteGlobalRef(JNIEnv* env, jobject globalRef)
        builtin_monitorenter(*global_ref_table);
 #endif
 
-       o = vm_call_method_intern(getmid, *global_ref_table, globalRef, NULL, NULL);
+       o = vm_call_method(getmid, *global_ref_table, globalRef);
 
        refcount = (java_lang_Integer *) o;
 
@@ -5249,8 +5042,7 @@ void DeleteGlobalRef(JNIEnv* env, jobject globalRef)
        val = refcount->value - 1;
 
        if (val == 0) {
-               (void) vm_call_method_intern(removemid, *global_ref_table, refcount,
-                                                                        NULL, NULL);
+               (void) vm_call_method(removemid, *global_ref_table, refcount);
 
        } else {
                /* we do not create a new object, but set the new value into
index c84345063fe876efcf7d05711a83abf53e9256c7..5ed7498e5040a3d451955e0b10cf2842e7f742c1 100644 (file)
@@ -30,7 +30,7 @@
 
    Changes: Christian Thalinger
 
-   $Id: native.c 4552 2006-03-04 17:15:44Z twisti $
+   $Id: native.c 4559 2006-03-05 23:24:50Z twisti $
 
 */
 
@@ -795,7 +795,7 @@ java_objectheader *native_new_and_init(classinfo *c)
 
        /* call initializer */
 
-       (void) vm_call_method_intern(m, o, NULL, NULL, NULL);
+       (void) vm_call_method(m, o);
 
        return o;
 }
@@ -831,7 +831,7 @@ java_objectheader *native_new_and_init_string(classinfo *c, java_lang_String *s)
 
        /* call initializer */
 
-       (void) vm_call_method_intern(m, o, s, NULL, NULL);
+       (void) vm_call_method(m, o, s);
 
        return o;
 }
@@ -863,7 +863,7 @@ java_objectheader *native_new_and_init_int(classinfo *c, s4 i)
 
        /* call initializer */
 
-       (void) vm_call_method_intern(m, o, (void *) (ptrint) i, NULL, NULL);
+       (void) vm_call_method(m, o, i);
 
        return o;
 }
@@ -895,7 +895,7 @@ java_objectheader *native_new_and_init_throwable(classinfo *c, java_lang_Throwab
 
        /* call initializer */
 
-       (void) vm_call_method_intern(m, o, t, NULL, NULL);
+       (void) vm_call_method(m, o, t);
 
        return o;
 }
index 653c5579f731daa8fd5db54d8d10c3377f385c74..78b0f1db8998c3f4b26f1aaedfd7981bb467788f 100644 (file)
@@ -30,7 +30,7 @@
             Christian Thalinger
             Edwin Steiner
 
-   $Id: VMClassLoader.c 4552 2006-03-04 17:15:44Z twisti $
+   $Id: VMClassLoader.c 4559 2006-03-05 23:24:50Z twisti $
 
 */
 
@@ -398,7 +398,7 @@ JNIEXPORT java_util_Vector* JNICALL Java_java_lang_VMClassLoader_nativeGetResour
                /* if a resource was found, add it to the vector */
 
                if (path) {
-                       ret = vm_call_method_intern_int(m, o, path, NULL, NULL);
+                       ret = vm_call_method_int(m, o, path);
 
                        if (ret == 0)
                                return NULL;
index 81684dd3e93ac6c402a52c5ff504db0772898254..b696bd3dfeca386396acd5fa2699c24bb135110c 100644 (file)
@@ -29,7 +29,7 @@
    Changes: Christian Thalinger
                        Edwin Steiner
 
-   $Id: threads.c 4552 2006-03-04 17:15:44Z twisti $
+   $Id: threads.c 4559 2006-03-05 23:24:50Z twisti $
 
 */
 
@@ -630,15 +630,13 @@ bool threads_init(u1 *stackbottom)
        if (!method)
                return false;
 
-       (void) vm_call_method_intern(method, mainthread, mainthreadobj, threadname,
-                                                                (void *) 5);
+       (void) vm_call_method(method, (java_objectheader *) mainthread,
+                                                 mainthreadobj, threadname, 5, false);
 
        if (*exceptionptr)
                return false;
 
        mainthread->group = threadgroup;
-       /* XXX This is a hack because the fourth argument was omitted */
-       mainthread->daemon = false;
 
        /* add mainthread to ThreadGroup */
 
@@ -651,7 +649,8 @@ bool threads_init(u1 *stackbottom)
        if (!method)
                return false;
 
-       (void) vm_call_method_intern(method, threadgroup, mainthread, NULL, NULL);
+       (void) vm_call_method(method, (java_objectheader *) threadgroup,
+                                                 mainthread);
 
        if (*exceptionptr)
                return false;
@@ -781,7 +780,7 @@ static void *threads_startup_thread(void *t)
                if (!method)
                        throw_exception();
 
-               (void) vm_call_method_intern(method, thread, NULL, NULL, NULL);
+               (void) vm_call_method(method, (java_objectheader *) thread);
 
        } 
        else {
index cf2c5c7c34ee28908538a87938129689f41ac1a9..ac95c1e97338b7cd491704c805a8759f3c6e1c20 100644 (file)
@@ -28,7 +28,7 @@
 
    Changes: Edwin Steiner
 
-   $Id: exceptions.c 4552 2006-03-04 17:15:44Z twisti $
+   $Id: exceptions.c 4559 2006-03-05 23:24:50Z twisti $
 
 */
 
@@ -189,7 +189,7 @@ static void throw_exception_exit_intern(bool doexit)
                /* print the stacktrace */
 
                if (pss) {
-                       (void) vm_call_method_intern(pss, xptr, NULL, NULL, NULL);
+                       (void) vm_call_method(pss, xptr);
 
                        /* This normally means, we are EXTREMLY out of memory or have a   */
                        /* serious problem while printStackTrace. But may be another      */
@@ -966,7 +966,7 @@ java_objectheader *new_arrayindexoutofboundsexception(s4 index)
        if (m == NULL)
                return *exceptionptr;
 
-       o = vm_call_method_intern(m, (void *) (ptrint) index, NULL, NULL, NULL);
+       o = vm_call_method(m, NULL, index);
 
        s = (java_lang_String *) o;
 
index 9a03be8a2040f092b50c68f9f33654a386e0b398..0c662ea2d41dc50e2c91be0f4f762ceb63572bea 100644 (file)
@@ -28,7 +28,7 @@
 
    Changes:
 
-   $Id: finalizer.c 4552 2006-03-04 17:15:44Z twisti $
+   $Id: finalizer.c 4559 2006-03-05 23:24:50Z twisti $
 
 */
 
@@ -190,11 +190,13 @@ void finalizer_notify(void)
 
 void finalizer_run(void *o, void *p)
 {
-       java_objectheader *ob = (java_objectheader *) o;
+       java_objectheader *ob;
+
+       ob = (java_objectheader *) o;
 
        /* call the finalizer function */
 
-       vm_call_method_intern(ob->vftbl->class->finalizer, ob, NULL, NULL, NULL);
+       (void) vm_call_method(ob->vftbl->class->finalizer, ob);
 
        /* if we had an exception in the finalizer, ignore it */
 
index 36a2e12089f4e004261e1dbbda55d2a01d437f56..ac3bd9d312cc1e88cd4160b534d5a31c0498793c 100644 (file)
@@ -30,7 +30,7 @@
             Andreas Krall
             Christian Thalinger
 
-   $Id: initialize.c 4552 2006-03-04 17:15:44Z twisti $
+   $Id: initialize.c 4559 2006-03-05 23:24:50Z twisti $
 
 */
 
@@ -206,7 +206,7 @@ static bool initialize_class_intern(classinfo *c)
 
        /* now call the initializer */
 
-       (void) vm_call_method_intern(m, NULL, NULL, NULL, NULL);
+       (void) vm_call_method(m, NULL);
 
 #if defined(USE_THREADS) && !defined(NATIVE_THREADS)
        assert(blockInts == 0);
index f241ed21016d0522934ff7a5f96509997bcd2cf0..6a263c224d4700e6944940bc458b588af7841154 100644 (file)
@@ -29,7 +29,7 @@
 
    Changes: Christian Thalinger
 
-   $Id: asmpart.h 4553 2006-03-04 17:19:03Z twisti $
+   $Id: asmpart.h 4559 2006-03-05 23:24:50Z twisti $
 
 */
 
@@ -109,65 +109,34 @@ void asm_sync_instruction_cache(void);
 void asm_call_jit_compiler(void);
 
 
-/* 
-   This function calls a Java-method (which possibly needs compilation)
-   with up to 4 parameters. This function calls a Java-method (which
-   possibly needs compilation) with up to 4 parameters.
-*/
-
-#if defined(ENABLE_JIT)
-java_objectheader *asm_calljavafunction(methodinfo *m,
-                                                                               void *arg1, void *arg2,
-                                                                               void *arg3, void *arg4);
-
-s4 asm_calljavafunction_int(methodinfo *m,
-                                                       void *arg1, void *arg2,
-                                                       void *arg3, void *arg4);
-#endif
-
-#if defined(ENABLE_INTRP)
-java_objectheader *intrp_asm_calljavafunction(methodinfo *m,
-                                                                                         void *arg1, void *arg2,
-                                                                                         void *arg3, void *arg4);
-
-s4 intrp_asm_calljavafunction_int(methodinfo *m,
-                                                                 void *arg1, void *arg2,
-                                                                 void *arg3, void *arg4);
-#endif
-
-
-/* 
-   This function calls a Java-method (which possibly needs compilation)
-   with up to 4 parameters. This function calls a Java-method (which
-   possibly needs compilation) with up to 4 parameters. 
-   also supports a return value
-*/
-
 #if defined(ENABLE_JIT)
-java_objectheader *asm_calljavafunction2(methodinfo *m, u4 count,
-                                                                                vm_arg *vmargs);
+java_objectheader *asm_vm_call_method(methodinfo *m, s4 vmargscount,
+                                                                         vm_arg *vmargs);
 
-s4     asm_calljavafunction2int(methodinfo *m, u4 count, vm_arg *vmargs);
-s8     asm_calljavafunction2long(methodinfo *m, u4 count, vm_arg *vmargs);
-float  asm_calljavafunction2float(methodinfo *m, u4 count, vm_arg *vmargs);
-double asm_calljavafunction2double(methodinfo *m, u4 count, vm_arg *vmargs);
+s4     asm_vm_call_method_int(methodinfo *m, s4 vmargscount, vm_arg *vmargs);
+s8     asm_vm_call_method_long(methodinfo *m, s4 vmargscount, vm_arg *vmargs);
+float  asm_vm_call_method_float(methodinfo *m, s4 vmargscount, vm_arg *vmargs);
+double asm_vm_call_method_double(methodinfo *m, s4 vmargscount, vm_arg *vmargs);
 #endif
 
 #if defined(ENABLE_INTRP)
-java_objectheader *intrp_asm_calljavafunction2(methodinfo *m, u4 count,
-                                                                                          vm_arg *vmargs);
-
-s4     intrp_asm_calljavafunction2int(methodinfo *m, u4 count, vm_arg *vmargs);
-s8     intrp_asm_calljavafunction2long(methodinfo *m, u4 count, vm_arg *vmargs);
-float  intrp_asm_calljavafunction2float(methodinfo *m, u4 count, vm_arg *vmargs);
-double intrp_asm_calljavafunction2double(methodinfo *m, u4 count, vm_arg *vmargs);
+java_objectheader *intrp_asm_vm_call_method(methodinfo *m, s4 vmargscount,
+                                                                                       vm_arg *vmargs);
+
+s4     intrp_asm_vm_call_method_int(methodinfo *m, s4 vmargscount,
+                                                                       vm_arg *vmargs);
+s8     intrp_asm_vm_call_method_long(methodinfo *m, s4 vmargscount,
+                                                                        vm_arg *vmargs);
+float  intrp_asm_vm_call_method_float(methodinfo *m, s4 vmargscount,
+                                                                         vm_arg *vmargs);
+double intrp_asm_vm_call_method_double(methodinfo *m, s4 vmargscount,
+                                                                          vm_arg *vmargs);
 #endif
 
 
 /* We need these two labels in codegen.inc to add the asm_calljavafunction*'s
    into the methodtable */
 #if defined(__I386__) || defined(__X86_64__)
-void calljava_xhandler(void);
 void calljava_xhandler2(void);
 #endif
 
index 2cba8f9261b161c5c1d8be35678e4c3ed6e23c58..e79b07c2a86abe35e8167104a565d55c4f7d9d1d 100644 (file)
@@ -29,7 +29,7 @@
 
    Changes:
 
-   $Id: asmpart.c 4550 2006-03-01 17:00:33Z twisti $
+   $Id: asmpart.c 4559 2006-03-05 23:24:50Z twisti $
 
 */
 
 #include "vm/jit/intrp/intrp.h"
 
 
-/* true on success, false on exception */
-
-static bool intrp_asm_calljavafunction_intern(methodinfo *m,
-                                                                                         void *arg1, void *arg2,
-                                                                                         void *arg3, void *arg4)
-{
-       java_objectheader *retval;
-       Cell              *sp;
-       methoddesc        *md;
-       u1                *entrypoint;
-
-       sp = global_sp;
-       md = m->parseddesc;
-
-       CLEAR_global_sp;
-       assert(sp != NULL);
-
-       /* XXX ugly hack: thread's run() needs 5 arguments */
-       assert(md->paramcount < 6);
-
-       if (md->paramcount > 0)
-               *--sp=(Cell)arg1;
-       if (md->paramcount > 1)
-               *--sp=(Cell)arg2;
-       if (md->paramcount > 2)
-               *--sp=(Cell)arg3;
-       if (md->paramcount > 3)
-               *--sp=(Cell)arg4;
-       if (md->paramcount > 4)
-               *--sp=(Cell) 0;
-
-       entrypoint = createcalljavafunction(m);
-
-       retval = engine((Inst *) entrypoint, sp, NULL);
-
-       /* XXX remove the method from the method table */
-
-       if (retval != NULL) {
-               (void) builtin_throw_exception(retval);
-               return false;
-       }
-       else 
-               return true;
-}
-
-
-java_objectheader *intrp_asm_calljavafunction(methodinfo *m,
-                                                                                         void *arg1, void *arg2,
-                                                                                         void *arg3, void *arg4)
-{
-       if (intrp_asm_calljavafunction_intern(m, arg1, arg2, arg3, arg4)) {
-               if (m->parseddesc->returntype.type == TYPE_ADR)
-                       return (java_objectheader *)(*global_sp++);
-               else {
-                       assert(m->parseddesc->returntype.type == TYPE_VOID);
-                       return NULL;
-               }
-       } else
-               return NULL;
-}
-
-
-s4 intrp_asm_calljavafunction_int(methodinfo *m, void *arg1, void *arg2,
-                                                                 void *arg3, void *arg4)
-{
-       assert(m->parseddesc->returntype.type == TYPE_INT);
-
-       if (intrp_asm_calljavafunction_intern(m, arg1, arg2, arg3, arg4))
-               return (s4) (*global_sp++);
-       else
-               return 0;
-}
-
-
-/* true on success, false on exception */
-static bool jni_invoke_java_intern(methodinfo *m, u4 count, u4 size,
-                                                                  jni_callblock *callblock)
+static bool intrp_asm_vm_call_method_intern(methodinfo *m, s4 vmargscount,
+                                                                                       vm_arg *vmargs)
 {
        java_objectheader *retval;
        Cell              *sp;
@@ -140,17 +65,17 @@ static bool jni_invoke_java_intern(methodinfo *m, u4 count, u4 size,
 
        assert(sp != NULL);
 
-       for (i = 0; i < count; i++) {
-               switch (callblock[i].itemtype) {
+       for (i = 0; i < vmargscount; i++) {
+               switch (vmargs[i].type) {
                case TYPE_INT:
                case TYPE_FLT:
                case TYPE_ADR:
-                       *(--sp) = callblock[i].item;
+                       *(--sp) = vmargs[i].data;
                        break;
                case TYPE_LNG:
                case TYPE_DBL:
                        sp -= 2;
-                       *((u8 *) sp) = callblock[i].item;
+                       *((u8 *) sp) = vmargs[i].data;
                        break;
                }
        }
@@ -170,12 +95,12 @@ static bool jni_invoke_java_intern(methodinfo *m, u4 count, u4 size,
 }
 
 
-java_objectheader *intrp_asm_calljavafunction2(methodinfo *m, u4 count, u4 size,
-                                                                                          jni_callblock *callblock)
+java_objectheader *intrp_asm_vm_call_method(methodinfo *m, s4 vmargscount,
+                                                                                       vm_arg *vmargs)
 {
        java_objectheader *retval = NULL;
 
-       if (jni_invoke_java_intern(m, count, size, callblock)) {
+       if (intrp_asm_vm_call_method_intern(m, vmargscount, vmargs)) {
                if (m->parseddesc->returntype.type == TYPE_ADR)
                        retval = (java_objectheader *)*global_sp++;
                else
@@ -186,12 +111,11 @@ java_objectheader *intrp_asm_calljavafunction2(methodinfo *m, u4 count, u4 size,
 }
 
 
-s4 intrp_asm_calljavafunction2int(methodinfo *m, u4 count, u4 size,
-                                                                 jni_callblock *callblock)
+s4 intrp_asm_vm_call_method_int(methodinfo *m, s4 vmargscount, vm_arg *vmargs)
 {
-       s4 retval=0;
+       s4 retval = 0;
 
-       if (jni_invoke_java_intern(m, count, size, callblock)) {
+       if (intrp_asm_vm_call_method_intern(m, vmargscount, vmargs)) {
                if (m->parseddesc->returntype.type == TYPE_INT)
                        retval = *global_sp++;
                else
@@ -202,14 +126,13 @@ s4 intrp_asm_calljavafunction2int(methodinfo *m, u4 count, u4 size,
 }
 
 
-s8 intrp_asm_calljavafunction2long(methodinfo *m, u4 count, u4 size,
-                                                                  jni_callblock *callblock)
+s8 intrp_asm_vm_call_method_long(methodinfo *m, s4 vmargscount, vm_arg *vmargs)
 {
        s8 retval;
 
        assert(m->parseddesc->returntype.type == TYPE_LNG);
 
-       if (jni_invoke_java_intern(m, count, size, callblock)) {
+       if (intrp_asm_vm_call_method_intern(m, vmargscount, vmargs)) {
                retval = *(s8 *)global_sp;
                global_sp += 2;
                return retval;
@@ -218,14 +141,14 @@ s8 intrp_asm_calljavafunction2long(methodinfo *m, u4 count, u4 size,
 }
 
 
-float intrp_asm_calljavafunction2float(methodinfo *m, u4 count, u4 size,
-                                                                          jni_callblock *callblock)
+float intrp_asm_vm_call_method_float(methodinfo *m, s4 vmargscount,
+                                                                        vm_arg *vmargs)
 {
        float retval;
 
        assert(m->parseddesc->returntype.type == TYPE_FLT);
 
-       if (jni_invoke_java_intern(m, count, size, callblock)) {
+       if (intrp_asm_vm_call_method_intern(m, vmargscount, vmargs)) {
                retval = *(float *)global_sp;
                global_sp += 1;
                return retval;
@@ -234,14 +157,14 @@ float intrp_asm_calljavafunction2float(methodinfo *m, u4 count, u4 size,
 }
 
 
-double intrp_asm_calljavafunction2double(methodinfo *m, u4 count, u4 size,
-                                                                                jni_callblock *callblock)
+double intrp_asm_vm_call_method_double(methodinfo *m, s4 vmargscount,
+                                                                          vm_arg *vmargs)
 {
        double retval;
 
        assert(m->parseddesc->returntype.type == TYPE_DBL);
 
-       if (jni_invoke_java_intern(m, count, size, callblock)) {
+       if (intrp_asm_vm_call_method_intern(m, vmargscount, vmargs)) {
                retval = *(double *)global_sp;
                global_sp += 2;
                return retval;
index cd4f4187340d11f792bbc2c2d13bb3aad99c0bf1..6c08437cfb1c1ab39d745fbf22fce68145e7a362 100644 (file)
@@ -29,7 +29,7 @@
    Changes: Christian Thalinger
             Edwin Steiner
 
-   $Id: stacktrace.c 4552 2006-03-04 17:15:44Z twisti $
+   $Id: stacktrace.c 4559 2006-03-05 23:24:50Z twisti $
 
 */
 
@@ -562,7 +562,7 @@ java_objectheader *stacktrace_inline_fillInStackTrace(u1 *pv, u1 *sp, u1 *ra,
 
        /* call function */
 
-       (void) vm_call_method_intern(m, o, NULL, NULL, NULL);
+       (void) vm_call_method(m, o);
 
        /* remove stackframeinfo */
 
index 47c34ad0ce64f46793112fb623b3752a7388e9c3..2cf1b3292b857a796382b5808e88b9a746bc37f3 100644 (file)
@@ -30,7 +30,7 @@
 
    Changes:
 
-   $Id: asmpart.S 4552 2006-03-04 17:15:44Z twisti $
+   $Id: asmpart.S 4559 2006-03-05 23:24:50Z twisti $
 
 */
 
 
 /* exported functions and variables *******************************************/
 
-       .globl asm_calljavafunction
-       .type  asm_calljavafunction, @function
-
-       .globl asm_calljavafunction_int
-
-       .globl asm_calljavafunction2
-       .globl asm_calljavafunction2int
-       .globl asm_calljavafunction2long
-       .globl asm_calljavafunction2float
-       .globl asm_calljavafunction2double
+       .globl asm_vm_call_method
+       .globl asm_vm_call_method_int
+       .globl asm_vm_call_method_long
+       .globl asm_vm_call_method_float
+       .globl asm_vm_call_method_double
 
        .globl asm_call_jit_compiler
        .globl asm_handle_exception
        .globl asm_getclassvalues_atomic
 
 
-/********************* function asm_calljavafunction ***************************
-*                                                                              *
-*   This function calls a Java-method (which possibly needs compilation)       *
-*   with up to 4 address parameters.                                           *
-*                                                                              *
-*   This functions calls the JIT-compiler which eventually translates the      *
-*   method into machine code.                                                  *
-*                                                                              *
-*   C-prototype:                                                               *
-*    javaobject_header *asm_calljavamethod (methodinfo *m,                     *
-*         void *arg1, void *arg2, void *arg3, void *arg4);                     *
-*                                                                              *
-*******************************************************************************/
-
-       .align  8
-
-       .quad   0                           /* catch type all                     */
-       .quad   calljava_xhandler           /* handler pc                         */
-       .quad   calljava_xhandler           /* end pc                             */
-       .quad   L_asm_calljavafunction      /* start pc                           */
-       .long   1                           /* extable size                       */
-       .long   0                                                                                                                         
-       .quad   0                           /* line number table start            */
-       .quad   0                           /* line number table size             */
-       .long   0                                                                                                                         
-       .long   0                           /* fltsave                            */
-       .long   0                           /* intsave                            */
-       .long   0                           /* isleaf                             */
-       .long   0                           /* IsSync                             */
-       .long   8                           /* frame size                         */
-       .quad   0                           /* method pointer (pointer to name)   */
-
-asm_calljavafunction:
-asm_calljavafunction_int:
-L_asm_calljavafunction:                 /* required for PIC code              */
-       sub     $(3*8),sp                   /* keep stack 16-byte aligned         */
-       mov     bp,0*8(sp)
-       mov     %rbx,1*8(sp)                /* %rbx is not a callee saved in CACAO*/
-       mov     a0,itmp1                    /* move function pointer to itmp1     */
-                                                                           /* compilerstub uses this             */
-
-       mov     a1,a0                       /* pass remaining parameters          */
-       mov     a2,a1                                                                                                                   
-       mov     a3,a2
-       mov     a4,a3
-
-       lea     L_asm_call_jit_compiler(%rip),itmp3
-       call    *itmp3                      /* call JIT compiler                  */
-
-L_asm_calljavafunction_return:
-       mov     0*8(sp),bp
-       mov             1*8(sp),%rbx                /* %rbx is not a callee saved in CACAO*/
-       add     $(3*8),sp                   /* free stack space                   */
-       ret
-
-calljava_xhandler:
-       mov     xptr,a0                     /* pass exception pointer             */
-       call    builtin_throw_exception@PLT
-       xor     v0,v0                       /* return NULL                        */
-       jmp     L_asm_calljavafunction_return
-
-
 /********************* function asm_calljavafunction ***************************
 *                                                                              *
 *   This function calls a Java-method (which possibly needs compilation)       *
@@ -162,7 +95,7 @@ calljava_xhandler:
        .quad   0                           /* catch type all                     */
        .quad   calljava_xhandler2          /* handler pc                         */
        .quad   calljava_xhandler2          /* end pc                             */
-       .quad   L_asm_calljavafunction2     /* start pc                           */
+       .quad   L_asm_vm_call_method        /* start pc                           */
        .long   1                           /* extable size                       */
        .long   0                                                                                                                        
        .quad   0                           /* line number table  start           */
@@ -175,12 +108,12 @@ calljava_xhandler:
        .long   24                          /* frame size                         */
        .quad   0                           /* method pointer (pointer to name)   */
 
-asm_calljavafunction2:
-asm_calljavafunction2int:
-asm_calljavafunction2long:
-asm_calljavafunction2float:
-asm_calljavafunction2double:
-L_asm_calljavafunction2:                /* required for PIC code              */
+asm_vm_call_method:
+asm_vm_call_method_int:
+asm_vm_call_method_long:
+asm_vm_call_method_float:
+asm_vm_call_method_double:
+L_asm_vm_call_method:                   /* required for PIC code              */
        sub     $(7*8),sp                   /* keep stack 16-byte aligned         */
        mov     %rbx,0*8(sp)                /* %rbx is not a callee saved in cacao*/
        mov     s0,1*8(sp)
@@ -272,7 +205,7 @@ L_copy_done:
 
        add     bp,sp                       /* remove argument stack frame if any */
 
-L_asm_calljavafunction2_return:
+L_asm_vm_call_method_return:
        mov     0*8(sp),%rbx                /* restore callee saved registers     */
        mov     1*8(sp),s0
        mov     2*8(sp),s1
@@ -286,7 +219,7 @@ calljava_xhandler2:
        mov     xptr,a0                     /* pass exception pointer             */
        call    builtin_throw_exception@PLT
        xor     v0,v0                       /* return NULL                        */
-       jmp     L_asm_calljavafunction2_return
+       jmp     L_asm_vm_call_method_return
 
 
 jumptable_integer:
index 68b5c8ea0d020767e2e2abd1fc63b16d98a58f54..95a200f6df1147a67db0bd2d678b9b098f638e2a 100644 (file)
@@ -32,7 +32,7 @@
             Edwin Steiner
             Christian Thalinger
 
-   $Id: loader.c 4552 2006-03-04 17:15:44Z twisti $
+   $Id: loader.c 4559 2006-03-05 23:24:50Z twisti $
 
 */
 
@@ -1424,7 +1424,7 @@ classinfo *load_class_from_sysloader(utf *name)
        if (!m)
                return false;
 
-       cl = vm_call_method_intern(m, NULL, NULL, NULL, NULL);
+       cl = vm_call_method(m, NULL);
 
        if (!cl)
                return false;
@@ -1553,7 +1553,7 @@ classinfo *load_class_from_classloader(utf *name, java_objectheader *cl)
 
                s = javastring_new_slash_to_dot(name);
 
-               o = vm_call_method_intern(lc, cl, s, NULL, NULL);
+               o = vm_call_method(lc, cl, s);
 
                c = (classinfo *) o;
 
index fb91c9cb87be2ee22ef71857fbfbf2c76f7cd1bf..86e9e97925619bb2bd46c355a3af983b5bb3e295 100644 (file)
@@ -28,7 +28,7 @@
 
    Changes:
 
-   $Id: properties.c 4552 2006-03-04 17:15:44Z twisti $
+   $Id: properties.c 4559 2006-03-05 23:24:50Z twisti $
 
 */
 
@@ -169,7 +169,7 @@ void properties_system_add(char *key, char *value)
        k = javastring_new_char(key);
        v = javastring_new_char(value);
 
-       (void) vm_call_method_intern(mput, psystem, k, v, NULL);
+       (void) vm_call_method(mput, (java_objectheader *) psystem, k, v);
 }
 
 
index 8095558656b274cb563ba7eb8ea78f31c5d542fe..e213786ec442680e86ad4248b3b6ac5fff3f57dd 100644 (file)
@@ -1202,7 +1202,7 @@ void vm_exit(s4 status)
 
        /* call the exit function with passed exit status */
 
-       (void) vm_call_method_intern(m, (void *) (ptrint) status, NULL, NULL, NULL);
+       (void) vm_call_method(m, NULL, (void *) (ptrint) status);
 
        /* this should never happen */
 
@@ -1288,57 +1288,142 @@ void vm_exit_handler(void)
 }
 
 
-/* vm_call_method_intern *******************************************************
+/* vm_vmargs_from_valist *******************************************************
 
-   Calls a Java method with a fixed number of arguments (namely 4) and
-   returns an address.
+   XXX
 
 *******************************************************************************/
 
-java_objectheader *vm_call_method_intern(methodinfo *m, void *a0, void *a1,
-                                                                                void *a2, void *a3)
+static void vm_vmargs_from_valist(methodinfo *m, java_objectheader *o,
+                                                                 vm_arg *vmargs, va_list ap)
 {
-       java_objectheader *o;
+       typedesc *paramtypes;
+       s4        i;
+
+       paramtypes = m->parseddesc->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 (; i < m->parseddesc->paramcount; i++, 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) va_arg(ap, s4);
+                       break;
 
-#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);
+               case PRIMITIVETYPE_LONG:
+                       vmargs[i].type = TYPE_LNG;
+                       vmargs[i].data = (s8) va_arg(ap, s8);
+                       break;
+
+               case PRIMITIVETYPE_FLOAT:
+                       vmargs[i].type = TYPE_FLT;
+#if defined(__ALPHA__)
+                       /* this keeps the assembler function much simpler */
+
+                       *((jdouble *) (&vmargs[i].data)) = (jdouble) va_arg(ap, jdouble);
 #else
-       o = intrp_asm_calljavafunction(m, a0, a1, a2, a3);
+                       *((jfloat *) (&vmargs[i].data)) = (jfloat) va_arg(ap, jdouble);
 #endif
+                       break;
 
-       return o;
+               case PRIMITIVETYPE_DOUBLE:
+                       vmargs[i].type = TYPE_DBL;
+                       *((jdouble *) (&vmargs[i].data)) = (jdouble) va_arg(ap, jdouble);
+                       break;
+
+               case TYPE_ADR: 
+                       vmargs[i].type = TYPE_ADR;
+                       vmargs[i].data = (u8) (ptrint) va_arg(ap, void*);
+                       break;
+               }
+       }
 }
 
 
-/* vm_call_method_intern_int ***************************************************
+/* vm_vmargs_from_jvalue *******************************************************
 
-   Calls a Java method with a fixed number of arguments (namely 4) and
-   returns an integer (s4).
+   XXX
 
 *******************************************************************************/
 
-s4 vm_call_method_intern_int(methodinfo *m, void *a0, void *a1, void *a2,
-                                                        void *a3)
+static void vm_vmargs_from_jvalue(methodinfo *m, java_objectheader *o,
+                                                                 vm_arg *vmargs, jvalue *args)
 {
-       s4 i;
+       typedesc *paramtypes;
+       s4        i;
+       s4        j;
+
+       paramtypes = m->parseddesc->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 < m->parseddesc->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;
 
-#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);
+               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
-       i = intrp_asm_calljavafunction_int(m, a0, a1, a2, a3);
+                       *((jfloat *) (&vmargs[i].data)) = args[j].f;
 #endif
+                       break;
 
-       return i;
+               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;
+               }
+       }
 }
 
 
@@ -1349,19 +1434,126 @@ s4 vm_call_method_intern_int(methodinfo *m, void *a0, void *a1, void *a2,
 
 *******************************************************************************/
 
-java_objectheader *vm_call_method(methodinfo *m, u4 count, vm_arg *vmargs)
+java_objectheader *vm_call_method(methodinfo *m, java_objectheader *o, ...)
+{
+       va_list            ap;
+       java_objectheader *ro;
+
+       va_start(ap, o);
+       ro = vm_call_method_valist(m, o, ap);
+       va_end(ap);
+
+       return ro;
+}
+
+
+/* vm_call_method_valist *******************************************************
+
+   Calls a Java method with a variable number of arguments, passed via
+   a va_list, and returns an address.
+
+*******************************************************************************/
+
+java_objectheader *vm_call_method_valist(methodinfo *m, java_objectheader *o,
+                                                                                va_list ap)
+{
+       s4                 vmargscount;
+       vm_arg            *vmargs;
+       java_objectheader *ro;
+       s4                 dumpsize;
+
+       /* mark start of dump memory area */
+
+       dumpsize = dump_size();
+
+       /* get number of Java method arguments */
+
+       vmargscount = m->parseddesc->paramcount;
+
+       /* allocate vm_arg array */
+
+       vmargs = DMNEW(vm_arg, vmargscount);
+
+       /* fill the vm_arg array from a va_list */
+
+       vm_vmargs_from_valist(m, o, vmargs, ap);
+
+       /* call the Java method */
+
+       ro = vm_call_method_vmarg(m, vmargscount, vmargs);
+
+       /* release dump area */
+
+       dump_release(dumpsize);
+
+       return ro;
+}
+
+
+/* vm_call_method_jvalue *******************************************************
+
+   Calls a Java method with a variable number of arguments, passed via
+   a jvalue array, and returns an address.
+
+*******************************************************************************/
+
+java_objectheader *vm_call_method_jvalue(methodinfo *m, java_objectheader *o,
+                                                                                jvalue *args)
+{
+       s4                 vmargscount;
+       vm_arg            *vmargs;
+       java_objectheader *ro;
+       s4                 dumpsize;
+
+       /* mark start of dump memory area */
+
+       dumpsize = dump_size();
+
+       /* get number of Java method arguments */
+
+       vmargscount = m->parseddesc->paramcount;
+
+       /* allocate vm_arg array */
+
+       vmargs = DMNEW(vm_arg, vmargscount);
+
+       /* fill the vm_arg array from a va_list */
+
+       vm_vmargs_from_jvalue(m, o, vmargs, args);
+
+       /* call the Java method */
+
+       ro = vm_call_method_vmarg(m, vmargscount, vmargs);
+
+       /* release dump area */
+
+       dump_release(dumpsize);
+
+       return ro;
+}
+
+
+/* vm_call_method_vmarg ********************************************************
+
+   Calls a Java method with a variable number of arguments, passed via
+   a vm_arg array, and returns an address.
+
+*******************************************************************************/
+
+java_objectheader *vm_call_method_vmarg(methodinfo *m, s4 vmargscount,
+                                                                               vm_arg *vmargs)
 {
        java_objectheader *o;
 
 #if defined(ENABLE_JIT)
 # if defined(ENABLE_INTRP)
        if (opt_intrp)
-               o = intrp_asm_calljavafunction2(m, count, vmargs);
+               o = intrp_asm_vm_call_method(m, vmargscount, vmargs);
        else
 # endif
-               o = asm_calljavafunction2(m, count, vmargs);
+               o = asm_vm_call_method(m, vmargscount, vmargs);
 #else
-       o = intrp_asm_calljavafunction(m, count, vmargs);
+       o = intrp_asm_vm_call_method(m, vmargscount, vmargs);
 #endif
 
        return o;
@@ -1375,19 +1567,123 @@ java_objectheader *vm_call_method(methodinfo *m, u4 count, vm_arg *vmargs)
 
 *******************************************************************************/
 
-s4 vm_call_method_int(methodinfo *m, u4 count, vm_arg *vmargs)
+s4 vm_call_method_int(methodinfo *m, java_objectheader *o, ...)
+{
+       va_list ap;
+       s4      i;
+
+       va_start(ap, o);
+       i = vm_call_method_int_valist(m, o, ap);
+       va_end(ap);
+
+       return i;
+}
+
+
+/* vm_call_method_int_valist ***************************************************
+
+   Calls a Java method with a variable number of arguments, passed via
+   a va_list, and returns an integer (s4).
+
+*******************************************************************************/
+
+s4 vm_call_method_int_valist(methodinfo *m, java_objectheader *o, va_list ap)
+{
+       s4      vmargscount;
+       vm_arg *vmargs;
+       s4      i;
+       s4      dumpsize;
+
+       /* mark start of dump memory area */
+
+       dumpsize = dump_size();
+
+       /* get number of Java method arguments */
+
+       vmargscount = m->parseddesc->paramcount;
+
+       /* allocate vm_arg array */
+
+       vmargs = DMNEW(vm_arg, vmargscount);
+
+       /* fill the vm_arg array from a va_list */
+
+       vm_vmargs_from_valist(m, o, vmargs, ap);
+
+       /* call the Java method */
+
+       i = vm_call_method_int_vmarg(m, vmargscount, vmargs);
+
+       /* release dump area */
+
+       dump_release(dumpsize);
+
+       return i;
+}
+
+
+/* vm_call_method_int_jvalue ***************************************************
+
+   Calls a Java method with a variable number of arguments, passed via
+   a jvalue array, and returns an integer (s4).
+
+*******************************************************************************/
+
+s4 vm_call_method_int_jvalue(methodinfo *m, java_objectheader *o, jvalue *args)
+{
+       s4      vmargscount;
+       vm_arg *vmargs;
+       s4      i;
+       s4      dumpsize;
+
+       /* mark start of dump memory area */
+
+       dumpsize = dump_size();
+
+       /* get number of Java method arguments */
+
+       vmargscount = m->parseddesc->paramcount;
+
+       /* allocate vm_arg array */
+
+       vmargs = DMNEW(vm_arg, vmargscount);
+
+       /* fill the vm_arg array from a va_list */
+
+       vm_vmargs_from_jvalue(m, o, vmargs, args);
+
+       /* call the Java method */
+
+       i = vm_call_method_int_vmarg(m, vmargscount, vmargs);
+
+       /* release dump area */
+
+       dump_release(dumpsize);
+
+       return i;
+}
+
+
+/* vm_call_method_int_vmarg ****************************************************
+
+   Calls a Java method with a variable number of arguments, passed via
+   a vm_arg array, and returns an integer (s4).
+
+*******************************************************************************/
+
+s4 vm_call_method_int_vmarg(methodinfo *m, s4 vmargscount, vm_arg *vmargs)
 {
        s4 i;
 
 #if defined(ENABLE_JIT)
 # if defined(ENABLE_INTRP)
        if (opt_intrp)
-               i = intrp_asm_calljavafunction2int(m, count, vmargs);
+               i = intrp_asm_vm_call_method_int(m, vmargscount, vmargs);
        else
 # endif
-               i = asm_calljavafunction2int(m, count, vmargs);
+               i = asm_vm_call_method_int(m, vmargscount, vmargs);
 #else
-       i = intrp_asm_calljavafunction2int(m, count, vmargs);
+       i = intrp_asm_vm_call_method_int(m, vmargscount, vmargs);
 #endif
 
        return i;
@@ -1401,19 +1697,123 @@ s4 vm_call_method_int(methodinfo *m, u4 count, vm_arg *vmargs)
 
 *******************************************************************************/
 
-s8 vm_call_method_long(methodinfo *m, u4 count, vm_arg *vmargs)
+s8 vm_call_method_long(methodinfo *m, java_objectheader *o, ...)
+{
+       va_list ap;
+       s8      l;
+
+       va_start(ap, o);
+       l = vm_call_method_long_valist(m, o, ap);
+       va_end(ap);
+
+       return l;
+}
+
+
+/* vm_call_method_long_valist **************************************************
+
+   Calls a Java method with a variable number of arguments, passed via
+   a va_list, and returns a long (s8).
+
+*******************************************************************************/
+
+s8 vm_call_method_long_valist(methodinfo *m, java_objectheader *o, va_list ap)
+{
+       s4      vmargscount;
+       vm_arg *vmargs;
+       s8      l;
+       s4      dumpsize;
+
+       /* mark start of dump memory area */
+
+       dumpsize = dump_size();
+
+       /* get number of Java method arguments */
+
+       vmargscount = m->parseddesc->paramcount;
+
+       /* allocate vm_arg array */
+
+       vmargs = DMNEW(vm_arg, vmargscount);
+
+       /* fill the vm_arg array from a va_list */
+
+       vm_vmargs_from_valist(m, o, vmargs, ap);
+
+       /* call the Java method */
+
+       l = vm_call_method_long_vmarg(m, vmargscount, vmargs);
+
+       /* release dump area */
+
+       dump_release(dumpsize);
+
+       return l;
+}
+
+
+/* vm_call_method_long_jvalue **************************************************
+
+   Calls a Java method with a variable number of arguments, passed via
+   a jvalue array, and returns a long (s8).
+
+*******************************************************************************/
+
+s8 vm_call_method_long_jvalue(methodinfo *m, java_objectheader *o, jvalue *args)
+{
+       s4      vmargscount;
+       vm_arg *vmargs;
+       s8      l;
+       s4      dumpsize;
+
+       /* mark start of dump memory area */
+
+       dumpsize = dump_size();
+
+       /* get number of Java method arguments */
+
+       vmargscount = m->parseddesc->paramcount;
+
+       /* allocate vm_arg array */
+
+       vmargs = DMNEW(vm_arg, vmargscount);
+
+       /* fill the vm_arg array from a va_list */
+
+       vm_vmargs_from_jvalue(m, o, vmargs, args);
+
+       /* call the Java method */
+
+       l = vm_call_method_long_vmarg(m, vmargscount, vmargs);
+
+       /* release dump area */
+
+       dump_release(dumpsize);
+
+       return l;
+}
+
+
+/* vm_call_method_long_vmarg ***************************************************
+
+   Calls a Java method with a variable number of arguments, passed via
+   a vm_arg array, and returns a long (s8).
+
+*******************************************************************************/
+
+s8 vm_call_method_long_vmarg(methodinfo *m, s4 vmargscount, vm_arg *vmargs)
 {
        s8 l;
 
 #if defined(ENABLE_JIT)
 # if defined(ENABLE_INTRP)
        if (opt_intrp)
-               l = intrp_asm_calljavafunction2long(m, count, vmargs);
+               l = intrp_asm_vm_call_method_long(m, vmargscount, vmargs);
        else
 # endif
-               l = asm_calljavafunction2long(m, count, vmargs);
+               l = asm_vm_call_method_long(m, vmargscount, vmargs);
 #else
-       l = intrp_asm_calljavafunction2long(m, count, vmargs);
+       l = intrp_asm_vm_call_method_long(m, vmargscount, vmargs);
 #endif
 
        return l;
@@ -1427,19 +1827,125 @@ s8 vm_call_method_long(methodinfo *m, u4 count, vm_arg *vmargs)
 
 *******************************************************************************/
 
-float vm_call_method_float(methodinfo *m, u4 count, vm_arg *vmargs)
+float vm_call_method_float(methodinfo *m, java_objectheader *o, ...)
+{
+       va_list ap;
+       float   f;
+
+       va_start(ap, o);
+       f = vm_call_method_float_valist(m, o, ap);
+       va_end(ap);
+
+       return f;
+}
+
+
+/* vm_call_method_float_valist *************************************************
+
+   Calls a Java method with a variable number of arguments, passed via
+   a va_list, and returns a float.
+
+*******************************************************************************/
+
+float vm_call_method_float_valist(methodinfo *m, java_objectheader *o,
+                                                                 va_list ap)
+{
+       s4      vmargscount;
+       vm_arg *vmargs;
+       float   f;
+       s4      dumpsize;
+
+       /* mark start of dump memory area */
+
+       dumpsize = dump_size();
+
+       /* get number of Java method arguments */
+
+       vmargscount = m->parseddesc->paramcount;
+
+       /* allocate vm_arg array */
+
+       vmargs = DMNEW(vm_arg, vmargscount);
+
+       /* fill the vm_arg array from a va_list */
+
+       vm_vmargs_from_valist(m, o, vmargs, ap);
+
+       /* call the Java method */
+
+       f = vm_call_method_float_vmarg(m, vmargscount, vmargs);
+
+       /* release dump area */
+
+       dump_release(dumpsize);
+
+       return f;
+}
+
+
+/* vm_call_method_float_jvalue *************************************************
+
+   Calls a Java method with a variable number of arguments, passed via
+   a jvalue array, and returns a float.
+
+*******************************************************************************/
+
+float vm_call_method_float_jvalue(methodinfo *m, java_objectheader *o,
+                                                                 jvalue *args)
+{
+       s4      vmargscount;
+       vm_arg *vmargs;
+       float   f;
+       s4      dumpsize;
+
+       /* mark start of dump memory area */
+
+       dumpsize = dump_size();
+
+       /* get number of Java method arguments */
+
+       vmargscount = m->parseddesc->paramcount;
+
+       /* allocate vm_arg array */
+
+       vmargs = DMNEW(vm_arg, vmargscount);
+
+       /* fill the vm_arg array from a va_list */
+
+       vm_vmargs_from_jvalue(m, o, vmargs, args);
+
+       /* call the Java method */
+
+       f = vm_call_method_float_vmarg(m, vmargscount, vmargs);
+
+       /* release dump area */
+
+       dump_release(dumpsize);
+
+       return f;
+}
+
+
+/* vm_call_method_float_vmarg **************************************************
+
+   Calls a Java method with a variable number of arguments and returns
+   an float.
+
+*******************************************************************************/
+
+float vm_call_method_float_vmarg(methodinfo *m, s4 vmargscount, vm_arg *vmargs)
 {
        float f;
 
 #if defined(ENABLE_JIT)
 # if defined(ENABLE_INTRP)
        if (opt_intrp)
-               f = intrp_asm_calljavafunction2float(m, count, vmargs);
+               f = intrp_asm_vm_call_method_float(m, vmargscount, vmargs);
        else
 # endif
-               f = asm_calljavafunction2float(m, count, vmargs);
+               f = asm_vm_call_method_float(m, vmargscount, vmargs);
 #else
-       f = intrp_asm_calljavafunction2float(m, count, vmargs);
+       f = intrp_asm_vm_call_method_float(m, vmargscount, vmargs);
 #endif
 
        return f;
@@ -1453,19 +1959,126 @@ float vm_call_method_float(methodinfo *m, u4 count, vm_arg *vmargs)
 
 *******************************************************************************/
 
-double vm_call_method_double(methodinfo *m, u4 count, vm_arg *vmargs)
+double vm_call_method_double(methodinfo *m, java_objectheader *o, ...)
+{
+       va_list ap;
+       double  d;
+
+       va_start(ap, o);
+       d = vm_call_method_double_valist(m, o, ap);
+       va_end(ap);
+
+       return d;
+}
+
+
+/* vm_call_method_double_valist ************************************************
+
+   Calls a Java method with a variable number of arguments, passed via
+   a va_list, and returns a double.
+
+*******************************************************************************/
+
+double vm_call_method_double_valist(methodinfo *m, java_objectheader *o,
+                                                                       va_list ap)
+{
+       s4      vmargscount;
+       vm_arg *vmargs;
+       double  d;
+       s4      dumpsize;
+
+       /* mark start of dump memory area */
+
+       dumpsize = dump_size();
+
+       /* get number of Java method arguments */
+
+       vmargscount = m->parseddesc->paramcount;
+
+       /* allocate vm_arg array */
+
+       vmargs = DMNEW(vm_arg, vmargscount);
+
+       /* fill the vm_arg array from a va_list */
+
+       vm_vmargs_from_valist(m, o, vmargs, ap);
+
+       /* call the Java method */
+
+       d = vm_call_method_double_vmarg(m, vmargscount, vmargs);
+
+       /* release dump area */
+
+       dump_release(dumpsize);
+
+       return d;
+}
+
+
+/* vm_call_method_double_jvalue ************************************************
+
+   Calls a Java method with a variable number of arguments, passed via
+   a jvalue array, and returns a double.
+
+*******************************************************************************/
+
+double vm_call_method_double_jvalue(methodinfo *m, java_objectheader *o,
+                                                                       jvalue *args)
+{
+       s4      vmargscount;
+       vm_arg *vmargs;
+       double  d;
+       s4      dumpsize;
+
+       /* mark start of dump memory area */
+
+       dumpsize = dump_size();
+
+       /* get number of Java method arguments */
+
+       vmargscount = m->parseddesc->paramcount;
+
+       /* allocate vm_arg array */
+
+       vmargs = DMNEW(vm_arg, vmargscount);
+
+       /* fill the vm_arg array from a va_list */
+
+       vm_vmargs_from_jvalue(m, o, vmargs, args);
+
+       /* call the Java method */
+
+       d = vm_call_method_double_vmarg(m, vmargscount, vmargs);
+
+       /* release dump area */
+
+       dump_release(dumpsize);
+
+       return d;
+}
+
+
+/* vm_call_method_double_vmarg *************************************************
+
+   Calls a Java method with a variable number of arguments and returns
+   a double.
+
+*******************************************************************************/
+
+double vm_call_method_double_vmarg(methodinfo *m, s4 vmargscount,
+                                                                  vm_arg *vmargs)
 {
        double d;
 
 #if defined(ENABLE_JIT)
 # if defined(ENABLE_INTRP)
        if (opt_intrp)
-               d = intrp_asm_calljavafunction2double(m, count, vmargs);
+               d = intrp_asm_vm_call_method_double(m, vmargscount, vmargs);
        else
 # endif
-               d = asm_calljavafunction2double(m, count, vmargs);
+               d = asm_vm_call_method_double(m, vmargscount, vmargs);
 #else
-       d = intrp_asm_calljavafunction2double(m, count, vmargs);
+       d = intrp_asm_vm_call_method_double(m, vmargscount, vmargs);
 #endif
 
        return d;
index 4217b2ea73a05ce80cfbc8124aa17a12e1ba9add..8210f638a30965aab37969b1b19fd9f3a9b00eb5 100644 (file)
@@ -85,17 +85,38 @@ 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);
+java_objectheader *vm_call_method(methodinfo *m, java_objectheader *o, ...);
+java_objectheader *vm_call_method_valist(methodinfo *m, java_objectheader *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);
 
 #endif /* _VM_H */