elt.tmpl = tmpl;
CLASSTYPE_TI_ARGS (inst)
= elt.args = INNERMOST_TEMPLATE_ARGS (elt.args);
+ elt.hash = 0; /* Recalculate after changing tmpl/args. */
spec_entry **slot
= type_specializations->find_slot (&elt, INSERT);
spec_entry elt;
elt.tmpl = tmpl;
elt.args = args;
- elt.spec = NULL_TREE;
+ elt.hash = hash;
spec_hash_table *specializations;
if (DECL_CLASS_TEMPLATE_P (tmpl))
else
specializations = decl_specializations;
- if (hash == 0)
- hash = spec_hasher::hash (&elt);
- if (spec_entry *found = specializations->find_with_hash (&elt, hash))
+ if (spec_entry *found = specializations->find (&elt))
return found->spec;
return NULL_TREE;
if (hash == 0)
hash = spec_hasher::hash (&elt);
- spec_entry **slot = decl_specializations->find_slot_with_hash (&elt, hash, INSERT);
+ spec_entry **slot = decl_specializations->find_slot (&elt, INSERT);
if (*slot)
fn = (*slot)->spec;
else
hashval_t
spec_hasher::hash (spec_entry *e)
{
- return spec_hasher::hash (e->tmpl, e->args);
+ if (e->hash == 0)
+ e->hash = hash (e->tmpl, e->args);
+ return e->hash;
}
/* Recursively calculate a hash value for a template argument ARG, for use
elt.tmpl = most_general_template (TI_TEMPLATE (tinfo));
elt.args = TI_ARGS (tinfo);
- elt.spec = NULL_TREE;
entry = decl_specializations->find (&elt);
if (entry != NULL)
tree t;
spec_entry **slot;
spec_entry *entry;
- spec_entry elt;
- hashval_t hash;
if (identifier_p (d1))
{
}
/* If we already have this specialization, return it. */
+ spec_entry elt;
elt.tmpl = gen_tmpl;
elt.args = arglist;
- elt.spec = NULL_TREE;
- hash = spec_hasher::hash (&elt);
- entry = type_specializations->find_with_hash (&elt, hash);
+ entry = type_specializations->find (&elt);
if (entry)
return entry->spec;
{
/* Completion could have caused us to register the desired
specialization already, so check the table again. */
- entry = type_specializations->find_with_hash (&elt, hash);
+ entry = type_specializations->find (&elt);
if (entry)
return entry->spec;
}
use it for hash table lookup. */
elt.tmpl = found;
elt.args = arglist = INNERMOST_TEMPLATE_ARGS (arglist);
- hash = spec_hasher::hash (&elt);
+ elt.hash = 0; /* Recalculate after changing tmpl/args. */
}
}
SET_TYPE_TEMPLATE_INFO (t, build_template_info (found, arglist));
elt.spec = t;
- slot = type_specializations->find_slot_with_hash (&elt, hash, INSERT);
+ slot = type_specializations->find_slot (&elt, INSERT);
gcc_checking_assert (*slot == NULL);
entry = ggc_alloc<spec_entry> ();
*entry = elt;
{
hash_table<spec_hasher> *specializations
= decl_p ? decl_specializations : type_specializations;
- hashval_t hash = spec_hasher::hash (elt);
- auto *slot = specializations->find_slot_with_hash (elt, hash, NO_INSERT);
+ auto *slot = specializations->find_slot (elt, NO_INSERT);
if (slot)
return (*slot)->spec;
add_mergeable_specialization (bool decl_p, spec_entry *elt, tree decl,
unsigned flags)
{
- hashval_t hash = spec_hasher::hash (elt);
if (decl_p)
{
- auto *slot = decl_specializations->find_slot_with_hash (elt, hash, INSERT);
+ auto *slot = decl_specializations->find_slot (elt, INSERT);
gcc_checking_assert (!*slot);
auto entry = ggc_alloc<spec_entry> ();
}
else
{
- auto *slot = type_specializations->find_slot_with_hash (elt, hash, INSERT);
+ auto *slot = type_specializations->find_slot (elt, INSERT);
/* We don't distinguish different constrained partial type
specializations, so there could be duplicates. Everything else