ffi.h.in (FFI_SIZEOF_JAVA_RAW): Define if not already defined.
authorDavid Daney <ddaney@avtrex.com>
Thu, 6 Dec 2007 22:02:22 +0000 (22:02 +0000)
committerDavid Daney <daney@gcc.gnu.org>
Thu, 6 Dec 2007 22:02:22 +0000 (22:02 +0000)
2007-12-06  David Daney  <ddaney@avtrex.com>

* include/ffi.h.in (FFI_SIZEOF_JAVA_RAW): Define if not already
defined.
(ffi_java_raw): New typedef.
(ffi_java_raw_call, ffi_java_ptrarray_to_raw,
ffi_java_raw_to_ptrarray): Change parameter types from ffi_raw to
ffi_java_raw.
(ffi_java_raw_closure) : Same.
(ffi_prep_java_raw_closure, ffi_prep_java_raw_closure_loc): Change
parameter types.
* src/java_raw_api.c (ffi_java_raw_size):  Replace FFI_SIZEOF_ARG with
FFI_SIZEOF_JAVA_RAW.
(ffi_java_raw_to_ptrarray): Change type of raw to ffi_java_raw.
Replace FFI_SIZEOF_ARG with FFI_SIZEOF_JAVA_RAW. Use
sizeof(ffi_java_raw) for alignment calculations.
(ffi_java_ptrarray_to_raw): Same.
(ffi_java_rvalue_to_raw): Add special handling for FFI_TYPE_POINTER
        if FFI_SIZEOF_JAVA_RAW == 4.
(ffi_java_raw_to_rvalue): Same.
(ffi_java_raw_call): Change type of raw to ffi_java_raw.
(ffi_java_translate_args): Same.
(ffi_prep_java_raw_closure_loc, ffi_prep_java_raw_closure): Change
parameter types.
* src/mips/ffitarget.h (FFI_SIZEOF_JAVA_RAW): Define for N32 ABI.

2007-12-06  David Daney  <ddaney@avtrex.com>

* interpret.cc: Replace ffi_raw with INTERP_FFI_RAW_TYPE throughout.
(ncode_closure, ffi_closure_fun): Define versions for
non-FFI_NATIVE_RAW_API case.
* include/java-interp.h (INTERP_FFI_RAW_TYPE): Define and use to
replace ffi_raw throughout.
* jni.cc, interpret-run.cc: Replace ffi_raw with INTERP_FFI_RAW_TYPE
throughout.

From-SVN: r130660

libffi/ChangeLog
libffi/include/ffi.h.in
libffi/src/java_raw_api.c
libffi/src/mips/ffitarget.h
libjava/ChangeLog
libjava/include/java-interp.h
libjava/interpret-run.cc
libjava/interpret.cc
libjava/jni.cc

index 298912a..3a937c4 100644 (file)
@@ -1,5 +1,31 @@
 2007-12-06  David Daney  <ddaney@avtrex.com>
 
+       * include/ffi.h.in (FFI_SIZEOF_JAVA_RAW): Define if not already
+       defined.
+       (ffi_java_raw): New typedef.
+       (ffi_java_raw_call, ffi_java_ptrarray_to_raw,
+       ffi_java_raw_to_ptrarray): Change parameter types from ffi_raw to
+       ffi_java_raw.
+       (ffi_java_raw_closure) : Same.
+       (ffi_prep_java_raw_closure, ffi_prep_java_raw_closure_loc): Change
+       parameter types.
+       * src/java_raw_api.c (ffi_java_raw_size):  Replace FFI_SIZEOF_ARG with
+       FFI_SIZEOF_JAVA_RAW.
+       (ffi_java_raw_to_ptrarray): Change type of raw to ffi_java_raw.
+       Replace FFI_SIZEOF_ARG with FFI_SIZEOF_JAVA_RAW. Use
+       sizeof(ffi_java_raw) for alignment calculations.
+       (ffi_java_ptrarray_to_raw): Same.
+       (ffi_java_rvalue_to_raw): Add special handling for FFI_TYPE_POINTER
+        if FFI_SIZEOF_JAVA_RAW == 4.
+       (ffi_java_raw_to_rvalue): Same.
+       (ffi_java_raw_call): Change type of raw to ffi_java_raw.
+       (ffi_java_translate_args): Same.
+       (ffi_prep_java_raw_closure_loc, ffi_prep_java_raw_closure): Change
+       parameter types.
+       * src/mips/ffitarget.h (FFI_SIZEOF_JAVA_RAW): Define for N32 ABI.
+
+2007-12-06  David Daney  <ddaney@avtrex.com>
+
        * src/mips/n32.S (ffi_closure_N32): Use 64-bit add instruction on 
        pointer values.
 
