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



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


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