* src/vm/vm.c (vm_call_float_array): New function.
authortwisti <none@none>
Tue, 19 Jun 2007 22:50:17 +0000 (22:50 +0000)
committertwisti <none@none>
Tue, 19 Jun 2007 22:50:17 +0000 (22:50 +0000)
(vm_call_method_float_valist): Likewise.
(vm_call_method_float_jvalue): Likewise.
(vm_call_double_array): Likewise.
(vm_call_method_double_valist): Likewise.
(vm_call_method_double_jvalue): Likewise.

* src/vm/vm.h: Defined new functions.
* src/vm/jit/asmpart.h: Likewise.
* src/native/jni.c: Use new functions.

src/native/jni.c
src/vm/jit/asmpart.h
src/vm/vm.c
src/vm/vm.h

index f3d410657cd3f7daaca25cd7d6c412f214983f5c..33944fe479891f40d99a633cc03d0350cec62b70 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: jni.c 8099 2007-06-18 18:26:58Z tbfg $
+   $Id: jni.c 8106 2007-06-19 22:50:17Z twisti $
 
 */
 
@@ -1002,7 +1002,6 @@ java_objectheader *_Jv_jni_invokeNative(methodinfo *m, java_objectheader *o,
                                                                                java_objectarray *params)
 {
        methodinfo        *resm;
-       vm_arg            *vmargs;
        java_objectheader *ro;
        s4                 argcount;
        s4                 paramcount;
@@ -1179,7 +1178,7 @@ java_objectheader *_Jv_jni_invokeNative(methodinfo *m, java_objectheader *o,
                float f;
                java_lang_Float *fo;
 
-               f = vm_call_method_float_vmarg(resm, argcount, vmargs);
+               f = vm_call_float_array(resm, array);
 
                ro = builtin_new(class_java_lang_Float);
 
@@ -1194,7 +1193,7 @@ java_objectheader *_Jv_jni_invokeNative(methodinfo *m, java_objectheader *o,
                double d;
                java_lang_Double *_do;
 
-               d = vm_call_method_double_vmarg(resm, argcount, vmargs);
+               d = vm_call_double_array(resm, array);
 
                ro = builtin_new(class_java_lang_Double);
 
index 385ac8b67ca1f42c8ecd85dfe87eb1588af61c36..d86f1d5fa9c1421d5774ba86ddead24ad166ed38 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: asmpart.h 8099 2007-06-18 18:26:58Z tbfg $
+   $Id: asmpart.h 8106 2007-06-19 22:50:17Z twisti $
 
 */
 
@@ -105,8 +105,8 @@ java_objectheader *asm_vm_call_method(void *pv, uint64_t *array, int32_t stackar
 int32_t            asm_vm_call_method_int(void *pv, uint64_t *array, int32_t stackargs);
 
 int64_t            asm_vm_call_method_long(void *pv, uint64_t *array, int32_t stackargs);
-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);
+float              asm_vm_call_method_float(void *pv, uint64_t *array, int32_t stackargs);
+double             asm_vm_call_method_double(void *pv, uint64_t *array, int32_t stackargs);
 
 void   asm_vm_call_method_exception_handler(void);
 void   asm_vm_call_method_end(void);
index ed0720e3db2c75aeeed0393802b8c167b9911338..b2ea46663e5d5726871903f01bd5080c0e873a10 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: vm.c 8099 2007-06-18 18:26:58Z tbfg $
+   $Id: vm.c 8106 2007-06-19 22:50:17Z twisti $
 
 */
 
@@ -3547,6 +3547,65 @@ int32_t vm_call_method_int_jvalue(methodinfo *m, java_objectheader *o, jvalue *a
 #endif
 
 
+/* vm_call_long_array **********************************************************
+
+   Calls a Java method with a variable number of arguments, passed via
+   an argument array, and returns a long (int64_t).
+
+*******************************************************************************/
+
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__)
+s8 vm_call_method_long_vmarg(methodinfo *m, s4 vmargscount, vm_arg *vmargs)
+{
+       s8 l;
+
+       STATISTICS(count_calls_native_to_java++);
+
+#if defined(ENABLE_JIT)
+# if defined(ENABLE_INTRP)
+       if (opt_intrp)
+               l = intrp_asm_vm_call_method_long(m, vmargscount, vmargs);
+       else
+# endif
+               l = asm_vm_call_method_long(m, vmargscount, vmargs);
+#else
+       l = intrp_asm_vm_call_method_long(m, vmargscount, vmargs);
+#endif
+
+       return l;
+}
+#else
+int64_t vm_call_long_array(methodinfo *m, uint64_t *array)
+{
+       methoddesc *md;
+       int64_t     l;
+
+       md = m->parseddesc;
+
+       /* compile the method if not already done */
+
+       if (m->code == NULL)
+               if (!jit_compile(m))
+                       return 0;
+
+       STATISTICS(count_calls_native_to_java++);
+
+#if defined(ENABLE_JIT)
+# if defined(ENABLE_INTRP)
+       if (opt_intrp)
+               l = intrp_asm_vm_call_method_long(m, vmargscount, vmargs);
+       else
+# endif
+               l = asm_vm_call_method_long(m->code->entrypoint, array, md->memuse);
+#else
+       l = intrp_asm_vm_call_method_long(m, vmargscount, vmargs);
+#endif
+
+       return l;
+}
+#endif
+
+
 /* vm_call_method_long *********************************************************
 
    Calls a Java method with a variable number of arguments and returns
@@ -3705,38 +3764,40 @@ int64_t vm_call_method_long_jvalue(methodinfo *m, java_objectheader *o, jvalue *
 #endif
 
 
-/* vm_call_method_long_vmarg ***************************************************
+/* vm_call_float_array *********************************************************
 
-   Calls a Java method with a variable number of arguments, passed via
-   a vm_arg array, and returns a long (s8).
+   Calls a Java method with a variable number of arguments and returns
+   an float.
 
 *******************************************************************************/
 
 #if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__)
-s8 vm_call_method_long_vmarg(methodinfo *m, s4 vmargscount, vm_arg *vmargs)
+float vm_call_method_float_vmarg(methodinfo *m, s4 vmargscount, vm_arg *vmargs)
 {
-       s8 l;
+       float f;
+
+       vm_abort("IMPLEMENT ME!");
 
        STATISTICS(count_calls_native_to_java++);
 
 #if defined(ENABLE_JIT)
 # if defined(ENABLE_INTRP)
        if (opt_intrp)
-               l = intrp_asm_vm_call_method_long(m, vmargscount, vmargs);
+               f = intrp_asm_vm_call_method_float(m, vmargscount, vmargs);
        else
 # endif
-               l = asm_vm_call_method_long(m, vmargscount, vmargs);
+               f = asm_vm_call_method_float(m, vmargscount, vmargs);
 #else
-       l = intrp_asm_vm_call_method_long(m, vmargscount, vmargs);
+       f = intrp_asm_vm_call_method_float(m, vmargscount, vmargs);
 #endif
 
-       return l;
+       return f;
 }
 #else
-int64_t vm_call_long_array(methodinfo *m, uint64_t *array)
+float vm_call_float_array(methodinfo *m, uint64_t *array)
 {
        methoddesc *md;
-       int64_t     l;
+       float       f;
 
        md = m->parseddesc;
 
@@ -3751,15 +3812,15 @@ int64_t vm_call_long_array(methodinfo *m, uint64_t *array)
 #if defined(ENABLE_JIT)
 # if defined(ENABLE_INTRP)
        if (opt_intrp)
-               l = intrp_asm_vm_call_method_long(m, vmargscount, vmargs);
+               f = intrp_asm_vm_call_method_float(m, vmargscount, vmargs);
        else
 # endif
-               l = asm_vm_call_method_long(m->code->entrypoint, array, md->memuse);
+               f = asm_vm_call_method_float(m->code->entrypoint, array, md->memuse);
 #else
-       l = intrp_asm_vm_call_method_long(m, vmargscount, vmargs);
+       f = intrp_asm_vm_call_method_float(m, vmargscount, vmargs);
 #endif
 
-       return l;
+       return f;
 }
 #endif
 
@@ -3791,6 +3852,7 @@ float vm_call_method_float(methodinfo *m, java_objectheader *o, ...)
 
 *******************************************************************************/
 
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__)
 float vm_call_method_float_valist(methodinfo *m, java_objectheader *o,
                                                                  va_list ap)
 {
@@ -3825,6 +3887,32 @@ float vm_call_method_float_valist(methodinfo *m, java_objectheader *o,
 
        return f;
 }
+#else
+float vm_call_method_float_valist(methodinfo *m, java_objectheader *o, va_list ap)
+{
+       int32_t   dumpsize;
+       uint64_t *array;
+       float     f;
+
+       /* mark start of dump memory area */
+
+       dumpsize = dump_size();
+
+       /* fill the argument array from a va_list */
+
+       array = vm_array_from_valist(m, o, ap);
+
+       /* call the Java method */
+
+       f = vm_call_float_array(m, array);
+
+       /* release dump area */
+
+       dump_release(dumpsize);
+
+       return f;
+}
+#endif
 
 
 /* vm_call_method_float_jvalue *************************************************
@@ -3834,6 +3922,7 @@ float vm_call_method_float_valist(methodinfo *m, java_objectheader *o,
 
 *******************************************************************************/
 
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__)
 float vm_call_method_float_jvalue(methodinfo *m, java_objectheader *o,
                                                                  jvalue *args)
 {
@@ -3868,18 +3957,46 @@ float vm_call_method_float_jvalue(methodinfo *m, java_objectheader *o,
 
        return f;
 }
+#else
+float vm_call_method_float_jvalue(methodinfo *m, java_objectheader *o, jvalue *args)
+{
+       int32_t   dumpsize;
+       uint64_t *array;
+       float     f;
+
+       /* mark start of dump memory area */
+
+       dumpsize = dump_size();
+
+       /* fill the argument array from a va_list */
+
+       array = vm_array_from_jvalue(m, o, args);
+
+       /* call the Java method */
+
+       f = vm_call_float_array(m, array);
+
+       /* release dump area */
+
+       dump_release(dumpsize);
+
+       return f;
+}
+#endif
 
 
-/* vm_call_method_float_vmarg **************************************************
+/* vm_call_double_array ********************************************************
 
    Calls a Java method with a variable number of arguments and returns
-   an float.
+   a double.
 
 *******************************************************************************/
 
-float vm_call_method_float_vmarg(methodinfo *m, s4 vmargscount, vm_arg *vmargs)
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__)
+double vm_call_method_double_vmarg(methodinfo *m, s4 vmargscount,
+                                                                  vm_arg *vmargs)
 {
-       float f;
+       double d;
 
        vm_abort("IMPLEMENT ME!");
 
@@ -3888,16 +4005,46 @@ float vm_call_method_float_vmarg(methodinfo *m, s4 vmargscount, vm_arg *vmargs)
 #if defined(ENABLE_JIT)
 # if defined(ENABLE_INTRP)
        if (opt_intrp)
-               f = intrp_asm_vm_call_method_float(m, vmargscount, vmargs);
+               d = intrp_asm_vm_call_method_double(m, vmargscount, vmargs);
        else
 # endif
-               f = asm_vm_call_method_float(m, vmargscount, vmargs);
+               d = asm_vm_call_method_double(m, vmargscount, vmargs);
 #else
-       f = intrp_asm_vm_call_method_float(m, vmargscount, vmargs);
+       d = intrp_asm_vm_call_method_double(m, vmargscount, vmargs);
 #endif
 
-       return f;
+       return d;
 }
+#else
+double vm_call_double_array(methodinfo *m, uint64_t *array)
+{
+       methoddesc *md;
+       double      d;
+
+       md = m->parseddesc;
+
+       /* compile the method if not already done */
+
+       if (m->code == NULL)
+               if (!jit_compile(m))
+                       return 0;
+
+       STATISTICS(count_calls_native_to_java++);
+
+#if defined(ENABLE_JIT)
+# if defined(ENABLE_INTRP)
+       if (opt_intrp)
+               d = intrp_asm_vm_call_method_double(m, vmargscount, vmargs);
+       else
+# endif
+               d = asm_vm_call_method_double(m->code->entrypoint, array, md->memuse);
+#else
+       d = intrp_asm_vm_call_method_double(m, vmargscount, vmargs);
+#endif
+
+       return d;
+}
+#endif
 
 
 /* vm_call_method_double *******************************************************
@@ -3927,6 +4074,7 @@ double vm_call_method_double(methodinfo *m, java_objectheader *o, ...)
 
 *******************************************************************************/
 
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__)
 double vm_call_method_double_valist(methodinfo *m, java_objectheader *o,
                                                                        va_list ap)
 {
@@ -3961,6 +4109,32 @@ double vm_call_method_double_valist(methodinfo *m, java_objectheader *o,
 
        return d;
 }
+#else
+double vm_call_method_double_valist(methodinfo *m, java_objectheader *o, va_list ap)
+{
+       int32_t   dumpsize;
+       uint64_t *array;
+       double    d;
+
+       /* mark start of dump memory area */
+
+       dumpsize = dump_size();
+
+       /* fill the argument array from a va_list */
+
+       array = vm_array_from_valist(m, o, ap);
+
+       /* call the Java method */
+
+       d = vm_call_double_array(m, array);
+
+       /* release dump area */
+
+       dump_release(dumpsize);
+
+       return d;
+}
+#endif
 
 
 /* vm_call_method_double_jvalue ************************************************
@@ -3970,6 +4144,7 @@ double vm_call_method_double_valist(methodinfo *m, java_objectheader *o,
 
 *******************************************************************************/
 
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__)
 double vm_call_method_double_jvalue(methodinfo *m, java_objectheader *o,
                                                                        jvalue *args)
 {
@@ -4004,37 +4179,32 @@ double vm_call_method_double_jvalue(methodinfo *m, java_objectheader *o,
 
        return d;
 }
+#else
+double vm_call_method_double_jvalue(methodinfo *m, java_objectheader *o, jvalue *args)
+{
+       int32_t   dumpsize;
+       uint64_t *array;
+       double    d;
 
+       /* mark start of dump memory area */
 
-/* vm_call_method_double_vmarg *************************************************
+       dumpsize = dump_size();
 
-   Calls a Java method with a variable number of arguments and returns
-   a double.
+       /* fill the argument array from a va_list */
 
-*******************************************************************************/
+       array = vm_array_from_jvalue(m, o, args);
 
-double vm_call_method_double_vmarg(methodinfo *m, s4 vmargscount,
-                                                                  vm_arg *vmargs)
-{
-       double d;
+       /* call the Java method */
 
-       vm_abort("IMPLEMENT ME!");
+       d = vm_call_double_array(m, array);
 
-       STATISTICS(count_calls_native_to_java++);
+       /* release dump area */
 
-#if defined(ENABLE_JIT)
-# if defined(ENABLE_INTRP)
-       if (opt_intrp)
-               d = intrp_asm_vm_call_method_double(m, vmargscount, vmargs);
-       else
-# endif
-               d = asm_vm_call_method_double(m, vmargscount, vmargs);
-#else
-       d = intrp_asm_vm_call_method_double(m, vmargscount, vmargs);
-#endif
+       dump_release(dumpsize);
 
        return d;
 }
+#endif
 
 
 /*
index 1827f4e88536d0d1a56bfd84d037346c6cbc2694..a3f1c122c797be11e222a52a33d85b4dc6df8483 100644 (file)
@@ -123,10 +123,14 @@ java_objectheader *vm_call_method_vmarg(methodinfo *m, s4 vmargscount,
                                                                                vm_arg *vmargs);
 s4 vm_call_method_int_vmarg(methodinfo *m, s4 vmargscount, vm_arg *vmargs);
 s8 vm_call_method_long_vmarg(methodinfo *m, s4 vmargscount, vm_arg *vmargs);
+float vm_call_method_float_vmarg(methodinfo *m, s4 vmargscount, vm_arg *vmargs);
+double vm_call_method_double_vmarg(methodinfo *m, s4 vmargscount, vm_arg *vmargs);
 #else
 java_objectheader *vm_call_array(methodinfo *m, uint64_t *array);
 int32_t            vm_call_int_array(methodinfo *m, uint64_t *array);
 int64_t            vm_call_long_array(methodinfo *m, uint64_t *array);
+float              vm_call_float_array(methodinfo *m, uint64_t *array);
+double             vm_call_double_array(methodinfo *m, uint64_t *array);
 #endif
 
 s4 vm_call_method_int(methodinfo *m, java_objectheader *o, ...);
@@ -142,15 +146,12 @@ 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 */