[LLVMdev] 2.2 garbage collector questions

Jaap Suter
Tue, 05 Feb 2008 17:22:36 -0000

> LLVM currently lacks working examples demonstrating the use of garbage
> collection...

Hello,

if anybody has time, I would recommend putting a big disclaimer at the top of
the garbage collection page that explains that, for the most part, garbage
collection falls outside of LLVM's domain.

Right now LLVM advertises itself as "supporting garbage collecting",
which
although true, somewhat misses the point. LLVM just happens to not get in the
way. The only real garbage collection feature that LLVM provides is accurate
stack walking, and even that can be implemented separately through a shadow
stack.

That the documentation contains llvm.gc intrinsics is a bit of a red herring.
You end up doing most of the work yourself. To illustrate, for our own LLVM work
we implemented garbage collecting completely without using any LLVM primitives.
Granted, we're a conservative collector right now, and once we go accurate
we'll
investigate the stack-walking.

Just a head's up from an beginner/intermediate LLVM programmer. The current
state of the GC documentation makes it seem as if: "you just connect the GC
and
it works". I'm sure that isn't the intention, but judging from some
of the posts
on this mailing lists over the past months, this seems to be a common
expectation.

Two cents...

Jaap Suter