[LLVMdev] Garbage collection
Andrew Haley
aph at redhat.com
Mon Mar 2 02:31:21 PST 2009
Nicolas Geoffray wrote:
>> For example, I mentioned the "stop the world" function - however since
>> LLVM defines no primitives for creating threads or synchronizing between
>> them, its hard to see how this could be part of LLVM proper.
>
> So LLVM should not be aware of "stop the world" stuff. It's really a
> matter of your collector. What LLVM should be aware is the position of
> safe points in the code. That's the case with Gordon's GCStrategy class.
> However, to implement "stop the world", runtimes should be able to add
> runtime-specific code at these safe points. If you could, then adding a
> cooperative, stop-the-world GC would be straightforward. Just poll a
> variable during the safe-point. When a collection is required, the
> collector updates that variable and waits for all threads to poll it.
Yes, I agree. That's exactly what we need for Shark, which uses Sun's
Java VM.
Andrew.
More information about the llvm-dev
mailing list