This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Thoughts about GC root sets
- From: Paolo Bonzini <paolo dot bonzini at lu dot unisi dot ch>
- To: Laurynas Biveinis <laurynas dot biveinis at gmail dot com>
- Cc: GCC Development <gcc at gcc dot gnu dot org>, Daniel Berlin <dberlin at dberlin dot org>
- Date: Wed, 07 Jun 2006 17:32:16 +0200
- Subject: Re: Thoughts about GC root sets
- References: <d1e3ff2b0606070809t471c3a7av@mail.gmail.com>
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? I do not
see any root registration calls, but maybe I do not know where to
look. They cannot handle such roots automatically because they don't
intercept ordinary malloc calls and do not track information about
such regions. So that's puzzling me. Any hints would be appreciated.
Labas Laurynas,
If you look closer at stringpool.c, you can see this:
/* Mark the trees hanging off the identifier node for GGC. These are
handled specially (not using gengtype) because of the special
treatment for strings. */
void
ggc_mark_stringpool (void)
{
ht_forall (ident_hash, mark_ident, NULL);
}
/* Mark an identifier for GC. */
static int
mark_ident (struct cpp_reader *pfile ATTRIBUTE_UNUSED, hashnode h,
const void *v ATTRIBUTE_UNUSED)
{
gt_ggc_m_9tree_node (HT_IDENT_TO_GCC_IDENT (h));
return 1;
}
You can grep for ggc_mark_stringpool now, and you'll get to where other
roots are taken from the tables that gengtype produces. I'm not very
familiar with the gengtype code and I haven't seen yours, so I can't
tell you offhand how you can handle other GTY(()) variables. This one
*is* special though.
Paolo