• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


Commit MetaInfo

Revisionb4fbb96b58d152194f0ffeefd35eea9a1bd89a52 (tree)
Zeit2019-10-04 03:17:12
AutorChristian Biesinger <cbiesinger@goog...>
CommiterChristian Biesinger

Log Message

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-10-03 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.

Ändern Zusammenfassung

Diff

--- a/gdb/minsyms.c
+++ b/gdb/minsyms.c
@@ -1342,6 +1342,11 @@ minimal_symbol_reader::install ()
13421342 std::mutex demangled_mutex;
13431343 #endif
13441344
1345+ struct computed_hash_values {
1346+ hashval_t mangled_name_hash;
1347+ };
1348+ std::vector<computed_hash_values> hash_values (mcount);
1349+
13451350 msymbols = m_objfile->per_bfd->msymbols.get ();
13461351 gdb::parallel_for_each
13471352 (&msymbols[0], &msymbols[mcount],
@@ -1361,6 +1366,9 @@ minimal_symbol_reader::install ()
13611366 symbol_set_demangled_name (msym, demangled_name,
13621367 &m_objfile->per_bfd->storage_obstack);
13631368 msym->name_set = 1;
1369+
1370+ size_t idx = msym - msymbols;
1371+ hash_values[idx].mangled_name_hash = htab_hash_string (msym->name);
13641372 }
13651373 }
13661374 {
@@ -1371,9 +1379,11 @@ minimal_symbol_reader::install ()
13711379 #endif
13721380 for (minimal_symbol *msym = start; msym < end; ++msym)
13731381 {
1382+ size_t idx = msym - msymbols;
13741383 symbol_set_names (msym, msym->name,
13751384 strlen (msym->name), 0,
1376- m_objfile->per_bfd);
1385+ m_objfile->per_bfd,
1386+ hash_values[idx].mangled_name_hash);
13771387 }
13781388 }
13791389 });
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -808,7 +808,7 @@ symbol_find_demangled_name (struct general_symbol_info *gsymbol,
808808 void
809809 symbol_set_names (struct general_symbol_info *gsymbol,
810810 const char *linkage_name, int len, bool copy_name,
811- struct objfile_per_bfd_storage *per_bfd)
811+ struct objfile_per_bfd_storage *per_bfd, hashval_t hash)
812812 {
813813 struct demangled_name_entry **slot;
814814 /* A 0-terminated copy of the linkage name. */
@@ -854,9 +854,11 @@ symbol_set_names (struct general_symbol_info *gsymbol,
854854 create_demangled_names_hash (per_bfd);
855855
856856 entry.mangled = linkage_name_copy;
857+ if (hash == 0)
858+ hash = hash_demangled_name_entry (&entry);
857859 slot = ((struct demangled_name_entry **)
858- htab_find_slot (per_bfd->demangled_names_hash.get (),
859- &entry, INSERT));
860+ htab_find_slot_with_hash (per_bfd->demangled_names_hash.get (),
861+ &entry, hash, INSERT));
860862
861863 /* If this name is not in the hash table, add it. */
862864 if (*slot == NULL
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -502,13 +502,16 @@ extern char *symbol_find_demangled_name (struct general_symbol_info *gsymbol,
502502 (symbol)->ginfo.name = (linkage_name)
503503
504504 /* Set the linkage and natural names of a symbol, by demangling
505- the linkage name. */
505+ the linkage name. Optionally, HASH can be set to the value
506+ of htab_hash_string (linkage_name) (if nullterminated), to
507+ speed up this function. */
506508 #define SYMBOL_SET_NAMES(symbol,linkage_name,len,copy_name,objfile) \
507509 symbol_set_names (&(symbol)->ginfo, linkage_name, len, copy_name, \
508510 (objfile)->per_bfd)
509511 extern void symbol_set_names (struct general_symbol_info *symbol,
510512 const char *linkage_name, int len, bool copy_name,
511- struct objfile_per_bfd_storage *per_bfd);
513+ struct objfile_per_bfd_storage *per_bfd,
514+ hashval_t hash = 0);
512515
513516 /* Now come lots of name accessor macros. Short version as to when to
514517 use which: Use SYMBOL_NATURAL_NAME to refer to the name of the