This is the mail archive of the
mailing list for the GCC project.
Re: [gofrontend-dev] Re: [PATCH 03/13] HACK! Allow the static chain to be set from C
- From: Peter Collingbourne <pcc at google dot com>
- To: Ian Lance Taylor <iant at google dot com>
- Cc: Richard Henderson <rth at redhat dot com>, gcc-patches <gcc-patches at gcc dot gnu dot org>, "libffi-discuss at sourceware dot org" <libffi-discuss at sourceware dot org>, "gofrontend-dev at googlegroups dot com" <gofrontend-dev at googlegroups dot com>
- Date: Fri, 10 Oct 2014 18:42:27 -0700
- Subject: Re: [gofrontend-dev] Re: [PATCH 03/13] HACK! Allow the static chain to be set from C
- Authentication-results: sourceware.org; auth=none
- References: <1412973773-3942-1-git-send-email-rth at redhat dot com> <1412973773-3942-4-git-send-email-rth at redhat dot com> <CAKOQZ8xivpespK-4HwXJrgpH72K0eHyJhpDzftnJHvdNCOTJZg at mail dot gmail dot com> <CAMn1gO7vJOcNi218p9m32de_rrnKBrUcGF-EKP3dJwaL+8BtUw at mail dot gmail dot com>
On Fri, Oct 10, 2014 at 6:06 PM, Peter Collingbourne <email@example.com> wrote:
> On Fri, Oct 10, 2014 at 5:33 PM, 'Ian Lance Taylor' via gofrontend-dev
> <firstname.lastname@example.org> wrote:
>> On Fri, Oct 10, 2014 at 1:42 PM, Richard Henderson <email@example.com> wrote:
>> > This is awful syntax, and therefore contains no documentation.
>> > But we'll need to be able to set the static chain on a few calls
>> > within the Go runtime, so we need to expose this by some means.
>> > It currently looks like
>> > function(args...) __builtin_call_chain(pointer)
>> > because that was easy to parse.
>> How crazy would it be to move __builtin_call_chain into the function
>> arguments, as in
>> function(a1, a2, __builtin_call_chain(pointer))
>> This __builtin_call_chain call would be removed from the argument list
>> so type checking would only look at a1, a2. It would just set the
>> static chain value. That at least puts the call_chain in the right
>> place, which is a special kind of function argument.
> Clang will need to be able to parse this syntax too, so let's not do
> anything that diverges too much from the standard.
> Can we perhaps make this look like a new calling convention? So e.g. you
> could do:
> (((void (__attribute__((chaincall)) *)(void *, int, int)))function)(pointer,
> a1, a2);
A colleague has suggested a perhaps nicer syntax:
__builtin_call_chain(pointer, call) where call must be a call expression