closure vars typeinfo

Timon Gehr timon.gehr at gmx.ch
Wed Jun 12 13:11:05 PDT 2013


On 06/12/2013 02:08 AM, Adam D. Ruppe wrote:
> I'm catching up on the dconf videos tonight and just watched the precise
> garbage collector one, where he said there's no info for closures. Would
> it work if the closure's void* went to something along these lines?
>
> struct Closure {
>      // magic a magic number to help identify this block
>
>      size_t number_of_variables_captured;
>      TypeInfo[number_of_vars_captured] capturedVarTypes;
>
>      // whatever else is needed
>
>      ubyte[xx] capturedVars;
> }
>
> The gc could read this and it might be useful for debugging too.
>
> But I'm mostly just wondering if you guys thought any more about how to
> (or if you want to) tackle this at the conference.

The info shouldn't be stored inline, since it is shared by all closures 
created at the same site.


More information about the Digitalmars-d mailing list