[LLVMdev] Improving Garbage Collection

Talin viridia at gmail.com
Mon Jul 18 22:53:35 PDT 2011


On Mon, Jul 18, 2011 at 11:00 AM, Peter Lawrence
<peterl95124 at sbcglobal.net>wrote:

> Talin,
>           do you identify safe-points in the current or proposed llvm
> scheme, and if so how,
> or are they implicit as being at all call sites (which begs the question
> what about leaves
> in the call tree, how does GC get started at all in that case).
>
> The LLVM linker has a feature where you can specify what kind of safe
points your collector requires - the options are Loop, Return, PreCall and
PostCall. You can also override this behavior and examine each instruction
and return a boolean indicating whether it is or isn't a safe point.

Currently I only have function calls as safe points, although I may
eventually enable loops as well. As far as leaf functions go, consider that
the call to allocate memory is also a safe point - and if a function doesn't
allocate any memory then we don't care if the GC is involved or not.

One complication with the current scheme is that the frontend has to have a
sense of where the safe points are going to be. Because the current scheme
requires the frontend to insert additional loads and stores around safe
points (for spilling register values to memory so they can be traced), the
frontend has to be able to guess which function call might be a safe point -
but it can't know for sure due to the fact that optimization and inlining
(which happens much later) may cause the removal of the actual call
instruction. The safe but inefficient approach is to insert the extra loads
and stores around every call instruction.

Peter Lawrence.
>

-- 
-- Talin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110718/b57dcd48/attachment.html>


More information about the llvm-dev mailing list