This is the mail archive of the
libffi-discuss@sourceware.org
mailing list for the libffi project.
Re: [PATCH 00/13] Go closures, libffi, and the static chain
- From: Richard Henderson <rth at redhat dot com>
- To: "Lynn A. Boger" <laboger at linux dot vnet dot ibm dot com>, gcc-patches at gcc dot gnu dot org, libffi-discuss at sourceware dot org, gofrontend-dev at googlegroups dot com, ian at airs dot com
- Date: Thu, 06 Nov 2014 14:04:17 +0100
- Subject: Re: [PATCH 00/13] Go closures, libffi, and the static chain
- Authentication-results: sourceware.org; auth=none
- References: <1412973773-3942-1-git-send-email-rth at redhat dot com> <545A97BA dot 3030507 at linux dot vnet dot ibm dot com> <545B1C44 dot 3000306 at redhat dot com> <20141106124838 dot GJ30857 at bubble dot grove dot modra dot org>
On 11/06/2014 01:48 PM, Alan Modra wrote:
> On Thu, Nov 06, 2014 at 07:59:16AM +0100, Richard Henderson wrote:
>> I haven't done powerpc yet. If you'd like to help, I'd be delighted.
>
> I was going to say that it doesn't look too difficult, but then I
> noticed we have a problem. PowerPC uses r11 as the static chain,
> a register that is allowed to be used by linkage stubs.
Hum.
At the moment, the static chain is not part of the ABI -- it's private to the
translation unit. But as soon as we start using this for the Go closure, it
does become part of the ABI, so it would be best if we can choose a different
register.
That said, this *may* not actually be a problem. It's not the direct (possibly
lazy bound) call into libffi that needs a static chain, it's the indirect call
that libffi produces. And the indirect calls that Go produces.
I'm pretty sure that there are no dynamically linked Go calls that require the
static chain. They're used for closures, which are either fully indirect from
a different translation unit, or locally bound closures through which the
optimizer has seen the construction, and optimized to a direct call.
Ian, have I missed a case where a closure could wind up with a direct call to a
lazy bound function?
r~