This is the mail archive of the gcc-patches@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: PATCH.DOC: gty.texi - explanation


I found (the hard way) that when a new source file gcc/mypass.c has
only a struct GTY which is not used (no variables yet of this type),
the gengtype machinery does not generate the gt-mypass.h file.

I'm not able to correct the gengtype code for this, but I am

This looks like the expected behaviour of gengtype to me. Gengtype is variable-oriented in gt-file generation, if you only mark a data type with GTY, then you will only get the walker routines in gtype-desc.[c|h].

What you were trying to accomplish? What output you were expecting to
see in gt-mypass.h?

+The garbage collector inside GCC is a precise mark and sweep garbage
+collector

@footnote{This is the default collector, unless configured
+otherwise}.

IMHO this is redundant. All the collectors in GCC sources currently are precise mark-n-sweep.

It follows only explicitly marked (with @code{GTY(())})
+static or global GCC variables, and does not follow any local pointers
+on the compiler's call stack.  The collector is explicitly called by
+calls to @code{ggc_collect} and is not called implicitly by
+allocators.

I'd suggest to add some reasoning here:


...is not called implicitly by allocators but rather by explicit calls
to ggc_collect at the places where it is safe to do so, e.g. there are
not live references from execution stack to the GC-managed heap.

Every @code{struct} and variable marked with
+@code{GTY(())} should really be used.  For instance, GCC contributors
+should avoid declaring a @code{struct @var{tag} GTY(())} like above
+without using it (in fields or variables).

Maybe it could be rephrased in a way that GTY'ing a data structure outputs something to gtype-desc, and GTY'ing a variable outputs something to gt-file.

--
Laurynas


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