Harmen van der Spek
2009-Mar-20 11:09 UTC
[LLVMdev] Garbage collection: Multiple copies of a root
Hi, As far as I understand now, only stack variables can be marked as gc roots. Our compiler however can also generate roots that are not necessarily on the stack. We can solve this by putting it on the stack anyway. So far so good. The problem is that we want to implement some sort of copying garbage collector. In this case, the roots on the stack must be updated. However, if this root is also stored in an IR register, then this pointer should be updated as well. Is there support for identifying and updating such references in the GC framework, or should we generate code ourselves to reload the updated references from the stack. Thanks, Harmen
Gordon Henriksen
2009-Mar-20 12:09 UTC
[LLVMdev] Garbage collection: Multiple copies of a root
On 2009-03-20, at 05:09, Harmen van der Spek wrote:> The problem is that we want to implement some sort of copying > garbage collector. In this case, the roots on the stack must be > updated. However, if this root is also stored in an IR register, > then this pointer should be updated as well. Is there support for > identifying and updating such references in the GC framework, or > should we generate code ourselves to reload the updated references > from the stack.You should generate code to reload the registers from the stack for now. We'd ultimately like to move to a model where LLVM automatically inserts the reloads, only as necessary, but are not there yet. — Gordon
Mattias Holm
2009-Mar-20 12:54 UTC
[LLVMdev] Garbage collection: Multiple copies of a root
Another open question is who is responsible for inserting calls to the collector routine (or signaling a collector thread)? My impression is that this has to be done in the front-end for now since there is no support for doing this at the safe points at the moment. Is this correct? Regards, Mattias On 20 Mar 2009, at 13:09, Gordon Henriksen wrote:> On 2009-03-20, at 05:09, Harmen van der Spek wrote: > >> The problem is that we want to implement some sort of copying >> garbage collector. In this case, the roots on the stack must be >> updated. However, if this root is also stored in an IR register, >> then this pointer should be updated as well. Is there support for >> identifying and updating such references in the GC framework, or >> should we generate code ourselves to reload the updated references >> from the stack. > > You should generate code to reload the registers from the stack for > now. We'd ultimately like to move to a model where LLVM automatically > inserts the reloads, only as necessary, but are not there yet. > > — Gordon > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev