[llvm-dev] Status of Garbage Collection with Statepoints in LLVM
Martin Kustermann via llvm-dev
llvm-dev at lists.llvm.org
Thu Mar 3 10:42:21 PST 2016
Hello LLVM community,
We have been experimenting with using LLVM IR as a target for a managed
(dynamically typed) language via an AOT compiler (including a backend for
ARM). One main challenge is getting the garbage collection right: We would
like to be able to implement a moving collector. This requires us to a)
find a precise set of root pointers and b) be able to rewrite those
pointers after objects moved.
LLVM seems to provide two mechanisms for doing this: via "gcroot" and via
"statepoints". The [statepoints] documentation indicates the first option,
namely "gcroot", is only viable for conservative collectors and statepoints
might eventually replace gcroot. So we wanted to try out the statepoints
Though it turned out that:
* the pass for inserting statepoints is hard-coded to only work with
samples and CLR (see [placesafepoints])
* the pass for rewriting statepoints is hard-coded to only work with
samples and CLR (see [rewritestatepoints])
* the only backend supporting statepoints right now seems to be 64-bit
intel (see [backend-x64])
Since the ARM backend (and e.g. 32-bit intel) doesn't seem to have support
for lowering statepoints-using IR, we were rather disappointed.
We are now experimenting with keeping a shadow stack which contains all the
managed pointers, but since the IR we emit contains reads/write to this
shadow stack (and the shadow stack escapes on calls), the performance
suffers significantly, since LLVM can't perform a lot of the optimizations
it could otherwise do (IIRC the statepoints approach doesn't have this
problem, since the statepoints can be inserted *after* optimization passes
Is there any timeline for the statepoints support in LLVM?
Is there a list of things that currently work / don't work with safepoints?
What is the recommended approach for moving GCs when using LLVM (what are
Thanks in advance,
Sidenote: It would be beneficial for users if the [statepoints]
documentation would highlight the current status and limitations.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev