This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Thoughts about GC root sets


Laurynas Biveinis wrote:
> Daniel, first of all, how would you prefer to communicate on general
> GCC issues? Is it OK to send e-mail to you and to gcc mailing list, or
> should I send such mails to gcc mailing list only?

Copying me is fine for me.


> 
> Some of the GCC roots live on the heap memory, e.g. ident_table. These
> are not found by Boehm's GC by default. I've started fixing such
> places by registering these additional roots. But it got me thinking:
> how do the old GCC garbage collectors know about those roots?

There is a root list, generated by gengtype from parsing the files
looking for those GTY markers.


 I do not
> see any root registration calls, but maybe I do not know where to
> look. 


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.

Again, these are all auto-generated from gengtype.  You can simply
register them with boehm once gcc starts, because the root set never
changes.

One thing i should mention to you at this point, if you haven't
discovered yet, is that it is *not safe* to do collections in between
ggc_collect calls right now (IE when ggc_alloc is called).

At least, not without walking *everything* looking around for possible
roots, because places don't expect ggc_alloc'd memory without a "real"
root (IE registered in the root table) memory to disappear until the
next ggc_collect call.

Thus, it is common practice for intra-pass garbage is just allocated
without a root using ggc_alloc, and expected to disappear by virtue of
having no registered root the next time ggc_collect is called.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]