Hello All,
I am sometimes wishing to be able to scan some few local variables in
GCC garbage collector, GGC.
One could imagine, for instance, that some passes would prefer, instead
of using static GTY-ed variables, to declare some local GTY-ed structure
LS , and to explicitly invoke the GGC collector with a pointer to LS and
its marking routine (as generated by gengtype).
As a fictional example, suppose some pass is building a gimple_seq
stored in a local gs. It could perhaps call the GGC garbage collector as
ggc_collect_with_local(gs, gt_ggc_mx_gimple_seq_node_d);
So I am suggesting that we could extend the API in gcc/ggc.h with an
additional function ggc_collect_with_local which takes a pointer to a
single local structure (inside the call stack) and a marking routine
(usually generated by gengtype) for this pointer and do a collection
with marking the additional stuff. We might restrict that the passed
pointer is on the call stack (or on the contrary in the GGC heap).
what do people think about this idea? I might consider writing such a
patch (last time I looked, it seems not too hard) when GCC goes back
into stage 1.
(and such a patch actually could help the MELT branch).
Regards.
--
Basile STARYNKEVITCH http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mines, sont seulement les miennes} ***