diff options
Diffstat (limited to 'libffi/include/ffi.h.in')
-rw-r--r-- | libffi/include/ffi.h.in | 54 |
1 files changed, 47 insertions, 7 deletions
diff --git a/libffi/include/ffi.h.in b/libffi/include/ffi.h.in index bffe7ffc96d..7784b2e395d 100644 --- a/libffi/include/ffi.h.in +++ b/libffi/include/ffi.h.in @@ -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); |