diff options
author | Tom Tromey <tromey@adacore.com> | 2020-05-27 11:48:18 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2020-05-27 11:48:19 -0600 |
commit | af0b2a3e85df9f49a3528e5b7578fcf9412f1acc (patch) | |
tree | 3bc4c4569634256e074e7260e4dd13e97723e98b /gdb/dwarf2/abbrev.h | |
parent | 7d00ffecd2b16608f0bcfbc0402fec2cc228a3e7 (diff) | |
download | gdb-af0b2a3e85df9f49a3528e5b7578fcf9412f1acc.zip gdb-af0b2a3e85df9f49a3528e5b7578fcf9412f1acc.tar.gz gdb-af0b2a3e85df9f49a3528e5b7578fcf9412f1acc.tar.bz2 |
Inline abbrev lookup
Profiling showed that calls to abbrev_table::lookup_abbrev were "too
visible". As these are just forwarding calls to the hash table, this
patch inlines the lookup. Also, htab_find_with_hash is used, avoiding
another call.
The run previous to this had times of (see the first patch in the
series for an explanation):
gdb 1.69
libxul 2.02
Ada 2.52
This patch improves the times to:
gdb 1.64
libxul 1.99
Ada 2.47
gdb/ChangeLog
2020-05-27 Tom Tromey <tromey@adacore.com>
* dwarf2/abbrev.h (struct abbrev_table) <lookup_abbrev>: Inline.
Use htab_find_with_hash.
<add_abbrev>: Remove "abbrev_number" parameter.
* dwarf2/abbrev.c (abbrev_table::add_abbrev): Remove
"abbrev_number" parameter. Use htab_find_slot_with_hash.
(hash_abbrev): Add comment.
(abbrev_table::lookup_abbrev): Move to header file.
(abbrev_table::read): Update.
Diffstat (limited to 'gdb/dwarf2/abbrev.h')
-rw-r--r-- | gdb/dwarf2/abbrev.h | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/gdb/dwarf2/abbrev.h b/gdb/dwarf2/abbrev.h index b9ace64..888f04e 100644 --- a/gdb/dwarf2/abbrev.h +++ b/gdb/dwarf2/abbrev.h @@ -27,6 +27,8 @@ #ifndef GDB_DWARF2_ABBREV_H #define GDB_DWARF2_ABBREV_H +#include "hashtab.h" + /* This data structure holds the information of an abbrev. */ struct abbrev_info { @@ -60,8 +62,15 @@ struct abbrev_table /* Look up an abbrev in the table. Returns NULL if the abbrev is not found. */ - struct abbrev_info *lookup_abbrev (unsigned int abbrev_number); + struct abbrev_info *lookup_abbrev (unsigned int abbrev_number) + { + struct abbrev_info search; + search.number = abbrev_number; + return (struct abbrev_info *) htab_find_with_hash (m_abbrevs.get (), + &search, + abbrev_number); + } /* Where the abbrev table came from. This is used as a sanity check when the table is used. */ @@ -78,7 +87,7 @@ private: struct abbrev_info *alloc_abbrev (); /* Add an abbreviation to the table. */ - void add_abbrev (unsigned int abbrev_number, struct abbrev_info *abbrev); + void add_abbrev (struct abbrev_info *abbrev); /* Hash table of abbrevs. */ htab_up m_abbrevs; |