This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 2/3] Handle simple inheritance in gengtype.
- From: Michael Matz <matz at suse dot de>
- To: David Malcolm <dmalcolm at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org, Jan Hubicka <hubicka at ucw dot cz>
- Date: Fri, 20 Sep 2013 17:01:18 +0200 (CEST)
- Subject: Re: [PATCH 2/3] Handle simple inheritance in gengtype.
- Authentication-results: sourceware.org; auth=none
- References: <1379685919-9437-1-git-send-email-dmalcolm at redhat dot com> <1379685919-9437-3-git-send-email-dmalcolm at redhat dot com>
Hi,
On Fri, 20 Sep 2013, David Malcolm wrote:
> Treat GTY structs that have a "desc" as being the root of an inheritance
> hierarchy. Generate a switch on desc within the marking function with
> cases for each subclass, visiting all fields of the type (including
> inherited ones).
Yay! Thanks for working on that. I miss a change in set_gc_used_type
to mark base classes. When you construct a testcase where only derived
classes are used it should break because the base class marker isn't
emitted.
Apart from that I think I like it, there's a potential quadratic loop in
walk_subclasses, but I guess it doesn't really matter for the number of
gty types we have (and could be changed via a list of all derived classes
per base class if necessary).
Yes, it needs some updates to the documentation. Some minor nits:
> @@ -2960,8 +3002,21 @@ walk_type (type_p t, struct walk_type_data *d)
> d->indent += 2;
> oprintf (d->of, "%*s{\n", d->indent, "");
> }
> + else
> + {
> + if (desc)
> + {
else if (desc)
{
> }
> + else
> + {
> + if (desc)
> + {
Same.
> @@ -4076,7 +4162,9 @@ write_local (outf_p output_header, type_p structures, type_p param_structs)
> || ((s)->gc_used == GC_MAYBE_POINTED_TO \
> && s->u.s.line.file != NULL) \
> || ((s)->gc_used == GC_USED \
> - && strncmp (s->u.s.tag, "anonymous", strlen ("anonymous"))))))
> + && strncmp (s->u.s.tag, "anonymous", strlen ("anonymous"))) \
> + || (s->u.s.base_class))))
> +
>
>
Watch for vertical white space.
Ciao,
Michael.