aboutsummaryrefslogtreecommitdiff
path: root/gdb/objfiles.h
diff options
context:
space:
mode:
authorChristian Biesinger <cbiesinger@google.com>2019-09-26 14:45:47 -0500
committerChristian Biesinger <cbiesinger@google.com>2019-09-26 14:46:16 -0500
commitf55c45b19bbfa2ab3a9d0ff703e4ad589e5fe4df (patch)
tree2de7e76fb1819a51b3f0cee972f565e579c09368 /gdb/objfiles.h
parentececd218c5254902db3301d700546f6702112c85 (diff)
downloadbinutils-users/cbiesinger/stl_minsyms_hash.zip
binutils-users/cbiesinger/stl_minsyms_hash.tar.gz
binutils-users/cbiesinger/stl_minsyms_hash.tar.bz2
Try converting ad-hoc msymbol hash tables to STL containersusers/cbiesinger/stl_minsyms_hash
I went with multimap (also tried unordered_multimap) to keep the behavior where we have a special hash key and want to iterate over everything with that hash using specialized compare functions. Unfortunately this is a 10% regression. real 0m56.538s user 0m34.304s sys 0m22.380s real 0m51.655s user 0m32.194s sys 0m19.528s
Diffstat (limited to 'gdb/objfiles.h')
-rw-r--r--gdb/objfiles.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/gdb/objfiles.h b/gdb/objfiles.h
index 68d36d4..4d55a86 100644
--- a/gdb/objfiles.h
+++ b/gdb/objfiles.h
@@ -29,6 +29,8 @@
#include "gdb_bfd.h"
#include "psymtab.h"
#include <bitset>
+#include <map>
+#include <unordered_map>
#include <vector>
#include "gdbsupport/next-iterator.h"
#include "gdbsupport/safe-iterator.h"
@@ -230,10 +232,14 @@ private:
instance of this structure, and associated with the BFD using the
registry system. */
+// Maps hash -> symbol
+typedef std::unordered_multimap<unsigned int, struct minimal_symbol *> minsym_hash_table;
struct objfile_per_bfd_storage
{
objfile_per_bfd_storage ()
: minsyms_read (false)
+ , msymbol_hash(MINIMAL_SYMBOL_HASH_SIZE)
+ , msymbol_demangled_hash(MINIMAL_SYMBOL_HASH_SIZE)
{}
~objfile_per_bfd_storage ();
@@ -307,12 +313,12 @@ struct objfile_per_bfd_storage
/* This is a hash table used to index the minimal symbols by name. */
- minimal_symbol *msymbol_hash[MINIMAL_SYMBOL_HASH_SIZE] {};
+ minsym_hash_table msymbol_hash;
/* This hash table is used to index the minimal symbols by their
demangled names. */
- minimal_symbol *msymbol_demangled_hash[MINIMAL_SYMBOL_HASH_SIZE] {};
+ minsym_hash_table msymbol_demangled_hash;
/* All the different languages of symbols found in the demangled
hash table. */