index bffe7ff..7784b2e 100644 (file)
@@ -193,6 +193,10 @@ typedef struct {
 # endif
 #endif
 
+#ifndef FFI_SIZEOF_JAVA_RAW
+#  define FFI_SIZEOF_JAVA_RAW FFI_SIZEOF_ARG
+#endif
+
 typedef union {
   ffi_sarg  sint;
   ffi_arg   uint;
@@ -201,6 +205,21 @@ typedef union {
   void*     ptr;
 } ffi_raw;
 
+#if FFI_SIZEOF_JAVA_RAW == 4 && FFI_SIZEOF_ARG == 8
+/* This is a special case for mips64/n32 ABI (and perhaps others) where
+   sizeof(void *) is 4 and FFI_SIZEOF_ARG is 8.  */
+typedef union {
+  signed int   sint;
+  unsigned int uint;
+  float                flt;
+  char         data[FFI_SIZEOF_JAVA_RAW];
+  void*                ptr;
+} ffi_java_raw;
+#else
+typedef ffi_raw ffi_java_raw;
+#endif
+
+
 void ffi_raw_call (ffi_cif *cif,
                   void (*fn)(),
                   void *rvalue,
@@ -217,10 +236,10 @@ size_t ffi_raw_size (ffi_cif *cif);
 void ffi_java_raw_call (ffi_cif *cif,
                        void (*fn)(),
                        void *rvalue,
-                       ffi_raw *avalue);
+                       ffi_java_raw *avalue);
 
-void ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw);
-void ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args);
+void ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_java_raw *raw);
+void ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_java_raw *raw, void **args);
 size_t ffi_java_raw_size (ffi_cif *cif);
 
 /* ---- Definitions for closures ----------------------------------------- */
@@ -271,6 +290,27 @@ typedef struct {
 
 } ffi_raw_closure;
 
+typedef struct {
+  char tramp[FFI_TRAMPOLINE_SIZE];
+
+  ffi_cif   *cif;
+
+#if !FFI_NATIVE_RAW_API
+
+  /* if this is enabled, then a raw closure has the same layout 
+     as a regular closure.  We use this to install an intermediate 
+     handler to do the transaltion, void** -> ffi_raw*. */
+
+  void     (*translate_args)(ffi_cif*,void*,void**,void*);
+  void      *this_closure;
+
+#endif
+
+  void     (*fun)(ffi_cif*,void*,ffi_java_raw*,void*);
+  void      *user_data;
+
+} ffi_java_raw_closure;
+
 ffi_status
 ffi_prep_raw_closure (ffi_raw_closure*,
                      ffi_cif *cif,
@@ -285,15 +325,15 @@ ffi_prep_raw_closure_loc (ffi_raw_closure*,
                          void *codeloc);
 
 ffi_status
-ffi_prep_java_raw_closure (ffi_raw_closure*,
+ffi_prep_java_raw_closure (ffi_java_raw_closure*,
                           ffi_cif *cif,
-                          void (*fun)(ffi_cif*,void*,ffi_raw*,void*),
+                          void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*),
                           void *user_data);
 
 ffi_status
-ffi_prep_java_raw_closure_loc (ffi_raw_closure*,
+ffi_prep_java_raw_closure_loc (ffi_java_raw_closure*,
                               ffi_cif *cif,
-                              void (*fun)(ffi_cif*,void*,ffi_raw*,void*),
+                              void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*),
                               void *user_data,
                               void *codeloc);
 
index 9c00d37..4fef115 100644 (file)
@@ -54,13 +54,13 @@ ffi_java_raw_size (ffi_cif *cif)
        case FFI_TYPE_UINT64:
        case FFI_TYPE_SINT64:
        case FFI_TYPE_DOUBLE:
-         result += 2 * FFI_SIZEOF_ARG;
+         result += 2 * FFI_SIZEOF_JAVA_RAW;
          break;
        case FFI_TYPE_STRUCT:
          /* No structure parameters in Java.   */
          abort();
        default:
-         result += FFI_SIZEOF_ARG;
+         result += FFI_SIZEOF_JAVA_RAW;
       }
     }
 
