From 4c42b3d84fb4bd1539147b3aa1834d935818b869 Mon Sep 17 00:00:00 2001 From: David Daney Date: Thu, 6 Dec 2007 22:02:22 +0000 Subject: ffi.h.in (FFI_SIZEOF_JAVA_RAW): Define if not already defined. 2007-12-06 David Daney * 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 * 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 --- libjava/interpret.cc | 47 +++++++++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 20 deletions(-) (limited to 'libjava/interpret.cc') diff --git a/libjava/interpret.cc b/libjava/interpret.cc index 0622c39..6153c54 100644 --- a/libjava/interpret.cc +++ b/libjava/interpret.cc @@ -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) -- cgit v1.1