aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2/abbrev.h
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2020-02-08 13:40:54 -0700
committerTom Tromey <tom@tromey.com>2020-02-08 13:43:24 -0700
commit1d33d811c708941532410850db8279ba30995252 (patch)
tree93ffb34cf87b3f08f1de3c1f657b4b878d133bc1 /gdb/dwarf2/abbrev.h
parent86de1d91ac93e48f77ea9fe61edfdba8ac24aa02 (diff)
downloadgdb-1d33d811c708941532410850db8279ba30995252.zip
gdb-1d33d811c708941532410850db8279ba30995252.tar.gz
gdb-1d33d811c708941532410850db8279ba30995252.tar.bz2
Use htab_up in abbrev_table
This changes abbrev_table to use an htab_up rather than an ad hoc, bucket-based hash table. 2020-02-08 Tom Tromey <tom@tromey.com> * dwarf2/abbrev.c (abbrev_table): Move constructor from header. Rewrite. (abbrev_table::add_abbrev, abbrev_table::lookup_abbrev): Rewrite. * dwarf2/abbrev.h (struct abbrev_info) <next>: Remove. (abbrev_table::abbrev_table): No longer inline. (ABBREV_HASH_SIZE): Remove. (abbrev_table::m_abbrevs): Now an htab_up. Change-Id: Icbaa8e49501f9c43218d6a81a7e8c4d3a77d65dc
Diffstat (limited to 'gdb/dwarf2/abbrev.h')
-rw-r--r--gdb/dwarf2/abbrev.h19
1 files changed, 3 insertions, 16 deletions
diff --git a/gdb/dwarf2/abbrev.h b/gdb/dwarf2/abbrev.h
index 52103b0..b9ace64 100644
--- a/gdb/dwarf2/abbrev.h
+++ b/gdb/dwarf2/abbrev.h
@@ -35,7 +35,6 @@ struct abbrev_info
unsigned short has_children; /* boolean */
unsigned short num_attrs; /* number of attributes */
struct attr_abbrev *attrs; /* an array of attribute descriptions */
- struct abbrev_info *next; /* next in chain */
};
struct attr_abbrev
@@ -47,9 +46,6 @@ struct attr_abbrev
LONGEST implicit_const;
};
-/* Size of abbrev_table.abbrev_hash_table. */
-#define ABBREV_HASH_SIZE 121
-
struct abbrev_table;
typedef std::unique_ptr<struct abbrev_table> abbrev_table_up;
@@ -73,13 +69,7 @@ struct abbrev_table
private:
- explicit abbrev_table (sect_offset off)
- : sect_off (off)
- {
- m_abbrevs =
- XOBNEWVEC (&m_abbrev_obstack, struct abbrev_info *, ABBREV_HASH_SIZE);
- memset (m_abbrevs, 0, ABBREV_HASH_SIZE * sizeof (struct abbrev_info *));
- }
+ explicit abbrev_table (sect_offset off);
DISABLE_COPY_AND_ASSIGN (abbrev_table);
@@ -90,11 +80,8 @@ private:
/* Add an abbreviation to the table. */
void add_abbrev (unsigned int abbrev_number, struct abbrev_info *abbrev);
- /* Hash table of abbrevs.
- This is an array of size ABBREV_HASH_SIZE allocated in abbrev_obstack.
- It could be statically allocated, but the previous code didn't so we
- don't either. */
- struct abbrev_info **m_abbrevs;
+ /* Hash table of abbrevs. */
+ htab_up m_abbrevs;
/* Storage for the abbrev table. */
auto_obstack m_abbrev_obstack;