Commit Graph

813 Commits

Author SHA1 Message Date
Richard Henderson
f1301a54bb testsuite: Use feature test rather than enumeration for complex 2014-11-14 13:07:45 +01:00
Richard Henderson
b5ade2fb5d testsuite: Detect clang
Clang doesn't like the -Wno-psabi argument that we want to pass to GCC.
Since clang is detected as GCC via __GNUC__, use ax_cv_c_compiler_vendor.
2014-11-14 13:07:16 +01:00
Richard Henderson
5d69d57a05 configure: Move target source selection into configure.host
This eliminates the AM_CONDITIONAL ugliness, which eliminates
just a bit of extra boilerplate for a new target.

At the same time, properly categorize the EXTRA_DIST files
into SOURCES and HEADERS, for the generation of ctags.
2014-11-14 13:06:12 +01:00
Richard Henderson
57f5248457 configure: Split out configure.host
Split out the host case statement to a separate file, so that
we don't have to regenerate configure.in for changes therein.
2014-11-13 12:42:54 +01:00
Richard Henderson
f8632815a6 powerpc: Delete patch output
Clearly added by mistake.
2014-11-13 12:32:35 +01:00
Anthony Green
4aa702a0e0 Merge branch 'rth7680-go-closure' 2014-11-12 08:08:57 -05:00
Anthony Green
8d5debc790 Update in preparation for next release 2014-11-12 08:04:51 -05:00
Richard Henderson
56735e05fe Merge branch 'go-closure' of https://github.com/rth7680/libffi into rth7680-go-closure
Conflicts:
	src/aarch64/ffi.c
2014-11-12 07:51:12 -05:00
Anthony Green
20562ac042 Fix for AArch64. Release as 3.2.1. 2014-11-12 07:00:59 -05:00
Richard Henderson
0e303c0657 x86: Work around clang bugs
http://llvm.org/bugs/show_bug.cgi?21500
http://llvm.org/bugs/show_bug.cgi?21501
http://llvm.org/bugs/show_bug.cgi?21515
2014-11-12 03:58:58 -08:00
Richard Henderson
6eec410f15 sparc: Re-add abi compliant structure support
The original code, removed in the "rewrite" patch, was incorrect for
large structures, and required dynamic allocation of a trampoline on
every ffi_call.

Instead, allocate a 4k entry table of all possible structure returns.
The table is 80k, but is read-only and dynamically paged, which ought
to be better than allocating the trampoline.

This is difficult to test with gcc.  One can only use -O0 at present.
See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63668.
2014-11-12 09:36:11 +01:00
Richard Henderson
92022496ef sparc: Add support for Go closures 2014-11-12 09:36:11 +01:00
Richard Henderson
ad89c2d9e9 sparc: Add support for complex types 2014-11-12 09:36:09 +01:00
Richard Henderson
20da5b4132 sparc: Handle more cases of structure return directly 2014-11-12 09:35:24 +01:00
Richard Henderson
0686c2e71c sparc: Preprocess float point struct return
We can eliminate recursion and speed structure return
by flattening a nested structure tree into a bitmask.
2014-11-12 09:35:24 +01:00
Richard Henderson
2b27890ba7 sparc: Rewrite everything
It's impossible to call between v8 and v9 ABIs, because of the stack bias
in the v9 ABI.  So let's not pretend it's just not implemented yet.  Split
the v9 code out to a separate file.

The register windows prevent ffi_call from setting up the entire stack
frame the assembly, but we needn't make an indirect call back to prep_args.
2014-11-12 09:35:21 +01:00
Richard Henderson
5d7b544505 sparc: Tidy up symbols
Assembly to use local labels, .type annotation, hidden annotation.
I do retain the _prefix for the symbols, but given that it wasn't
done consistently across all symbols, I doubt it's actually needed.
2014-11-12 09:34:24 +01:00
Richard Henderson
fd4f7cc0ca sparc: Eliminate long double ifdefs 2014-11-12 09:34:24 +01:00
Richard Henderson
ab83cbb90b arm: Add support for Go closures 2014-11-12 09:32:39 +01:00
Richard Henderson
6fa617dabc arm: Add argument space for the hidden struct return pointer
This should have been failing all along, but it's only
exposed by the complex_int test case.
2014-11-12 09:32:39 +01:00
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