On Mon, Nov 18, 2019 at 02:41:48PM -0500, Jason Merrill wrote:
> > 2019-11-11  Jakub Jelinek  <ja...@redhat.com>
> > 
> >     PR c++/92458
> >     * constraint.cc: Include tree-hash-traits.h.
> >     (decl_tree_cache_traits): New type.
> >     (decl_tree_cache_map): New typedef.
> >     (decl_constraints): Change type to decl_tree_cache_map *
> >     from tree_cache_map *.
> 
> Do we need to change other tree_cache_map uses, too?  It looks like many of
> them map from decls.

I guess it depends on whether those hash tables can have data in them across
PCH save/restore.
As an experiment, I've built stdc++.h.gch with -std=c++2a and put a
breakpoint in c_common_read_pch after gt_pch_restore.
Besides decl_constraints I've changed, I see also defarg_inst table with
data on it, which means that defarg_inst lookups after PCH read might not
find saved instantiations in the table.
So, defarg_inst might be another candidate for decl_tree_cache_map,
especially because PARM_DECLs are the keys in it.
All the other C++ FE tree_cache_map hash tables are empty, so no idea if it
is needed or not.

If decl_tree_cache_map will be needed in more than one spot, I'll probably
need to move it to some generic header.

> > --- gcc/cp/constraint.cc.jj 2019-11-07 09:50:51.755239234 +0100
> > +++ gcc/cp/constraint.cc    2019-11-11 19:04:03.231862024 +0100
> > @@ -45,6 +45,7 @@ along with GCC; see the file COPYING3.
> >   #include "decl.h"
> >   #include "toplev.h"
> >   #include "type-utils.h"
> > +#include "tree-hash-traits.h"
> >   static tree satisfaction_value (tree t);
> > @@ -1113,7 +1114,10 @@ build_constraints (tree tr, tree dr)
> >   /* A mapping from declarations to constraint information.  */
> > -static GTY ((cache)) tree_cache_map *decl_constraints;
> > +struct decl_tree_cache_traits
> > +  : simple_cache_map_traits<tree_decl_hash, tree> { };
> > +typedef hash_map<tree,tree,decl_tree_cache_traits> decl_tree_cache_map;
> > +static GTY ((cache)) decl_tree_cache_map *decl_constraints;
> >   /* Returns the template constraints of declaration T. If T is not
> >      constrained, return NULL_TREE. Note that T must be non-null. */

        Jakub

Reply via email to