+2019-11-27 Christian Biesinger <cbiesinger@google.com>
+
+ * minsyms.c (minimal_symbol_reader::install): Also compute the hash
+ of the mangled name on the background thread.
+ * symtab.c (symbol_set_names): Allow passing in the hash of the
+ linkage_name.
+ * symtab.h (symbol_set_names): Likewise.
+
2019-11-27 Kevin Buettner <kevinb@redhat.com>
* dwarf2read.c (inherit_abstract_dies): Ensure that delayed
}
}
+/* This struct is used to store values we compute for msymbols on the
+ background threads but don't need to keep around long term. */
+struct computed_hash_values
+{
+ /* Length of the linkage_name of the symbol. */
+ size_t name_length;
+ /* Hash code (using fast_hash) of the linkage_name. */
+ hashval_t mangled_name_hash;
+};
+
/* Build (or rebuild) the minimal symbol hash tables. This is necessary
after compacting or sorting the table since the entries move around
thus causing the internal minimal_symbol pointers to become jumbled. */
std::mutex demangled_mutex;
#endif
+ std::vector<computed_hash_values> hash_values (mcount);
+
msymbols = m_objfile->per_bfd->msymbols.get ();
gdb::parallel_for_each
(&msymbols[0], &msymbols[mcount],
{
for (minimal_symbol *msym = start; msym < end; ++msym)
{
+ size_t idx = msym - msymbols;
+ hash_values[idx].name_length = strlen (msym->name);
if (!msym->name_set)
{
/* This will be freed later, by symbol_set_names. */
(msym, demangled_name,
&m_objfile->per_bfd->storage_obstack);
msym->name_set = 1;
+
+ hash_values[idx].mangled_name_hash
+ = fast_hash (msym->name, hash_values[idx].name_length);
}
}
{
#endif
for (minimal_symbol *msym = start; msym < end; ++msym)
{
- symbol_set_names (msym, msym->name, false,
- m_objfile->per_bfd);
+ size_t idx = msym - msymbols;
+ symbol_set_names
+ (msym,
+ gdb::string_view(msym->name,
+ hash_values[idx].name_length),
+ false,
+ m_objfile->per_bfd,
+ hash_values[idx].mangled_name_hash);
}
}
});
void
symbol_set_names (struct general_symbol_info *gsymbol,
gdb::string_view linkage_name, bool copy_name,
- struct objfile_per_bfd_storage *per_bfd)
+ struct objfile_per_bfd_storage *per_bfd,
+ gdb::optional<hashval_t> hash)
{
struct demangled_name_entry **slot;
create_demangled_names_hash (per_bfd);
struct demangled_name_entry entry (linkage_name);
+ if (!hash.has_value ())
+ hash = hash_demangled_name_entry (&entry);
slot = ((struct demangled_name_entry **)
- htab_find_slot (per_bfd->demangled_names_hash.get (),
- &entry, INSERT));
+ htab_find_slot_with_hash (per_bfd->demangled_names_hash.get (),
+ &entry, *hash, INSERT));
/* If this name is not in the hash table, add it. */
if (*slot == NULL
(objfile)->per_bfd)
extern void symbol_set_names (struct general_symbol_info *symbol,
gdb::string_view linkage_name, bool copy_name,
- struct objfile_per_bfd_storage *per_bfd);
+ struct objfile_per_bfd_storage *per_bfd,
+ gdb::optional<hashval_t> hash
+ = gdb::optional<hashval_t> ());
/* Return true if NAME matches the "search" name of SYMBOL, according
to the symbol's language. */