Commit Graph

793 Commits

Author SHA1 Message Date
Richard Henderson
a529bec27b arm: Add support for complex types 2014-11-12 09:32:36 +01:00
Richard Henderson
5e88ebe627 arm: Remove internal FFI_TYPE constants
These have been replaced by the contents of internal.h.
2014-11-12 09:32:13 +01:00
Richard Henderson
a4b785ea69 arm: Rewrite ffi_closure
Move the push of the argument registers into ffi_closure_SYSV,
reducing the size of the trampoline.
2014-11-12 09:32:13 +01:00
Richard Henderson
e7f15f60e8 arm: Rewrite ffi_call
Use the trick to allocate the stack frame for ffi_call_SYSV
within ffi_call itself.
2014-11-12 09:32:13 +01:00
Richard Henderson
a74a3aaddb arm: Rewrite vfp_type_p
Do not modify the ffi_type.  Rearrange the tests so that we
quickly eliminate structures that cannot match.  Return an
encoded value of element count and base type.
2014-11-12 09:32:13 +01:00
Richard Henderson
0d39b4bb69 arm: Deref ffi_put_arg arguments 2014-11-12 09:32:13 +01:00
Richard Henderson
57b24fb3f5 arm: Deref ffi_align argument 2014-11-12 09:32:13 +01:00
Richard Henderson
c129bea82a arm: Reindent arm/ffi.c 2014-11-12 09:32:13 +01:00
Richard Henderson
9761b7bb70 alpha: Add support for Go closures 2014-11-12 09:31:21 +01:00
Richard Henderson
f41bec3b57 alpha: Add support for complex types 2014-11-12 09:31:19 +01:00
Richard Henderson
5f917371af alpha: Clean up conversion of float values
Don't use "real" conversion to double, lest we raise
exceptions when passing signalling nans.
2014-11-12 09:30:59 +01:00
Richard Henderson
32a26b75ba alpha: Reorganize cif flags
Unties the backend from changes to FFI_TYPE_* constants, and allows
compilation to succeed after the addition of FFI_TYPE_COMPLEX.

Delete the hand-written unwind info.
2014-11-12 09:30:59 +01:00
Richard Henderson
c6352b664c aarch64: Add support for Go closures 2014-11-12 09:29:32 +01:00
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