This is the mail archive of the libffi-discuss@sourceware.org mailing list for the libffi project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 00/13] Go closures, libffi, and the static chain


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~


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]