@@ -69,7 +69,7 @@ ffi_java_raw_size (ffi_cif *cif)
 
 
 void
-ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args)
+ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_java_raw *raw, void **args)
 {
   unsigned i;
   ffi_type **tp = cif->arg_types;
@@ -90,7 +90,7 @@ ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args)
          *args = (void*) ((char*)(raw++) + 2);
          break;
 
-#if FFI_SIZEOF_ARG == 8
+#if FFI_SIZEOF_JAVA_RAW == 8
        case FFI_TYPE_UINT64:
        case FFI_TYPE_SINT64:
        case FFI_TYPE_DOUBLE:
@@ -105,7 +105,8 @@ ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args)
 
        default:
          *args = raw;
-         raw += ALIGN ((*tp)->size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG;
+         raw +=
+           ALIGN ((*tp)->size, sizeof(ffi_java_raw)) / sizeof(ffi_java_raw);
        }
     }
 
@@ -116,7 +117,7 @@ ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args)
   /* then assume little endian */
   for (i = 0; i < cif->nargs; i++, tp++, args++)
     {
-#if FFI_SIZEOF_ARG == 8
+#if FFI_SIZEOF_JAVA_RAW == 8
       switch((*tp)->type) {
        case FFI_TYPE_UINT64:
        case FFI_TYPE_SINT64:
@@ -127,10 +128,11 @@ ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args)
        default:
          *args = (void*) raw++;
       }
-#else /* FFI_SIZEOF_ARG != 8 */
+#else /* FFI_SIZEOF_JAVA_RAW != 8 */
        *args = (void*) raw;
-       raw += ALIGN ((*tp)->size, sizeof (void*)) / sizeof (void*);
-#endif /* FFI_SIZEOF_ARG == 8 */
+       raw +=
+         ALIGN ((*tp)->size, sizeof(ffi_java_raw)) / sizeof(ffi_java_raw);
+#endif /* FFI_SIZEOF_JAVA_RAW == 8 */
     }
 
 #else
@@ -141,7 +143,7 @@ ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args)
 }
 
 void
-ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw)
+ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_java_raw *raw)
 {
   unsigned i;
   ffi_type **tp = cif->arg_types;
@@ -202,7 +204,7 @@ ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw)
          (raw++)->flt = *(FLOAT32*) (*args);
          break;
 
-#if FFI_SIZEOF_ARG == 8
+#if FFI_SIZEOF_JAVA_RAW == 8
        case FFI_TYPE_UINT64:
        case FFI_TYPE_SINT64:
        case FFI_TYPE_DOUBLE:
@@ -216,11 +218,12 @@ ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw)
          break;
 
        default:
-#if FFI_SIZEOF_ARG == 8
+#if FFI_SIZEOF_JAVA_RAW == 8
          FFI_ASSERT(0);        /* Should have covered all cases */
 #else
          memcpy ((void*) raw->data, (void*)*args, (*tp)->size);
-         raw += ALIGN ((*tp)->size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG;
+         raw +=
+           ALIGN ((*tp)->size, sizeof(ffi_java_raw)) / sizeof(ffi_java_raw);
 #endif
        }
     }
