Thanks for the info guys, very helpful. Folks following along at home may
be interested in seeing where & how compiler writes out the set of tydescs:

https://github.com/mozilla/rust/blob/1393c3a3f438c896083405dca501c8cf05767c65/src/librustc/middle/trans/glue.rs#L766

I had assumed for some reason that they were local to some unit of
execution -- didn't realize that they were global (although that should
have been obvious, thinking about it).

Cheers,
Tom


On Thu, May 23, 2013 at 11:14 AM, Graydon Hoare <[email protected]> wrote:

> On 23/05/2013 3:33 AM, Tom Lee wrote:
>
>  Can anybody out there offer some clarification about the following?
>>
>>   * What are glue_fns and why are they necessary? How/why do they differ
>>
>>     from shim_fns (used to invoke foreign functions)?
>>
>
> Glue functions are invoked by the compiler when types are dropped or
> copied. They manage the lifecycle of the type, and are ubiquitous and
> compiler-generated. They have nothing to do with shim functions aside from
> them both being compiler-generated (and too-numerous for our taste!)
>
>    * What's the purpose of /visit_glue/ in the type_desc struct? The
>>
>>     others seem largely obvious (take/drop doing some sort of
>>     refcounting, free to clean up, but visit ... ?)
>>
>
> Visit is for reflection. See core::reflect (renamed last night to
> std::reflect).
>
>    * Where are type_descs/tydescs written? The stack? The heap(s)? (i.e.
>>
>>     anything that can be a GC root?) Where in the source code does this
>>     happen?
>>
>
> They're global constant static data. Compiler-generated.
>
>    * What exactly is a "safe point" wrt the garbage collector?
>>
>
> The name refers to the idea (in many GCs) of a place in a code-sequence at
> which the compiler has to spill references back to stack locations or
> otherwise arrive at a state properly described by metadata / frame maps,
> such that it can find all roots. It's only relevant in a precise GC. Since
> the current strategy for GC is conservative (presently _everywhere_, though
> this will eventually be limited to just-the-stack) there's on such need:
> the GC just spills all registers on entry and treats them as possible-roots
> like very other word on the stack.
>
> If you see the term in our code, it's residue from the most recent
> experiment with precise GC, which has been (for the time being) abandoned.
>
> -Graydon
>
>


-- 
*Tom Lee */ http://tomlee.co / @tglee <http://twitter.com/tglee>
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to