[cxx-abi-dev] Lambda conversion

Jason Merrill jason at redhat.com
Mon Mar 22 20:57:58 UTC 2010


On 03/09/2010 12:36 PM, Gabriel Dos Reis wrote:
> On Tue, Mar 9, 2010 at 7:07 AM, Jason Merrill<jason at redhat.com>  wrote:

>> Implementation seems pretty straightforward: the conversion returns the
>> address of a static member function (call it __fn), and either the op()
>> calls __fn or __fn calls op() with a null object argument.
>>
>> Anyone object to "__fn" as the name of the static member function?
>
> I would probably suggest making the string 1 longer: "__fun".

I'm currently using _FUN to avoid a potential name clash with data 
members (which I rename by adding __ at the beginning so that the 
debugger can show something useful).

>> Any preference as to which way the call goes?  I suppose we need to take the
>> address of __fn in either case, which would argue for making op() the
>> wrapper.  OTOH, it might be a bit easier to implement leaving op() alone and
>> adding a function that calls it later.
>
> Is there any middle-end issue with a 'null object argument'?
> (the middle-end seems to be getting clever every day.)

I can't imagine why; the op() doesn't touch *this.

It occurred to me while implementing this that the obvious thunk-like 
implementation breaks down for variadic op() just like it does for 
covariant thunks.  I think I'd rather have that be a problem for the 
conversion rather than for direct calls to op().

Next issue: should _FUN share a comdat group with op() to allow it to be 
an alternate entry point?  I suppose so.

Jason



More information about the cxx-abi-dev mailing list