Richard Henderson
0e41c73b09
aarch64: Move x8 out of call_context
...
Reduces stack size. It was only used by the closure, and there
are available argument registers.
2014-11-12 09:29:32 +01:00
Richard Henderson
a992f8789b
aarch64: Add support for complex types
2014-11-12 09:29:31 +01:00
Richard Henderson
658b2b5600
aarch64: Remove aarch64_flags
...
This field was useless from the start, since the normal flags
field is available for backend use.
2014-11-12 09:28:44 +01:00
Richard Henderson
4a3cbcaa4f
aarch64: Unify scalar fp and hfa handling
...
Since an HFA of a single element is exactly the same as scalar,
this tidies things up a bit.
2014-11-12 09:28:44 +01:00
Richard Henderson
12cf89ee04
aarch64: Move return value handling into ffi_closure_SYSV
...
As with the change to ffi_call_SYSV, this avoids copying data
into a temporary buffer.
2014-11-12 09:28:44 +01:00
Richard Henderson
4fe1aea121
aarch64: Move return value handling into ffi_call_SYSV
...
This lets us pass return data directly to the caller of ffi_call
in most cases, rather than storing it into temporary storage first.
2014-11-12 09:28:44 +01:00
Richard Henderson
325471ea6a
aarch64: Merge prep_args with ffi_call
...
Use the trick to allocate the stack frame for ffi_call_SYSV
within ffi_call itself.
2014-11-12 09:28:44 +01:00
Richard Henderson
8c8161cb62
aarch64: Tidy up abi manipulation
...
Avoid false abstraction, like get_x_addr. Avoid recomputing data
about the type being manipulated. Use NEON insns for HFA manipulation.
Note that some of the inline assembly will go away in a subsequent patch.
2014-11-12 09:28:44 +01:00
Richard Henderson
b55e03665d
aarch64: Treat void return as not passed in registers
...
This lets us do less post-processing when there's no return value.
2014-11-12 09:28:44 +01:00
Richard Henderson
2e32f9bf6f
aarch64: Use correct return registers
...
There are fewer return registers than argument registers.
2014-11-12 09:28:44 +01:00
Richard Henderson
95a04af134
aarch64: Reduce the size of register_context
...
We don't need to store 32 general and vector registers.
Only 8 of each are used for parameter passing.
2014-11-12 09:28:44 +01:00
Richard Henderson
77c4cddca6
aarch64: Simplify AARCH64_STACK_ALIGN
...
The iOS abi doesn't require padding between arguments, but
that's not what AARCH64_STACK_ALIGN meant. The hardware will
in fact trap if the SP register is not 16 byte aligned.
2014-11-12 09:28:44 +01:00
Richard Henderson
b5f147d847
aarch64: Always distinguish LONGDOUBLE
...
Avoid if-deffery by forcing FFI_TYPE_LONGDOUBLE different
from FFI_TYPE_DOUBLE. This will simply be unused on hosts
that define them identically.
2014-11-12 09:28:44 +01:00
Richard Henderson
38b54b9c18
aarch64: Improve is_hfa
...
The set of functions get_homogeneous_type, element_count, and is_hfa
are all intertwined and recompute data. Return a compound quantity
from is_hfa that contains all the data and avoids the recomputation.
2014-11-12 09:28:44 +01:00
Richard Henderson
18b74ce54a
aarch64: Fix non-apple compilation
2014-11-12 09:28:44 +01:00
Richard Henderson
2650f47fe8
x86: Use win32 name mangling for fastcall functions
2014-11-12 09:16:02 +01:00
Richard Henderson
f8c64e2486
x86: Add support for Go closures
2014-11-12 09:16:02 +01:00
Richard Henderson
198f469e91
x86: Add support for Complex
2014-11-12 09:16:02 +01:00
Richard Henderson
b21ec1ce78
x86: Rewrite closures
...
Move everything into sysv.S, removing win32.S and freebsd.S.
Handle all abis with a single ffi_closure_inner function.
Move complexity of the raw THISCALL trampoline into assembly
instead of the trampoline itself.
Only push the context for the REGISTER abi; let the rest
receive it in a register.
2014-11-12 09:15:54 +01:00
Richard Henderson
b9ac94f3af
x86: Rewrite ffi_call
...
Decouple the assembly from FFI_TYPE_*. Merge prep_args with ffi_call,
passing the frame and the stack to the assembly.
Note that this patch isn't really standalone, as this breaks closures.
2014-11-12 09:15:35 +01:00
Richard Henderson
159d3788eb
x86: Convert to gas generated unwind info
2014-11-12 09:15:35 +01:00
Richard Henderson
e7b0056d60
x86: Force FFI_TYPE_LONGDOUBLE different from FFI_TYPE_DOUBLE
...
There are few abis that set double = long double. Eliminate the
conditional compilation and let this code simply be unused there.
2014-11-12 09:15:35 +01:00
Richard Henderson
4b2fad8fd5
x86: Remove some conditional compilation
...
Removal of ifdefs made possible to due to ffi_abi unification.
2014-11-12 09:15:35 +01:00
Richard Henderson
ef76205647
x86: Tidy ffi_abi
...
The x86_64 unix port only handles one ABI; don't define all of the
other symbols. The UNIX64 symbol retains the same value.
The i386 ports ought to have the same symbols, even if we can't yet
unify the values without incrementing the libffi soname.
2014-11-12 09:15:35 +01:00
Richard Henderson
7cf841324f
testsuite: Add two dg-do run markers
...
Caught by clang warning about unused -L parameter.
2014-11-12 09:15:35 +01:00
Richard Henderson
fc501750f4
testsuite: Fix return_complex2 vs excessive precision
...
Use the previously computed rc2 to validate, rather than
recomputing a floating point result with excess precision.
2014-11-12 09:15:35 +01:00
Richard Henderson
610c90bf71
x86_64: Add support for complex types
2014-11-12 09:15:35 +01:00
Richard Henderson
32c5683163
x86_64: Decouple return types from FFI_TYPE constants
...
We can better support structure returns, and as prep for
complex types.
2014-11-12 09:15:35 +01:00
Richard Henderson
2e9dc16556
x86_64: Fixups for x32
2014-11-12 09:15:35 +01:00
Richard Henderson
ebd82769de
win64: Remove support from ffi.c
2014-11-12 09:15:35 +01:00
Richard Henderson
99db4d42ac
win64: Rewrite
...
It's way too different from the 32-bit ABIs with which it is
currently associated. As seen from all of the existing XFAILs.
2014-11-12 09:15:35 +01:00
Richard Henderson
6b62fb4a26
x86-64: Support go closures
...
Dumps all of the hand-coded unwind info for gas generated. Move jump
table data into .rodata. Adjust ffi_call_unix64 to load the static
chain. Split out sse portions of ffi_closure_unix64 to
ffi_closure_unix64_sse rather than test cif->flags at runtime.
2014-11-12 09:15:35 +01:00
Richard Henderson
89bbde8b4e
Add ffi_cfi.h
...
Have one copy of the HAVE_AS_CFI_PSEUDO_OP code
to share between all backends.
2014-11-12 09:15:35 +01:00
Richard Henderson
e951d64c08
Add entry points for interacting with Go
...
A "ffi_go_closure" is intended to be compatible with the
function descriptors used by Go, and ffi_call_go sets up
the static chain parameter for calling a Go function.
The entry points are disabled when a backend has not been
updated, much like we do for "normal" closures.
2014-11-12 09:15:35 +01:00
Anthony Green
a0bdc5250c
Fix typo
2014-11-11 09:43:01 -05:00
Anthony Green
67c0c07053
Final 3.2 changes
2014-11-11 07:30:49 -05:00
Anthony Green
ee826b933b
Final 3.2 changes
2014-11-11 07:29:26 -05:00
Anthony Green
c81a705d53
Mention OpenRISC
2014-11-04 13:29:58 -05:00
Anthony Green
6a17ad540d
Merge pull request #134 from s-macke/openrisc
...
Add OpenRISC support
2014-09-28 00:54:00 -04:00
Anthony Green
990eb9d4c2
Only run the complex type tests on supported platforms.
2014-09-28 00:50:29 -04:00
Sebastian Macke
0f316ab7c1
Add OpenRISC support
...
This patch adds support for the OpenRISC architecture.
(http://opencores.org/or1k/Main_Page )
This patch has been tested under Linux with QEMU-user emulation support.
- 32 Bit
- big endian
- delayed instructions
This is the only available configuration under Linux.
The description of the ABI can be found on the official website.
Is passes the testsuite except of the unwindtest_ffi_call.cc
testcase, which seems to be a problem of gcc and not libffi.
Some testcases of the gcc testsuite still fail.
Signed-off-by: Sebastian Macke <sebastian@macke.de >
2014-09-27 00:56:56 +00:00
Anthony Green
6695983d2f
Add complex type support. Mostly broken right now
2014-09-20 07:44:37 -04:00
Anthony Green
fbbf48fbdf
Compile tests with -Wno-psabi when using GCC
2014-09-20 07:43:51 -04:00
Anthony Green
ae8d2554c5
Update version to 3.2
2014-09-20 07:08:37 -04:00
Anthony Green
b2ca59d39d
More README updates for 3.2
2014-09-20 07:08:05 -04:00
Anthony Green
f920a01ad8
Update release notes.
2014-09-20 06:54:06 -04:00
Bernd Edlinger
bfcbf329c5
2014-05-11 Bernd Edlinger <bernd.edlinger@hotmail.de>
...
Fix current cygwin-64 build problems.
* src/java_raw_api.c: Remove if !defined(FFI_NO_RAW_API).
* src/x86/ffi.c: Add if defined(__CYGWIN__).
* src/x86/win64.S (ffi_closure_win64, ffi_call_win64): Added
handling for FFI_TYPE_UINT64, FFI_TYPE_POINTER and FFI_TYPE_INT.
Added SEH information. Fixed formatting.
2014-09-20 06:51:45 -04:00
Jakub Jelinek
32cb2ce81d
2014-09-10 Jakub Jelinek <jakub@redhat.com>
...
* src/powerpc/linux64.S: Emit .note.GNU-stack even when
POWERPC64 is not defined.
* src/powerpc/linux64_closure.S: Likewise. Also test _CALL_ELF == 2.
2014-09-20 06:39:55 -04:00
Matthias Klose
aaf3101ba8
Fix -Werror=declaration-after-statement problem
2014-09-20 06:37:04 -04:00
Dominik Vogt
6e8a446083
2014-07-22 Dominik Vogt <vogt@linux.vnet.ibm.com>
...
* src/types.c (FFI_TYPEDEF, FFI_NONCONST_TYPEDEF): Merge the macros by
adding another argument that controls whether the result is const or not
(FFI_LDBL_CONST): Temporary macro to reduce ifdef confusion
* src/prep_cif.c (ffi_prep_cif_core): Replace list of systems with new
macro FFI_TARGET_SPECIFIC_STACK_SPACE_ALLOCATION
* src/pa/ffitarget.h (FFI_TARGET_SPECIFIC_STACK_SPACE_ALLOCATION):
Define.
* src/s390/ffitarget.h (FFI_TARGET_SPECIFIC_STACK_SPACE_ALLOCATION):
Define.
* src/x86/ffitarget.h (FFI_TARGET_SPECIFIC_STACK_SPACE_ALLOCATION):
Define.
2014-07-22 Dominik Vogt <vogt@linux.vnet.ibm.com >
* doc/libffi.texi (Primitive Types): Document ffi_type_complex_float,
ffi_type_complex_double and ffi_type_complex_longdouble
(Complex Types): New subsection.
(Complex Type Example): Ditto.
* testsuite/libffi.call/cls_align_complex_double.c: New
FFI_TYPE_COMPLEX test.
* testsuite/libffi.call/cls_align_complex_float.c: Ditto.
* testsuite/libffi.call/cls_align_complex_longdouble.c: Ditto.
* testsuite/libffi.call/cls_complex_double.c: Ditto.
* testsuite/libffi.call/cls_complex_float.c: Ditto.
* testsuite/libffi.call/cls_complex_longdouble.c: Ditto.
* testsuite/libffi.call/cls_complex_struct_double.c: Ditto.
* testsuite/libffi.call/cls_complex_struct_float.c: Ditto.
* testsuite/libffi.call/cls_complex_struct_longdouble.c: Ditto.
* testsuite/libffi.call/cls_complex_va_double.c: Ditto.
* testsuite/libffi.call/cls_complex_va_float.c: Ditto.
* testsuite/libffi.call/cls_complex_va_longdouble.c: Ditto.
* testsuite/libffi.call/complex_double.c: Ditto.
* testsuite/libffi.call/complex_defs_double.c: Ditto.
* testsuite/libffi.call/complex_float.c: Ditto.
* testsuite/libffi.call/complex_defs_float.c: Ditto.
* testsuite/libffi.call/complex_longdouble.c: Ditto.
* testsuite/libffi.call/complex_defs_longdouble.c: Ditto.
* testsuite/libffi.call/complex_int.c: Ditto.
* testsuite/libffi.call/many_complex_double.c: Ditto.
* testsuite/libffi.call/many_complex_float.c: Ditto.
* testsuite/libffi.call/many_complex_longdouble.c: Ditto.
* testsuite/libffi.call/return_complex1_double.c: Ditto.
* testsuite/libffi.call/return_complex1_float.c: Ditto.
* testsuite/libffi.call/return_complex1_longdouble.c: Ditto.
* testsuite/libffi.call/return_complex2_double.c: Ditto.
* testsuite/libffi.call/return_complex2_float.c: Ditto.
* testsuite/libffi.call/return_complex2_longdouble.c: Ditto.
* testsuite/libffi.call/return_complex_double.c: Ditto.
* testsuite/libffi.call/return_complex_float.c: Ditto.
* testsuite/libffi.call/return_complex_longdouble.c: Ditto.
* src/raw_api.c (ffi_raw_to_ptrarray): Handle FFI_TYPE_COMPLEX
(ffi_ptrarray_to_raw): Ditto.
* src/prep_cif.c (ffi_prep_cif_core): Abort if FFI_TYPE_COMPLEX is not
implemented in libffi for the target.
* src/java_raw_api.c (ffi_java_raw_size): FFI_TYPE_COMPLEX not supported
yet (abort).
(ffi_java_raw_to_ptrarray): Ditto.
(ffi_java_rvalue_to_raw): Ditto.
(ffi_java_raw_to_rvalue): Ditto.
* src/debug.c (ffi_type_test): Add debug tests for complex types.
* include/ffi.h.in (FFI_TYPE_COMPLEX): Add new FFI_TYPE_COMPLEX.
(FFI_TYPE_LAST): Bump.
(ffi_type_complex_float): Add new ffi_type_....
(ffi_type_complex_double): Ditto.
(ffi_type_complex_longdouble): Ditto.
2014-07-22 Dominik Vogt <vogt@linux.vnet.ibm.com >
* src/s390/ffitarget.h (FFI_TARGET_HAS_COMPLEX_TYPE): Define to provide
FFI_TYPE_COMPLEX support.
* src/s390/ffi.c (ffi_check_struct_type): Implement FFI_TYPE_COMPLEX
(ffi_prep_args): Ditto.
(ffi_prep_cif_machdep): Ditto.
(ffi_closure_helper_SYSV): Ditto.
2014-09-20 06:24:41 -04:00