[LLVMdev] ocaml+llvm

Gordon Henriksen gordonhenriksen at mac.com
Mon Aug 13 14:52:47 PDT 2007


On 2007-08-13, at 16:58, Carl Friedrich Bolz wrote:

> Chris Lattner wrote:
>
>> I don't think you want to try to have the LLVM code generator  
>> build this table.  The table is a contract between the specific  
>> codegen you're using and the GC runtime you're using.  This  
>> contract is specific to the current ocaml code generator.
>>
>> In the LLVM world, you should use the first-class support we  
>> already have for accurate GC: http://llvm.org/docs/ 
>> GarbageCollection.html
>
> I was wondering recently: are there actually any projects that are  
> using these facilities? Preferably ones that I could take a look at?

Just the strawman implementation in lib/Transforms/Scalar/LowerGC.cpp  
and runtime/SemiSpace/semispace.c, which is not functional.  
llvm_gc_collect ends with 'abort()', among other problems. :)

>> Based on this, you annotate the variables with llvm.gcroot  
>> intrinsics, and then walk the stack with the llvm_cg_walk_gcroots  
>> function.  Note that these are not well tested and probably have  
>> holes in them, but these are the interfaces we want to use :)
>
> How is this function actually implemented? Is there special stack- 
> walking code emitted or does LLVM keep an extra stack of roots?

The latter. LowerGC.cpp maintains a linked list of frames. The  
structure is even more obvious in semispace.c.

— Gordon

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20070813/1f2ce01f/attachment.html>


More information about the llvm-dev mailing list