Laurynas Biveinis wrote:
> Hi,
> 
>> There is a root list, generated by gengtype from parsing the files
>> looking for those GTY markers.
>>
>> So, if you look at ggc_mark_roots, you can see the walker that is
>> walking the root table.
>>
>> If you look in your *build* directory, and grep for ggc_root_tab, you
>> will see where the roots are.
> 
> Thanks, that's exactly what I didn't know :)

I only know this stuff from working on ggc-zone, and hacking up
gengtype/friends for copying collection :)
It was a complete mystery to me when i started as well.

> 
>> Again, these are all auto-generated from gengtype.  You can simply
>> register them with boehm once gcc starts, because the root set never
>> changes.
> 
> As far as I can understand, current GGC-ors do not simply register
> them as a additional roots - they walk them all the way down by the
> pointers and mark stuff as required during collection. Now, if I add
> the roots to Boehm's GC, this traversal and marking will be done
> internally by Boehm's GC. The question is, does GCC have any data
> structures looking like this: root -> some GC'ed memory -> some
> malloc'ed memory -> some GC'ed memory (or similar)?  Such cases should
> be OK with current GGC schemes, but Boehm's GC would be lost here.

No, because this would not be safe with the current collectors either.
One longstanding problem is that you can only mark gc'd memory from gc'd
memory, and it doesn't know to just not try to mark the malloc'd memory,
but to keep walking.
In fact, if you have gc'd memory pointing to malloc'd memory that isn't
marked with GTY ((skip)), it will attempt to walk + mark it and the
collector will crash :).

If you stare at ggc_set_mark, you'll see that the pagetable lookup for
the pages will crash if you try to ask it about non-gc'd memory. :)

This issue causes a lot of things to be placed in gc memory just because
they happen to have pointers to gc memory (basic blocks, etc), but
happens to be helpful for you. :)

Reply via email to