Precompute hash value for symbol_set_names

We can also compute the hash for the mangled name on a background
thread so make this function even faster (about a 7% speedup).

gdb/ChangeLog:

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.

Change-Id: I044449e7eb60cffc1c43efd3412f2b485bd9faac
This commit is contained in:
Christian Biesinger 2019-10-03 13:05:06 -05:00
parent 640ab94712
commit e76b224615
4 changed files with 42 additions and 6 deletions

View file

@ -836,7 +836,8 @@ symbol_find_demangled_name (struct general_symbol_info *gsymbol,
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;
@ -864,9 +865,11 @@ symbol_set_names (struct general_symbol_info *gsymbol,
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