Variadic templates, fourth revision [Committed]

Jan Hubicka jh@suse.cz
Tue Mar 13 15:32:00 GMT 2007


> On 3/13/07, Richard Guenther <richard.guenther@gmail.com> wrote:
> >On 3/13/07, Paolo Bonzini <paolo.bonzini@lu.unisi.ch> wrote:
> >> >> > This causes a 15% compile time memory usage regression for tramp3d,
> >> >> > DLV and mico sources :/  (which makes it a release-blocker)
> >> >>
> >> >> Mem tester report 19% on Gerald's testcase.
> >> >
> >> > The patch here should fix the problem:
> >> >
> >> >  http://gcc.gnu.org/ml/gcc-patches/2007-03/msg00759.html
> >>
> >> The patch only saves 1% though (from 437001kB down to 432961kB).
> >
> >We'll see as soon as it is committed (I would say it's nearly
> >obvious...).  But I
> >fear that the above number hints at it being not fixed.
> 
> /* Determines if the expression or type T uses any parameter packs.  */
> bool
> uses_parameter_packs (tree t)
> {
>  tree parameter_packs = NULL_TREE;
>  struct find_parameter_pack_data ppd;
>  ppd.parameter_packs = &parameter_packs;
>  ppd.visited = pointer_set_create ();
>  walk_tree (&t, &find_parameter_packs_r, &ppd, ppd.visited);
>  return parameter_packs != NULL_TREE;
> }
> 
> This doesn't destroy the pointer set ... ;)
> 
> tree
> make_pack_expansion (tree arg)
> {
> ...
>      /* Determine which parameter packs will be used by the base
>         class expansion.  */
>      ppd.visited = pointer_set_create ();
> ...
>  /* Determine which parameter packs will be expanded.  */
>  ppd.parameter_packs = &parameter_packs;
>  ppd.visited = pointer_set_create ();
> 
> likewise.
> 
> void
> check_for_bare_parameter_packs (tree t)
> {
> ...
>  ppd.parameter_packs = &parameter_packs;
>  ppd.visited = pointer_set_create ();
> 
> 
> again...  (maybe more cases, I stopped looking)
> 
> (I wonder if using pointer-set's is worth it at all for walk_tree to
> avoid walking
> duplicates in all cases)

Looks also like those are good candidates for
walk_tree_without_duplicates that does the neccesary freeing.

Honza
> 
> Richard.



More information about the Gcc-patches mailing list