diff options
author | David Daney <ddaney@avtrex.com> | 2007-12-06 22:02:22 +0000 |
---|---|---|
committer | David Daney <daney@gcc.gnu.org> | 2007-12-06 22:02:22 +0000 |
commit | 4c42b3d84fb4bd1539147b3aa1834d935818b869 (patch) | |
tree | 0d9df68f8f49c169b13d4425dee7410372b96a19 /libjava | |
parent | 6af5d898a5aa667e20681fb5284394ad77c2dc68 (diff) | |
download | gcc-4c42b3d84fb4bd1539147b3aa1834d935818b869.tar.gz |
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
Diffstat (limited to 'libjava')
-rw-r--r-- | libjava/ChangeLog | 10 | ||||
-rw-r--r-- | libjava/include/java-interp.h | 32 | ||||
-rw-r--r-- | libjava/interpret-run.cc | 2 | ||||
-rw-r--r-- | libjava/interpret.cc | 47 | ||||
-rw-r--r-- | libjava/jni.cc | 8 |
5 files changed, 63 insertions, 36 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 1c96742e35c..922a93bc2d7 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -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 diff --git a/libjava/include/java-interp.h b/libjava/include/java-interp.h index b0d0da411c1..c6d9955f4bf 100644 --- a/libjava/include/java-interp.h +++ b/libjava/include/java-interp.h @@ -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); diff --git a/libjava/interpret-run.cc b/libjava/interpret-run.cc index fc2e1e514c1..f858c971e0b 100644 --- a/libjava/interpret-run.cc +++ b/libjava/interpret-run.cc @@ -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; diff --git a/libjava/interpret.cc b/libjava/interpret.cc index 0622c3998f3..6153c542036 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) diff --git a/libjava/jni.cc b/libjava/jni.cc index a65952bedc9..8bb2e591881 100644 --- a/libjava/jni.cc +++ b/libjava/jni.cc @@ -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. |