[LLVMdev] Improving Garbage Collection

Kenneth Uildriks kennethuil at gmail.com
Thu Jul 7 15:07:05 PDT 2011

On Wed, Jul 6, 2011 at 9:21 PM, Talin <viridia at gmail.com> wrote:
> That's an interesting suggestion.
> I realized, however, that there's another advantage to using type-based
> marking rather than an intrinsic - it allows you to declare function
> parameters as stack roots. Depending on the calling convention, some of the
> parameters to a function will be located on the stack while others will be
> passed in registers. The ones already in memory ought to be able to be
> traced right where they are, but unfortunately there's no way to mark them
> as roots with the intrinsic method - which means that the frontend has to
> copy the parameters into an alloca and then mark that as a root.
> --
> -- Talin

You don't need function parameters to be stack roots.  You already
have a stack root for those values in the calling function, right?

Anyway, declaring the function parameters as stack roots means that
you *must* pass pointers into the GC heap to those functions, whether
or not it makes any difference to the function itself.  That means,
among other things, that optimization passes for turning GC
allocations into pool allocations or local allocations become more

More information about the llvm-dev mailing list