gccint: Plugins GC

1 
1 24.4 Interacting with the GCC Garbage Collector
1 ===============================================
1 
1 Some plugins may want to be informed when GGC (the GCC Garbage
1 Collector) is running.  They can register callbacks for the
1 'PLUGIN_GGC_START' and 'PLUGIN_GGC_END' events (for which the callback
1 is called with a null 'gcc_data') to be notified of the start or end of
1 the GCC garbage collection.
1 
1  Some plugins may need to have GGC mark additional data.  This can be
1 done by registering a callback (called with a null 'gcc_data') for the
1 'PLUGIN_GGC_MARKING' event.  Such callbacks can call the 'ggc_set_mark'
1 routine, preferably through the 'ggc_mark' macro (and conversely, these
1 routines should usually not be used in plugins outside of the
1 'PLUGIN_GGC_MARKING' event).  Plugins that wish to hold weak references
1 to gc data may also use this event to drop weak references when the
1 object is about to be collected.  The 'ggc_marked_p' function can be
1 used to tell if an object is marked, or is about to be collected.  The
1 'gt_clear_cache' overloads which some types define may also be of use in
1 managing weak references.
1 
1  Some plugins may need to add extra GGC root tables, e.g.  to handle
1 their own 'GTY'-ed data.  This can be done with the
1 'PLUGIN_REGISTER_GGC_ROOTS' pseudo-event with a null callback and the
1 extra root table (of type 'struct ggc_root_tab*') as 'user_data'.
1 Running the 'gengtype -p SOURCE-DIR FILE-LIST PLUGIN*.C ...' utility
1 generates these extra root tables.
1 
1  You should understand the details of memory management inside GCC
1 before using 'PLUGIN_GGC_MARKING' or 'PLUGIN_REGISTER_GGC_ROOTS'.
1