[LLVMdev] More Garbage Collection Questions
Talin
viridia at gmail.com
Sat Sep 15 15:01:01 PDT 2007
I'm still (slowly) working on the project of creating a concurrent
garbage collector that works with LLVM. I want to ask a little bit more
about object tags and write barriers and so on.
Let's start with the assumption that a particular language does not use
per-object type tags. The code generator knows the types of all objects,
however, and can pass along that type information to llvm.gcroot. And
since the type of each pointer field is also known, the type information
can be determined for each traced object, as long as there is no
polymorphism.
However, what I don't understand is how this works in the presence of
write barriers. The llvm_gc_write intrinsic takes no type information,
so there's no way to determine the type of the object except with a tag.
So I'm not sure what exactly the write barrier can accomplish.
Note that in a real language, most objects would have type tags, but
there would be a significant number of objects that did not. For
example, a 'string' class might have a fixed-length header with a type
tag, which in turn points to a flat array of characters with no tag. The
character array would not be visible to the outside world, but it would
still need to be visible to the collector.
-- Talin
More information about the llvm-dev
mailing list