[LLVMdev] getting started with IR needing GC

Jonathan S. Shapiro shap at eros-os.com
Mon Apr 28 07:50:46 PDT 2008


On Sun, 2008-04-27 at 22:34 -0400, Gordon Henriksen wrote:
> On 2008-04-27, at 21:29, Lane Schwartz wrote:
> > Since this is a simple copying collector, the functions llvm_gc_read
> > and llvm_gc_write won't really do much:
> > void *llvm_gc_read(void *ObjPtr, void **FieldPtr) { return  
> > *FieldPtr; }
> > void llvm_gc_write(void *V, void *ObjPtr, void **FieldPtr)  
> > { *FieldPtr = V; }
> 
> You can just emit loads and stores directly if your read/write  
> barriers do nothing. Also, there's nothing special about the  
> llvm_gc_read or llvm_gc_write functions any more; they will not be  
> called unless you call them yourself.

Gordon:

Since GC strategies change as implementations mature, is there a way to
go ahead and emit these calls, but then in a simple implementation
indicate somewhere that they should be trivially inlined? This would
allow us to debug things without imposing performance penalties on the
simple implementation.

Actually, I can see wanting to inline these even in barrier-oriented GC
implementations...

shap




More information about the llvm-dev mailing list