[LLVMdev] getting closer!

Gordon Henriksen gordonhenriksen at mac.com
Mon Apr 21 18:23:30 PDT 2008


On Apr 21, 2008, at 20:09, Terence Parr wrote:

> Ok, I *might* be getting this from the assembly code.  ...  From  
> that, it will push/pop in functions?  If so, that's easy enough. :)

Yup! Sounds like you've got it.

> What I was/am missing is the explicit link between types and  
> variables in a GC.c file and the generated machine code.  If I can  
> get that last explicit link, I'm off to the races.

You mean, how do you know what sort of object you're tracing? You've  
got 3 options here…

• If you have an type tree (as in Java or .NET), you can assume that  
every root starts with a pointer to object metadata, which should  
naturally include GC tracing information.
• If you have a type forest (as in C or C++) with optional vtables,  
then no such assumption is possible, and you can include type layout  
information in the %metadata parameter to @llvm.gcroot. The FrameMap  
type includes this data.
• You can tag values, as in lisp or many functional languages. (e.g.,  
integer values have the low bit set, pointers do not.) All fields in a  
block must be of a uniform size, and you'll still need to know how  
many words in a block.

This decision is completely agnostic to the decision to use the shadow  
stack, or something more efficient.

— Gordon





More information about the llvm-dev mailing list