diff mbox

Use static chain and libffi for Go closures

Message ID CAFULd4bVaZ+P2n+W8aBCckPvGQPXf18ceRt+eCZ5Y8aqEEMcYQ@mail.gmail.com
State New
Headers show

Commit Message

Uros Bizjak Jan. 19, 2015, 6:11 p.m. UTC
On Sat, Jan 17, 2015 at 7:34 PM, Uros Bizjak <ubizjak@gmail.com> wrote:
> 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 is a more conservative v2 patch that conditionally enables
fixup code when FFI_TARGET_HAS_COMPLEX_TYPE is not defined.

Tested on x86_64-linux-gnu {-m32} without regressions.

Uros.

Comments

Richard Henderson Jan. 19, 2015, 6:14 p.m. UTC | #1
On 01/19/2015 10:11 AM, Uros Bizjak wrote:
> Attached is a more conservative v2 patch that conditionally enables
> fixup code when FFI_TARGET_HAS_COMPLEX_TYPE is not defined.
> 
> Tested on x86_64-linux-gnu {-m32} without regressions.

I don't think this version should be required.

For x86, FFI_TARGET_HAS_COMPLEX_TYPE is only false for Darwin, which
isn't supported by libgo at all.  There are many many other things
which would need to be fixed in order to get libgo working there.


r~
Uros Bizjak Jan. 19, 2015, 7:56 p.m. UTC | #2
On Mon, Jan 19, 2015 at 7:14 PM, Richard Henderson <rth@redhat.com> wrote:

>> Attached is a more conservative v2 patch that conditionally enables
>> fixup code when FFI_TARGET_HAS_COMPLEX_TYPE is not defined.
>>
>> Tested on x86_64-linux-gnu {-m32} without regressions.
>
> I don't think this version should be required.
>
> For x86, FFI_TARGET_HAS_COMPLEX_TYPE is only false for Darwin, which
> isn't supported by libgo at all.  There are many many other things
> which would need to be fixed in order to get libgo working there.

Thanks!

Then v1 patch that removes the now unneeded code is the way to go.

Uros.
diff mbox

Patch

Index: runtime/go-ffi.c
===================================================================
--- runtime/go-ffi.c	(revision 219832)
+++ runtime/go-ffi.c	(working copy)
@@ -290,8 +290,8 @@  go_func_return_ffi (const struct __go_func_type *f
 
   if (count == 1)
     {
-
-#if defined (__i386__) && !defined (__x86_64__)
+#ifndef FFI_TARGET_HAS_COMPLEX_TYPE
+# 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
@@ -300,6 +300,7 @@  go_func_return_ffi (const struct __go_func_type *f
 	 by pretending that complex64 is int64.  */
       if ((types[0]->__code & GO_CODE_MASK) == GO_COMPLEX64)
 	return &ffi_type_sint64;
+# endif
 #endif
 
       return go_type_to_ffi (types[0]);