[LLVMdev] Why LLVM should NOT have garbage collection intrinsics[MESSAGE NOT SCANNED]

Mark Shannon marks at dcs.gla.ac.uk
Sun Mar 1 11:11:27 PST 2009


Gordon Henriksen wrote:

> You'll certainly need to map roots on the stack and use write barriers.
> 
> • shadow-stack is an easy, portable way to bring up root discovery.  
> You can switch to static stack maps later (with the requirement that  
> your runtime be able to crawl the machine stack, which is out-of-scope  
> for LLVM unless Talin makes some progress with his GC building blocks).

This this is the crux of my argument:
Without the ability to traverse the stack in a portable way, the only 
way I can write a portable GC is to avoid the llvm intrinsics.
Therefore, they are useless and should be removed.

However, if the ability to traverse the stack is added to llvm then most 
of my objections to the intrinsics disappear.

> • As you observe, your write barrier can be written in LLVM IR without  
> the use of the llvm.gcwrite intrinsic if you so desire. Otherwise, you  
> can perform the IR-to-IR transform to eliminate llvm.gcwrite using the  
> performCustomLowering hook.
> 
> What else is blocking you?
> 

Nothing, except the lack of stack traversal code ;)

Once the portable stack-traversal code is available, I'll port my GC, as 
promised.

Thanks for taking the time to discuss this.
You've just about convinced me that the intrinsics should stay, but I 
still think the interface to the GC subsystem is (currently) a bit of a 
mess.

Mark.





More information about the llvm-dev mailing list