[LLVMdev] GC questions.

Tobias Nurmiranta spyck at lysator.liu.se
Wed Jul 21 11:32:05 PDT 2004


On Wed, 21 Jul 2004, Chris Lattner wrote:
> On Wed, 21 Jul 2004, Tobias Nurmiranta wrote:
>
> This will work, but it would be better to take two pointers in instead of
> a pointer and offset.  This allows the front-end to emit target-generic
> code instead of target-specific code (where it would have to know the
> offset to the field).  To be more specific, llvm_gc_read should look like
> this by default:
>
> void *llvm_gc_read(void *ObjPtr, void **FieldPtr) {
>   return *FieldPtr;
> }

Hm, but doesn't FieldPtr need to be calculated target-specific in those
cases?

My thoughts was that it's better to just have one pointer to the heap, and
reference fields by offset, rather than alloca'ing memory for each
FieldPtr needed (to make sure the recording of gcroots is sound). If we
use FieldPtr we get the problem again with the GC traversing pointers into
objects, rather than to their headers.

Or have I missed something? :)

,	Tobias




More information about the llvm-dev mailing list