@@ -244,6 +247,9 @@ ffi_java_rvalue_to_raw (ffi_cif *cif, void *rvalue)
     case FFI_TYPE_SINT16:
     case FFI_TYPE_SINT32:
     case FFI_TYPE_INT:
+#if FFI_SIZEOF_JAVA_RAW == 4
+    case FFI_TYPE_POINTER:
+#endif
       *(SINT64 *)rvalue <<= 32;
       break;
 
@@ -269,6 +275,9 @@ ffi_java_raw_to_rvalue (ffi_cif *cif, void *rvalue)
     case FFI_TYPE_SINT16:
     case FFI_TYPE_SINT32:
     case FFI_TYPE_INT:
+#if FFI_SIZEOF_JAVA_RAW == 4
+    case FFI_TYPE_POINTER:
+#endif
       *(SINT64 *)rvalue >>= 32;
       break;
 
@@ -285,7 +294,8 @@ ffi_java_raw_to_rvalue (ffi_cif *cif, void *rvalue)
  * these following couple of functions will handle the translation forth
  * and back automatically. */
 
-void ffi_java_raw_call (ffi_cif *cif, void (*fn)(), void *rvalue, ffi_raw *raw)
+void ffi_java_raw_call (ffi_cif *cif, void (*fn)(), void *rvalue,
+                       ffi_java_raw *raw)
 {
   void **avalue = (void**) alloca (cif->nargs * sizeof (void*));
   ffi_java_raw_to_ptrarray (cif, raw, avalue);
@@ -299,7 +309,7 @@ static void
 ffi_java_translate_args (ffi_cif *cif, void *rvalue,
                    void **avalue, void *user_data)
 {
-  ffi_raw *raw = (ffi_raw*)alloca (ffi_java_raw_size (cif));
+  ffi_java_raw *raw = (ffi_java_raw*)alloca (ffi_java_raw_size (cif));
   ffi_raw_closure *cl = (ffi_raw_closure*)user_data;
 
   ffi_java_ptrarray_to_raw (cif, avalue, raw);
@@ -308,9 +318,9 @@ ffi_java_translate_args (ffi_cif *cif, void *rvalue,
 }
 
 ffi_status
-ffi_prep_java_raw_closure_loc (ffi_raw_closure* cl,
+ffi_prep_java_raw_closure_loc (ffi_java_raw_closure* cl,
                               ffi_cif *cif,
-                              void (*fun)(ffi_cif*,void*,ffi_raw*,void*),
+                              void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*),
                               void *user_data,
                               void *codeloc)
 {
@@ -335,9 +345,9 @@ ffi_prep_java_raw_closure_loc (ffi_raw_closure* cl,
  * the pointer-array format, to the raw format */
 
 ffi_status
-ffi_prep_java_raw_closure (ffi_raw_closure* cl,
+ffi_prep_java_raw_closure (ffi_java_raw_closure* cl,
                           ffi_cif *cif,
-                          void (*fun)(ffi_cif*,void*,ffi_raw*,void*),
+                          void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*),
                           void *user_data)
 {
   return ffi_prep_java_raw_closure_loc (cl, cif, fun, user_data, cl);
index 08f03c3..ccfc82b 100644 (file)
 
 #ifdef FFI_MIPS_O32
 /* O32 stack frames have 32bit integer args */
-#define FFI_SIZEOF_ARG         4
+#  define FFI_SIZEOF_ARG    4
 #else
 /* N32 and N64 frames have 64bit integer args */
-#define FFI_SIZEOF_ARG         8
+#  define FFI_SIZEOF_ARG    8
+#  if _MIPS_SIM == _ABIN32
+#    define FFI_SIZEOF_JAVA_RAW  4
+#  endif
 #endif
 
 #define FFI_FLAG_BITS 2
index 1c96742..922a93b 100644 (file)
@@ -1,3 +1,13 @@
+2007-12-06  David Daney  <ddaney@avtrex.com>
+
+       * interpret.cc: Replace ffi_raw with INTERP_FFI_RAW_TYPE throughout.
+       (ncode_closure, ffi_closure_fun): Define versions for
+       non-FFI_NATIVE_RAW_API case.
+       * include/java-interp.h (INTERP_FFI_RAW_TYPE): Define and use to
+       replace ffi_raw throughout.
+       * jni.cc, interpret-run.cc: Replace ffi_raw with INTERP_FFI_RAW_TYPE
+       throughout.
+
 2007-12-06  Andreas Tobler  <a.tobler@schweiz.org>
 
        * testsuite/libjava.jni/jni.exp (gcj_jni_get_cxxflags_invocation): Make
index b0d0da4..c6d9955 100644 (file)
@@ -222,18 +222,26 @@ class _Jv_InterpMethod : public _Jv_MethodBase
   void *ncode (jclass);
   void compile (const void * const *);
 
-  static void run_normal (ffi_cif*, void*, ffi_raw*, void*);
-  static void run_synch_object (ffi_cif*, void*, ffi_raw*, void*);
-  static void run_class (ffi_cif*, void*, ffi_raw*, void*);
-  static void run_synch_class (ffi_cif*, void*, ffi_raw*, void*);
-  
-  static void run_normal_debug (ffi_cif*, void*, ffi_raw*, void*);
-  static void run_synch_object_debug (ffi_cif*, void*, ffi_raw*, void*);
-  static void run_class_debug (ffi_cif*, void*, ffi_raw*, void*);
-  static void run_synch_class_debug (ffi_cif*, void*, ffi_raw*, void*);
+#if FFI_NATIVE_RAW_API
+#  define INTERP_FFI_RAW_TYPE ffi_raw
+#else
+#  define INTERP_FFI_RAW_TYPE ffi_java_raw
+#endif
 
-  static void run (void *, ffi_raw *, _Jv_InterpMethod *);
-  static void run_debug (void *, ffi_raw *, _Jv_InterpMethod *);
+  static void run_normal (ffi_cif*, void*, INTERP_FFI_RAW_TYPE*, void*);
+  static void run_synch_object (ffi_cif*, void*, INTERP_FFI_RAW_TYPE*, void*);
+  static void run_class (ffi_cif*, void*, INTERP_FFI_RAW_TYPE*, void*);
+  static void run_synch_class (ffi_cif*, void*, INTERP_FFI_RAW_TYPE*, void*);
+  
+  static void run_normal_debug (ffi_cif*, void*, INTERP_FFI_RAW_TYPE*, void*);
+  static void run_synch_object_debug (ffi_cif*, void*, INTERP_FFI_RAW_TYPE*,
+                                     void*);
+  static void run_class_debug (ffi_cif*, void*, INTERP_FFI_RAW_TYPE*, void*);
+  static void run_synch_class_debug (ffi_cif*, void*, INTERP_FFI_RAW_TYPE*,
+                                    void*);
+
+  static void run (void *, INTERP_FFI_RAW_TYPE *, _Jv_InterpMethod *);
+  static void run_debug (void *, INTERP_FFI_RAW_TYPE *, _Jv_InterpMethod *);
   
 
   
@@ -361,7 +369,7 @@ class _Jv_JNIMethod : public _Jv_MethodBase
   ffi_type **jni_arg_types;
 
   // This function is used when making a JNI call from the interpreter.
-  static void call (ffi_cif *, void *, ffi_raw *, void *);
+  static void call (ffi_cif *, void *, INTERP_FFI_RAW_TYPE *, void *);
 
   void *ncode (jclass);
 
index fc2e1e5..f858c97 100644 (file)
@@ -576,7 +576,7 @@ details.  */
       {
        /* here goes the magic again... */
        ffi_cif *cif = &rmeth->cif;
-       ffi_raw *raw = (ffi_raw*) sp;
+       INTERP_FFI_RAW_TYPE *raw = (INTERP_FFI_RAW_TYPE *) sp;
 
        _Jv_value rvalue;
 
index 0622c39..6153c54 100644 (file)
@@ -346,7 +346,7 @@ get4 (unsigned char* loc)
 void
 _Jv_InterpMethod::run_normal (ffi_cif *,
                              void *ret,
-                             ffi_raw *args,
+                             INTERP_FFI_RAW_TYPE *args,
                              void *__this)
 {
   _Jv_InterpMethod *_this = (_Jv_InterpMethod *) __this;
@@ -356,7 +356,7 @@ _Jv_InterpMethod::run_normal (ffi_cif *,
 void
 _Jv_InterpMethod::run_normal_debug (ffi_cif *,
                                    void *ret,
-                                   ffi_raw *args,
+                                   INTERP_FFI_RAW_TYPE *args,
                                    void *__this)
 {
   _Jv_InterpMethod *_this = (_Jv_InterpMethod *) __this;
@@ -366,7 +366,7 @@ _Jv_InterpMethod::run_normal_debug (ffi_cif *,
 void
 _Jv_InterpMethod::run_synch_object (ffi_cif *,
                                    void *ret,
-                                   ffi_raw *args,
+                                   INTERP_FFI_RAW_TYPE *args,
                                    void *__this)
 {
   _Jv_InterpMethod *_this = (_Jv_InterpMethod *) __this;
@@ -380,7 +380,7 @@ _Jv_InterpMethod::run_synch_object (ffi_cif *,
 void
 _Jv_InterpMethod::run_synch_object_debug (ffi_cif *,
                                          void *ret,
-                                         ffi_raw *args,
+                                         INTERP_FFI_RAW_TYPE *args,
                                          void *__this)
 {
   _Jv_InterpMethod *_this = (_Jv_InterpMethod *) __this;
@@ -394,7 +394,7 @@ _Jv_InterpMethod::run_synch_object_debug (ffi_cif *,
 void
 _Jv_InterpMethod::run_class (ffi_cif *,
                             void *ret,
-                            ffi_raw *args,
+                            INTERP_FFI_RAW_TYPE *args,
                             void *__this)
 {
   _Jv_InterpMethod *_this = (_Jv_InterpMethod *) __this;
@@ -405,7 +405,7 @@ _Jv_InterpMethod::run_class (ffi_cif *,
 void
 _Jv_InterpMethod::run_class_debug (ffi_cif *,
                                   void *ret,
-                                  ffi_raw *args,
+                                  INTERP_FFI_RAW_TYPE *args,
                                   void *__this)
 {
   _Jv_InterpMethod *_this = (_Jv_InterpMethod *) __this;
@@ -416,7 +416,7 @@ _Jv_InterpMethod::run_class_debug (ffi_cif *,
 void
 _Jv_InterpMethod::run_synch_class (ffi_cif *,
                                   void *ret,
-                                  ffi_raw *args,
+                                  INTERP_FFI_RAW_TYPE *args,
                                   void *__this)
 {
   _Jv_InterpMethod *_this = (_Jv_InterpMethod *) __this;
@@ -431,7 +431,7 @@ _Jv_InterpMethod::run_synch_class (ffi_cif *,
 void
 _Jv_InterpMethod::run_synch_class_debug (ffi_cif *,
                                         void *ret,
-                                        ffi_raw *args,
+                                        INTERP_FFI_RAW_TYPE *args,
                                         void *__this)
 {
   _Jv_InterpMethod *_this = (_Jv_InterpMethod *) __this;
@@ -975,7 +975,8 @@ _Jv_InterpMethod::compile (const void * const *insn_targets)
 /* Run the given method.
    When args is NULL, don't run anything -- just compile it. */
 void
-_Jv_InterpMethod::run (void *retp, ffi_raw *args, _Jv_InterpMethod *meth)
+_Jv_InterpMethod::run (void *retp, INTERP_FFI_RAW_TYPE *args,
+                      _Jv_InterpMethod *meth)
 {
 #undef DEBUG
 #undef DEBUG_LOCALS_INSN
@@ -985,7 +986,8 @@ _Jv_InterpMethod::run (void *retp, ffi_raw *args, _Jv_InterpMethod *meth)
 }
 
 void
-_Jv_InterpMethod::run_debug (void *retp, ffi_raw *args, _Jv_InterpMethod *meth)
+_Jv_InterpMethod::run_debug (void *retp, INTERP_FFI_RAW_TYPE *args,
+                            _Jv_InterpMethod *meth)
 {
 #define DEBUG
 #undef DEBUG_LOCALS_INSN
@@ -1306,27 +1308,32 @@ _Jv_init_cif (_Jv_Utf8Const* signature,
   return item_count;
 }
 
-#if FFI_NATIVE_RAW_API
-#   define FFI_PREP_RAW_CLOSURE ffi_prep_raw_closure_loc
-#   define FFI_RAW_SIZE ffi_raw_size
-#else
-#   define FFI_PREP_RAW_CLOSURE ffi_prep_java_raw_closure_loc
-#   define FFI_RAW_SIZE ffi_java_raw_size
-#endif
-
 /* we put this one here, and not in interpret.cc because it
  * calls the utility routines _Jv_count_arguments 
  * which are static to this module.  The following struct defines the
  * layout we use for the stubs, it's only used in the ncode method. */
 
+#if FFI_NATIVE_RAW_API
+#   define FFI_PREP_RAW_CLOSURE ffi_prep_raw_closure_loc
+#   define FFI_RAW_SIZE ffi_raw_size
 typedef struct {
   ffi_raw_closure  closure;
   _Jv_ClosureList list;
   ffi_cif   cif;
   ffi_type *arg_types[0];
 } ncode_closure;
-
-typedef void (*ffi_closure_fun) (ffi_cif*,void*,ffi_raw*,void*);
+typedef void (*ffi_closure_fun) (ffi_cif*,void*,INTERP_FFI_RAW_TYPE*,void*);
+#else
+#   define FFI_PREP_RAW_CLOSURE ffi_prep_java_raw_closure_loc
+#   define FFI_RAW_SIZE ffi_java_raw_size
+typedef struct {
+  ffi_java_raw_closure  closure;
+  _Jv_ClosureList list;
+  ffi_cif   cif;
+  ffi_type *arg_types[0];
+} ncode_closure;
+typedef void (*ffi_closure_fun) (ffi_cif*,void*,ffi_java_raw*,void*);
+#endif
 
 void *
 _Jv_InterpMethod::ncode (jclass klass)
index a65952b..8bb2e59 100644 (file)
@@ -2293,7 +2293,8 @@ _Jv_LookupJNIMethod (jclass klass, _Jv_Utf8Const *name,
 // This function is the stub which is used to turn an ordinary (CNI)
 // method call into a JNI call.
 void
-_Jv_JNIMethod::call (ffi_cif *, void *ret, ffi_raw *args, void *__this)
+_Jv_JNIMethod::call (ffi_cif *, void *ret, INTERP_FFI_RAW_TYPE *args,
+                    void *__this)
 {
   _Jv_JNIMethod* _this = (_Jv_JNIMethod *) __this;
 
@@ -2325,8 +2326,9 @@ _Jv_JNIMethod::call (ffi_cif *, void *ret, ffi_raw *args, void *__this)
       }
   }
 
-  JvAssert (_this->args_raw_size % sizeof (ffi_raw) == 0);
-  ffi_raw real_args[2 + _this->args_raw_size / sizeof (ffi_raw)];
+  JvAssert (_this->args_raw_size % sizeof (INTERP_FFI_RAW_TYPE) == 0);
+  INTERP_FFI_RAW_TYPE
+      real_args[2 + _this->args_raw_size / sizeof (INTERP_FFI_RAW_TYPE)];
   int offset = 0;
 
   // First argument is always the environment pointer.