[LLVMdev] Adding a custom GC safe point creation phase

Gordon Henriksen gordonhenriksen at mac.com
Mon Oct 31 18:21:39 PDT 2011


On 2011-10-31, at 17:21, Nicolas Geoffray wrote:

> Here's a patch to allow a GCStrategy to customize the places where it wants to insert safe points. I'm not sure who maintains the GC code today in LLVM (I'd be happy to take ownership, if needed).
> 
> The patch just adds up a custom safepoints flag, similar to the way the GCStrategy can customize intrinsics lowering, or roots initialization. It works pretty well, as I've tested it on VMKit. So the patch in itself should not be controversial.

Seems a perfectly reasonable patch on its own merits.

I would be curious what your findCustomSafePoints implementation looks like. Perhaps it's possible to extract some of it into the framework.

> Chris, I'd like to discuss with you on how we can improve the current GC framework to take advantage of metadata. The reason I add this custom safe point creation method is because it's difficult for a front-end to pass custom information to the GC framework. And I think metadata could help us in this situation. Ideally, I'd like to get to a point where we can write:
> 
> 15 = load %MyPointer* %2 !safepoint
> 
> And the GCStrategy would find this metadata information in the MachineInstruction (because the safe points are created based on MachineInstruction). This solution looks very much like the !nontemporal metadata.
> 
> Unfortunately, it looks like metadata are not passed down to MachineInstruction. How could we achieve that? Should we write custom code in the Instruction -> MachineInstruction transformation to pass down that !safepoint metadata?

Could such a program survive IR optimizations intact?

— Gordon



More information about the llvm-dev mailing list