[LLVMdev] ocaml+llvm

Chris Lattner sabre at nondot.org
Sun Aug 19 17:43:48 PDT 2007


On Aug 14, 2007, at 4:35 AM, Gordon Henriksen wrote:

> On Aug 14, 2007, at 06:24, Gordon Henriksen wrote:
>
>> The two major problems I had really boil down to identifying GC  
>> points in machine code and statically identifying live roots at  
>> those GC points, both problems common to many collection  
>> techniques. Looking at the problem from that perspective makes the  
>> problem much more tractable, actually…
>
> Chris,
>
> This is much more generic than what I was originally thinking, but  
> what do you think of providing a facility like this?
> That could enable several kinds of conservative collectors.

I'm not sure I follow what you mean.

> The code generator would need to cooperate by:
>
>  1. Inserting nodes for GC points if required, recording the  
> corresponding original Instruction*.
>  2. Recording the physical location of each llvm.gcroot'd alloca.

This is somewhat implicit in the design we want.  The only question  
is how to identify these at runtime.  In theory, the code generator  
already knows what the gc points are and where the pointers on the  
stack are located.  For a "cooperative" code generator, the codegen  
should emit tables (similar to EH tables) that describe this, and the  
llvm code generator callback should enumerate these.

> Later, a MachineFunctionPass could walk the MachineFunction to  
> lower these nodes. Live roots can be identified using domination  
> information.

These are optimizations that can be implemented in the code  
generator, there are many others as well.  For the time being, we  
don't even have real dominator info in the code generator though..

-Chris







More information about the llvm-dev mailing list