>>>>> "Chris" == Chris Jefferson <[EMAIL PROTECTED]> writes:

Chris> Could someone point me towards what is necessary to add STL
Chris> containers to the garbage collector?

I think most of the needed changes will be in gengtype.  If you aren't
familiar with what this does, read gcc/doc/gty.texi.

The first thing to look at is syntax.  Right now a hash table of trees
is defined:

    static GTY((param_is (union tree_node))) htab_t type_hash_table;

In C++, ideally, gengtype would understand template parameters and so
we would not need a new GTY argument.  E.g.:

    static GTY(()) std::set<tree> *type_hash_table;


Next, you'd have to modify gengtype to emit mark functions for these
types.  Continuing the above example, right now gengtype emits a loop
that directly references fields fields in the hash table (see
build/gcc/gtype-desc.c:gt_ggc_m_P9tree_node4htab).

For C++, this iteration should just be done with ordinary iterators.

There may be some problems marking container-class-private
GC-allocated data structures, if any such exist.


Finally, the gengtype mechanism is also used for PCH.  So, you will
need to figure out how to serialize STL containers to PCH and then
read them back in.  This might be hard.

Tom

Reply via email to