Micro-optimize abbrev reading and storage
authorTom Tromey <tom@tromey.com>
Sat, 6 Mar 2021 16:16:59 +0000 (09:16 -0700)
committerTom Tromey <tom@tromey.com>
Sat, 6 Mar 2021 16:17:28 +0000 (09:17 -0700)
commit4444f40757a242015973237627283a910f5d9654
tree2eff136ada394093d03b997cd3c69069e8c36466
parent8c0546e928b557f10cb5aba2a91f3ecee660029d
Micro-optimize abbrev reading and storage

Currently, and abbrev_info points to a separately allocated array of
attr_abbrev objects.  This array is constructed in a temporary vector,
then copied to the abbrev table's obstack.

This patch changes abbrev_info to use the struct hack to store the
objects directly, and changes abbrev_table::read to avoid an extra
copy when allocating, using the "growing objects" capability of
obstacks.

This saves a bit of space, and also perhaps a little time.

2021-03-06  Tom Tromey  <tom@tromey.com>

* dwarf2/read.c (read_attribute): Make 'abbrev' const.
* dwarf2/abbrev.c (abbrev_table::alloc_abbrev): Remove.
(abbrev_table::read): Update.
* dwarf2/abbrev.h (struct attr_abbrev): Move earlier.
(struct abbrev_info): Reformat.
<attrs>: Now an array.
(struct abbrev_table) <alloc_abbrev>: Remove.
gdb/ChangeLog
gdb/dwarf2/abbrev.c
gdb/dwarf2/abbrev.h
gdb/dwarf2/read.c