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 2/3] Handle simple inheritance in gengtype.


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.


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