[LLVMdev] getting started with IR needing GC

Lane Schwartz dowobeha at gmail.com
Mon Apr 28 11:28:21 PDT 2008

On Sun, Apr 27, 2008 at 9:34 PM, Gordon Henriksen
<gordonhenriksen at mac.com> wrote:
>  As for the compiler plugin interface, I suggest you ignore it
>  initially and use the provided shadow-stack option for the time being.
>  The shadow stack generates significantly suboptimal code, but will let
>  you avoid writing some platform-specific code. Instead, simply copy
>  the llvm_cg_walk_gcroots routine from the semispace example. Call it
>  from your collection routine in order to visit each gcroot on the
>  runtime stack.
>  The shadow stack lets you find roots by automatically emitting a
>  function prologue and an epilogue to push and pop gcroot entries on a
>  stack as the program runs. This avoids the need to traverse the native
>  call stack. If your language becomes sufficiently performance
>  sensitive, you can later investigate implementing a custom Collector
>  plugin.

OK. This is helpful in trying to understand what the Collector plugin is.

So is it correct then that the Collector plugin is the GC's view into
the backend? In other words, most garbage collectors have to have some
knowledge of how the runtime stack is actually laid out. ShadowStack
skirts around this issue by maintaining a "shadow" stack, so when the
GC needs info about the runtime stack, ShadowStack instead provides
info about the "shadow" stack. But most collector plugins would
instead have to know about the actual layout of the runtime stack. Is
that right?

If so, then a Collector plugin would need to have info about every
supported backend lays out the runtime stack?


More information about the llvm-dev mailing list