Commit 4c42b3d8 by David Daney Committed by David Daney

ffi.h.in (FFI_SIZEOF_JAVA_RAW): Define if not already defined.

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
parent 6af5d898
2007-12-06 David Daney <ddaney@avtrex.com> 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 * src/mips/n32.S (ffi_closure_N32): Use 64-bit add instruction on
pointer values. pointer values.
......
...@@ -193,6 +193,10 @@ typedef struct { ...@@ -193,6 +193,10 @@ typedef struct {
# endif # endif
#endif #endif
#ifndef FFI_SIZEOF_JAVA_RAW
# define FFI_SIZEOF_JAVA_RAW FFI_SIZEOF_ARG
#endif
typedef union { typedef union {
ffi_sarg sint; ffi_sarg sint;
ffi_arg uint; ffi_arg uint;
...@@ -201,6 +205,21 @@ typedef union { ...@@ -201,6 +205,21 @@ typedef union {
void* ptr; void* ptr;
} ffi_raw; } 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 ffi_raw_call (ffi_cif *cif,
void (*fn)(), void (*fn)(),
void *rvalue, void *rvalue,
...@@ -217,10 +236,10 @@ size_t ffi_raw_size (ffi_cif *cif); ...@@ -217,10 +236,10 @@ size_t ffi_raw_size (ffi_cif *cif);
void ffi_java_raw_call (ffi_cif *cif, void ffi_java_raw_call (ffi_cif *cif,
void (*fn)(), void (*fn)(),
void *rvalue, 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_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_java_raw *raw);
void ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args); void ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_java_raw *raw, void **args);
size_t ffi_java_raw_size (ffi_cif *cif); size_t ffi_java_raw_size (ffi_cif *cif);
/* ---- Definitions for closures ----------------------------------------- */ /* ---- Definitions for closures ----------------------------------------- */
...@@ -271,6 +290,27 @@ typedef struct { ...@@ -271,6 +290,27 @@ typedef struct {
} ffi_raw_closure; } 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_status
ffi_prep_raw_closure (ffi_raw_closure*, ffi_prep_raw_closure (ffi_raw_closure*,
ffi_cif *cif, ffi_cif *cif,
...@@ -285,15 +325,15 @@ ffi_prep_raw_closure_loc (ffi_raw_closure*, ...@@ -285,15 +325,15 @@ ffi_prep_raw_closure_loc (ffi_raw_closure*,
void *codeloc); void *codeloc);
ffi_status ffi_status
ffi_prep_java_raw_closure (ffi_raw_closure*, ffi_prep_java_raw_closure (ffi_java_raw_closure*,
ffi_cif *cif, ffi_cif *cif,
void (*fun)(ffi_cif*,void*,ffi_raw*,void*), void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*),
void *user_data); void *user_data);
ffi_status ffi_status
ffi_prep_java_raw_closure_loc (ffi_raw_closure*, ffi_prep_java_raw_closure_loc (ffi_java_raw_closure*,
ffi_cif *cif, ffi_cif *cif,
void (*fun)(ffi_cif*,void*,ffi_raw*,void*), void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*),
void *user_data, void *user_data,
void *codeloc); void *codeloc);
......
...@@ -54,13 +54,13 @@ ffi_java_raw_size (ffi_cif *cif) ...@@ -54,13 +54,13 @@ ffi_java_raw_size (ffi_cif *cif)
case FFI_TYPE_UINT64: case FFI_TYPE_UINT64:
case FFI_TYPE_SINT64: case FFI_TYPE_SINT64:
case FFI_TYPE_DOUBLE: case FFI_TYPE_DOUBLE:
result += 2 * FFI_SIZEOF_ARG; result += 2 * FFI_SIZEOF_JAVA_RAW;
break; break;
case FFI_TYPE_STRUCT: case FFI_TYPE_STRUCT:
/* No structure parameters in Java. */ /* No structure parameters in Java. */
abort(); abort();
default: default:
result += FFI_SIZEOF_ARG; result += FFI_SIZEOF_JAVA_RAW;
} }
} }
...@@ -69,7 +69,7 @@ ffi_java_raw_size (ffi_cif *cif) ...@@ -69,7 +69,7 @@ ffi_java_raw_size (ffi_cif *cif)
void 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; unsigned i;
ffi_type **tp = cif->arg_types; ffi_type **tp = cif->arg_types;
...@@ -90,7 +90,7 @@ ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args) ...@@ -90,7 +90,7 @@ ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args)
*args = (void*) ((char*)(raw++) + 2); *args = (void*) ((char*)(raw++) + 2);
break; break;
#if FFI_SIZEOF_ARG == 8 #if FFI_SIZEOF_JAVA_RAW == 8
case FFI_TYPE_UINT64: case FFI_TYPE_UINT64:
case FFI_TYPE_SINT64: case FFI_TYPE_SINT64:
case FFI_TYPE_DOUBLE: case FFI_TYPE_DOUBLE:
...@@ -105,7 +105,8 @@ ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args) ...@@ -105,7 +105,8 @@ ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args)
default: default:
*args = raw; *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) ...@@ -116,7 +117,7 @@ ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args)
/* then assume little endian */ /* then assume little endian */
for (i = 0; i < cif->nargs; i++, tp++, args++) for (i = 0; i < cif->nargs; i++, tp++, args++)
{ {
#if FFI_SIZEOF_ARG == 8 #if FFI_SIZEOF_JAVA_RAW == 8
switch((*tp)->type) { switch((*tp)->type) {
case FFI_TYPE_UINT64: case FFI_TYPE_UINT64:
case FFI_TYPE_SINT64: case FFI_TYPE_SINT64:
...@@ -127,10 +128,11 @@ ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args) ...@@ -127,10 +128,11 @@ ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args)
default: default:
*args = (void*) raw++; *args = (void*) raw++;
} }
#else /* FFI_SIZEOF_ARG != 8 */ #else /* FFI_SIZEOF_JAVA_RAW != 8 */
*args = (void*) raw; *args = (void*) raw;
raw += ALIGN ((*tp)->size, sizeof (void*)) / sizeof (void*); raw +=
#endif /* FFI_SIZEOF_ARG == 8 */ ALIGN ((*tp)->size, sizeof(ffi_java_raw)) / sizeof(ffi_java_raw);
#endif /* FFI_SIZEOF_JAVA_RAW == 8 */
} }
#else #else
...@@ -141,7 +143,7 @@ ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args) ...@@ -141,7 +143,7 @@ ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args)
} }
void 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; unsigned i;
ffi_type **tp = cif->arg_types; ffi_type **tp = cif->arg_types;
...@@ -202,7 +204,7 @@ ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw) ...@@ -202,7 +204,7 @@ ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw)
(raw++)->flt = *(FLOAT32*) (*args); (raw++)->flt = *(FLOAT32*) (*args);
break; break;
#if FFI_SIZEOF_ARG == 8 #if FFI_SIZEOF_JAVA_RAW == 8
case FFI_TYPE_UINT64: case FFI_TYPE_UINT64:
case FFI_TYPE_SINT64: case FFI_TYPE_SINT64:
case FFI_TYPE_DOUBLE: case FFI_TYPE_DOUBLE:
...@@ -216,11 +218,12 @@ ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw) ...@@ -216,11 +218,12 @@ ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw)
break; break;
default: default:
#if FFI_SIZEOF_ARG == 8 #if FFI_SIZEOF_JAVA_RAW == 8
FFI_ASSERT(0); /* Should have covered all cases */ FFI_ASSERT(0); /* Should have covered all cases */
#else #else
memcpy ((void*) raw->data, (void*)*args, (*tp)->size); 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 #endif
} }
} }
...@@ -244,6 +247,9 @@ ffi_java_rvalue_to_raw (ffi_cif *cif, void *rvalue) ...@@ -244,6 +247,9 @@ ffi_java_rvalue_to_raw (ffi_cif *cif, void *rvalue)
case FFI_TYPE_SINT16: case FFI_TYPE_SINT16:
case FFI_TYPE_SINT32: case FFI_TYPE_SINT32:
case FFI_TYPE_INT: case FFI_TYPE_INT:
#if FFI_SIZEOF_JAVA_RAW == 4
case FFI_TYPE_POINTER:
#endif
*(SINT64 *)rvalue <<= 32; *(SINT64 *)rvalue <<= 32;
break; break;
...@@ -269,6 +275,9 @@ ffi_java_raw_to_rvalue (ffi_cif *cif, void *rvalue) ...@@ -269,6 +275,9 @@ ffi_java_raw_to_rvalue (ffi_cif *cif, void *rvalue)
case FFI_TYPE_SINT16: case FFI_TYPE_SINT16:
case FFI_TYPE_SINT32: case FFI_TYPE_SINT32:
case FFI_TYPE_INT: case FFI_TYPE_INT:
#if FFI_SIZEOF_JAVA_RAW == 4
case FFI_TYPE_POINTER:
#endif
*(SINT64 *)rvalue >>= 32; *(SINT64 *)rvalue >>= 32;
break; break;
...@@ -285,7 +294,8 @@ ffi_java_raw_to_rvalue (ffi_cif *cif, void *rvalue) ...@@ -285,7 +294,8 @@ ffi_java_raw_to_rvalue (ffi_cif *cif, void *rvalue)
* these following couple of functions will handle the translation forth * these following couple of functions will handle the translation forth
* and back automatically. */ * 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*)); void **avalue = (void**) alloca (cif->nargs * sizeof (void*));
ffi_java_raw_to_ptrarray (cif, raw, avalue); ffi_java_raw_to_ptrarray (cif, raw, avalue);
...@@ -299,7 +309,7 @@ static void ...@@ -299,7 +309,7 @@ static void
ffi_java_translate_args (ffi_cif *cif, void *rvalue, ffi_java_translate_args (ffi_cif *cif, void *rvalue,
void **avalue, void *user_data) 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_raw_closure *cl = (ffi_raw_closure*)user_data;
ffi_java_ptrarray_to_raw (cif, avalue, raw); ffi_java_ptrarray_to_raw (cif, avalue, raw);
...@@ -308,9 +318,9 @@ ffi_java_translate_args (ffi_cif *cif, void *rvalue, ...@@ -308,9 +318,9 @@ ffi_java_translate_args (ffi_cif *cif, void *rvalue,
} }
ffi_status 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, ffi_cif *cif,
void (*fun)(ffi_cif*,void*,ffi_raw*,void*), void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*),
void *user_data, void *user_data,
void *codeloc) void *codeloc)
{ {
...@@ -335,9 +345,9 @@ ffi_prep_java_raw_closure_loc (ffi_raw_closure* cl, ...@@ -335,9 +345,9 @@ ffi_prep_java_raw_closure_loc (ffi_raw_closure* cl,
* the pointer-array format, to the raw format */ * the pointer-array format, to the raw format */
ffi_status ffi_status
ffi_prep_java_raw_closure (ffi_raw_closure* cl, ffi_prep_java_raw_closure (ffi_java_raw_closure* cl,
ffi_cif *cif, ffi_cif *cif,
void (*fun)(ffi_cif*,void*,ffi_raw*,void*), void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*),
void *user_data) void *user_data)
{ {
return ffi_prep_java_raw_closure_loc (cl, cif, fun, user_data, cl); return ffi_prep_java_raw_closure_loc (cl, cif, fun, user_data, cl);
......
...@@ -42,10 +42,13 @@ ...@@ -42,10 +42,13 @@
#ifdef FFI_MIPS_O32 #ifdef FFI_MIPS_O32
/* O32 stack frames have 32bit integer args */ /* O32 stack frames have 32bit integer args */
#define FFI_SIZEOF_ARG 4 # define FFI_SIZEOF_ARG 4
#else #else
/* N32 and N64 frames have 64bit integer args */ /* 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 #endif
#define FFI_FLAG_BITS 2 #define FFI_FLAG_BITS 2
......
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> 2007-12-06 Andreas Tobler <a.tobler@schweiz.org>
* testsuite/libjava.jni/jni.exp (gcj_jni_get_cxxflags_invocation): Make * testsuite/libjava.jni/jni.exp (gcj_jni_get_cxxflags_invocation): Make
......
...@@ -222,18 +222,26 @@ class _Jv_InterpMethod : public _Jv_MethodBase ...@@ -222,18 +222,26 @@ class _Jv_InterpMethod : public _Jv_MethodBase
void *ncode (jclass); void *ncode (jclass);
void compile (const void * const *); void compile (const void * const *);
static void run_normal (ffi_cif*, void*, ffi_raw*, void*); #if FFI_NATIVE_RAW_API
static void run_synch_object (ffi_cif*, void*, ffi_raw*, void*); # define INTERP_FFI_RAW_TYPE ffi_raw
static void run_class (ffi_cif*, void*, ffi_raw*, void*); #else
static void run_synch_class (ffi_cif*, void*, ffi_raw*, void*); # define INTERP_FFI_RAW_TYPE ffi_java_raw
#endif
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*);
static void run (void *, ffi_raw *, _Jv_InterpMethod *); static void run_normal (ffi_cif*, void*, INTERP_FFI_RAW_TYPE*, void*);
static void run_debug (void *, ffi_raw *, _Jv_InterpMethod *); 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 ...@@ -361,7 +369,7 @@ class _Jv_JNIMethod : public _Jv_MethodBase
ffi_type **jni_arg_types; ffi_type **jni_arg_types;
// This function is used when making a JNI call from the interpreter. // 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); void *ncode (jclass);
......
...@@ -576,7 +576,7 @@ details. */ ...@@ -576,7 +576,7 @@ details. */
{ {
/* here goes the magic again... */ /* here goes the magic again... */
ffi_cif *cif = &rmeth->cif; ffi_cif *cif = &rmeth->cif;
ffi_raw *raw = (ffi_raw*) sp; INTERP_FFI_RAW_TYPE *raw = (INTERP_FFI_RAW_TYPE *) sp;
_Jv_value rvalue; _Jv_value rvalue;
......
...@@ -346,7 +346,7 @@ get4 (unsigned char* loc) ...@@ -346,7 +346,7 @@ get4 (unsigned char* loc)
void void
_Jv_InterpMethod::run_normal (ffi_cif *, _Jv_InterpMethod::run_normal (ffi_cif *,
void *ret, void *ret,
ffi_raw *args, INTERP_FFI_RAW_TYPE *args,
void *__this) void *__this)
{ {
_Jv_InterpMethod *_this = (_Jv_InterpMethod *) __this; _Jv_InterpMethod *_this = (_Jv_InterpMethod *) __this;
...@@ -356,7 +356,7 @@ _Jv_InterpMethod::run_normal (ffi_cif *, ...@@ -356,7 +356,7 @@ _Jv_InterpMethod::run_normal (ffi_cif *,
void void
_Jv_InterpMethod::run_normal_debug (ffi_cif *, _Jv_InterpMethod::run_normal_debug (ffi_cif *,
void *ret, void *ret,
ffi_raw *args, INTERP_FFI_RAW_TYPE *args,
void *__this) void *__this)
{ {
_Jv_InterpMethod *_this = (_Jv_InterpMethod *) __this; _Jv_InterpMethod *_this = (_Jv_InterpMethod *) __this;
...@@ -366,7 +366,7 @@ _Jv_InterpMethod::run_normal_debug (ffi_cif *, ...@@ -366,7 +366,7 @@ _Jv_InterpMethod::run_normal_debug (ffi_cif *,
void void
_Jv_InterpMethod::run_synch_object (ffi_cif *, _Jv_InterpMethod::run_synch_object (ffi_cif *,
void *ret, void *ret,
ffi_raw *args, INTERP_FFI_RAW_TYPE *args,
void *__this) void *__this)
{ {
_Jv_InterpMethod *_this = (_Jv_InterpMethod *) __this; _Jv_InterpMethod *_this = (_Jv_InterpMethod *) __this;
...@@ -380,7 +380,7 @@ _Jv_InterpMethod::run_synch_object (ffi_cif *, ...@@ -380,7 +380,7 @@ _Jv_InterpMethod::run_synch_object (ffi_cif *,
void void
_Jv_InterpMethod::run_synch_object_debug (ffi_cif *, _Jv_InterpMethod::run_synch_object_debug (ffi_cif *,
void *ret, void *ret,
ffi_raw *args, INTERP_FFI_RAW_TYPE *args,
void *__this) void *__this)
{ {
_Jv_InterpMethod *_this = (_Jv_InterpMethod *) __this; _Jv_InterpMethod *_this = (_Jv_InterpMethod *) __this;
...@@ -394,7 +394,7 @@ _Jv_InterpMethod::run_synch_object_debug (ffi_cif *, ...@@ -394,7 +394,7 @@ _Jv_InterpMethod::run_synch_object_debug (ffi_cif *,
void void
_Jv_InterpMethod::run_class (ffi_cif *, _Jv_InterpMethod::run_class (ffi_cif *,
void *ret, void *ret,
ffi_raw *args, INTERP_FFI_RAW_TYPE *args,
void *__this) void *__this)
{ {
_Jv_InterpMethod *_this = (_Jv_InterpMethod *) __this; _Jv_InterpMethod *_this = (_Jv_InterpMethod *) __this;
...@@ -405,7 +405,7 @@ _Jv_InterpMethod::run_class (ffi_cif *, ...@@ -405,7 +405,7 @@ _Jv_InterpMethod::run_class (ffi_cif *,
void void
_Jv_InterpMethod::run_class_debug (ffi_cif *, _Jv_InterpMethod::run_class_debug (ffi_cif *,
void *ret, void *ret,
ffi_raw *args, INTERP_FFI_RAW_TYPE *args,
void *__this) void *__this)
{ {
_Jv_InterpMethod *_this = (_Jv_InterpMethod *) __this; _Jv_InterpMethod *_this = (_Jv_InterpMethod *) __this;
...@@ -416,7 +416,7 @@ _Jv_InterpMethod::run_class_debug (ffi_cif *, ...@@ -416,7 +416,7 @@ _Jv_InterpMethod::run_class_debug (ffi_cif *,
void void
_Jv_InterpMethod::run_synch_class (ffi_cif *, _Jv_InterpMethod::run_synch_class (ffi_cif *,
void *ret, void *ret,
ffi_raw *args, INTERP_FFI_RAW_TYPE *args,
void *__this) void *__this)
{ {
_Jv_InterpMethod *_this = (_Jv_InterpMethod *) __this; _Jv_InterpMethod *_this = (_Jv_InterpMethod *) __this;
...@@ -431,7 +431,7 @@ _Jv_InterpMethod::run_synch_class (ffi_cif *, ...@@ -431,7 +431,7 @@ _Jv_InterpMethod::run_synch_class (ffi_cif *,
void void
_Jv_InterpMethod::run_synch_class_debug (ffi_cif *, _Jv_InterpMethod::run_synch_class_debug (ffi_cif *,
void *ret, void *ret,
ffi_raw *args, INTERP_FFI_RAW_TYPE *args,
void *__this) void *__this)
{ {
_Jv_InterpMethod *_this = (_Jv_InterpMethod *) __this; _Jv_InterpMethod *_this = (_Jv_InterpMethod *) __this;
...@@ -975,7 +975,8 @@ _Jv_InterpMethod::compile (const void * const *insn_targets) ...@@ -975,7 +975,8 @@ _Jv_InterpMethod::compile (const void * const *insn_targets)
/* Run the given method. /* Run the given method.
When args is NULL, don't run anything -- just compile it. */ When args is NULL, don't run anything -- just compile it. */
void 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
#undef DEBUG_LOCALS_INSN #undef DEBUG_LOCALS_INSN
...@@ -985,7 +986,8 @@ _Jv_InterpMethod::run (void *retp, ffi_raw *args, _Jv_InterpMethod *meth) ...@@ -985,7 +986,8 @@ _Jv_InterpMethod::run (void *retp, ffi_raw *args, _Jv_InterpMethod *meth)
} }
void 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 #define DEBUG
#undef DEBUG_LOCALS_INSN #undef DEBUG_LOCALS_INSN
...@@ -1306,27 +1308,32 @@ _Jv_init_cif (_Jv_Utf8Const* signature, ...@@ -1306,27 +1308,32 @@ _Jv_init_cif (_Jv_Utf8Const* signature,
return item_count; 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 /* we put this one here, and not in interpret.cc because it
* calls the utility routines _Jv_count_arguments * calls the utility routines _Jv_count_arguments
* which are static to this module. The following struct defines the * 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. */ * 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 { typedef struct {
ffi_raw_closure closure; ffi_raw_closure closure;
_Jv_ClosureList list; _Jv_ClosureList list;
ffi_cif cif; ffi_cif cif;
ffi_type *arg_types[0]; ffi_type *arg_types[0];
} ncode_closure; } ncode_closure;
typedef void (*ffi_closure_fun) (ffi_cif*,void*,INTERP_FFI_RAW_TYPE*,void*);
typedef void (*ffi_closure_fun) (ffi_cif*,void*,ffi_raw*,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 * void *
_Jv_InterpMethod::ncode (jclass klass) _Jv_InterpMethod::ncode (jclass klass)
......
...@@ -2293,7 +2293,8 @@ _Jv_LookupJNIMethod (jclass klass, _Jv_Utf8Const *name, ...@@ -2293,7 +2293,8 @@ _Jv_LookupJNIMethod (jclass klass, _Jv_Utf8Const *name,
// This function is the stub which is used to turn an ordinary (CNI) // This function is the stub which is used to turn an ordinary (CNI)
// method call into a JNI call. // method call into a JNI call.
void 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; _Jv_JNIMethod* _this = (_Jv_JNIMethod *) __this;
...@@ -2325,8 +2326,9 @@ _Jv_JNIMethod::call (ffi_cif *, void *ret, ffi_raw *args, void *__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); JvAssert (_this->args_raw_size % sizeof (INTERP_FFI_RAW_TYPE) == 0);
ffi_raw real_args[2 + _this->args_raw_size / sizeof (ffi_raw)]; INTERP_FFI_RAW_TYPE
real_args[2 + _this->args_raw_size / sizeof (INTERP_FFI_RAW_TYPE)];
int offset = 0; int offset = 0;
// First argument is always the environment pointer. // First argument is always the environment pointer.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment