Use static chain and libffi for Go closures
Uros Bizjak
ubizjak@gmail.com
Sat Jan 17 19:08:00 GMT 2015
On Sat, Jan 17, 2015 at 12:19 AM, Ian Lance Taylor <iant@golang.org> wrote:
>> You should also revert alpha specific change to
>> libgo/go/testing/quick/quick_test.go, please see [1] and [2].
>>
>> [1] https://gcc.gnu.org/ml/gcc-patches/2013-03/msg00038.html
>> [2] https://gcc.gnu.org/ml/gcc-patches/2013-03/msg00038/foo.patch
>
> Done like so. Committed to mainline.
Thanks!
There is another part in runtime/go-ffi.c that looks like it is not
necessary anymore with FFI_TARGET_HAS_COMPLEX_TYPE.
Attached proto-patch that removes special Complex64 handling survives
go regression test for i686 target. However, some of i686 targets
don't define FFI_TARGET_HAS_COMPLEX_TYPE, so at least this part should
be conditional on !ifndef FFI_TARGET_HAS_COMPLEX_TYPE.
Uros.
-------------- next part --------------
Index: libgo/runtime/go-ffi.c
===================================================================
--- libgo/runtime/go-ffi.c (revision 219797)
+++ libgo/runtime/go-ffi.c (working copy)
@@ -289,22 +289,8 @@ go_func_return_ffi (const struct __go_func_type *f
types = (const struct __go_type_descriptor **) func->__out.__values;
if (count == 1)
- {
+ return go_type_to_ffi (types[0]);
-#if defined (__i386__) && !defined (__x86_64__)
- /* FFI does not support complex types. On 32-bit x86, a
- complex64 will be returned in %eax/%edx. We normally tell
- FFI that a complex64 is a struct of two floats. On 32-bit
- x86 a struct of two floats is returned via a hidden first
- pointer parameter. Fortunately we can make everything work
- by pretending that complex64 is int64. */
- if ((types[0]->__code & GO_CODE_MASK) == GO_COMPLEX64)
- return &ffi_type_sint64;
-#endif
-
- return go_type_to_ffi (types[0]);
- }
-
ret = (ffi_type *) __go_alloc (sizeof (ffi_type));
ret->type = FFI_TYPE_STRUCT;
ret->elements = (ffi_type **) __go_alloc ((count + 1) * sizeof (ffi_type *));
More information about the Gcc-patches
mailing list