[llvm-commits] [llvm] r41879 - in /llvm/trunk: docs/GarbageCollection.html lib/Transforms/Scalar/LowerGC.cpp

Chris Lattner clattner at apple.com
Wed Sep 12 11:26:53 PDT 2007


On Sep 12, 2007, at 11:14 AM, Gordon Henriksen wrote:
> Hm. Are you sure this is wise? I realize my patch didn't provide  
> root initialization, but I have that fixed locally. Without  
> liveness analysis, leaving stack roots uninitialized seems unwise,  
> since gc points are not entirely predictable from the IR.

I think it is fine.  trivially, any front-end that produced a call to  
the gcroot intrinsic could emit that intrinsic and a store of null,  
so there is no power lost here.

The reason it is useful is for things like this (C syntax):

void foo(object *P) {
   gcroot(&P, 0);

   ... use P ...
}

when converted to LLVM, this turns into the equivalent of:

void foo(object *P) {
   P_addr = alloca object*
   store P -> P_addr
   gcroot(P_addr, 0);

   ... use *P_addr...
}

With the null'ing property of gcroot, it would clobber the live in  
value.

-Chris



More information about the llvm-commits mailing list