[0/9] Simplify quick_symbol_functions

Message ID 20210325170458.2351251-1-tom@tromey.com
Headers show
Series
  • Simplify quick_symbol_functions
Related show

Message

Tom Tromey March 25, 2021, 5:04 p.m.
I have been looking at writing a new implementation of
quick_symbol_functions, and while doing so I was reminded that there
is some redundancy in these methods.

These were introduced when .gdb_index was created, by factoring out
some psymtab calls.  They were purely ad hoc -- which I think can be
seen by reading through the descriptions.

This series removes the map_symtabs_matching_filename,
expand_symtabs_for_function, and lookup_symbol calls, in favor of
slightly expanding expand_symtabs_matching and using that.

Doing this required a few additions to expand_symtabs_matching.  This
series also requires my earlier 2-patch series to tweak psymtabs a
bit; otherwise there are regressions.

Note that the new approach may look slightly less performant, because
expand_symtabs_matching does not binary search global psymbols.
However, I instrumented "maint print statistics" and found that the
median number of global psymbols (per psymtab, which is what matters
for searching) is actually quite low -- it was 8 for gdb.

So, I tend to think the binary search is not important.  However,
perhaps psymbol_functions::expand_symtabs_matching (really
recursively_search_psymtabs) could be improved to use binary search,
if that should prove necessary.

I wrote a patch to remove expand_all_symtabs, but didn't include it
here.  It required some special cases in the DWARF
quick_symbol_functions, and didn't seem to add much value, considering
that this method is normally easy to implement.

I looked at removing map_matching_symbols, but it does name
comparisons in a subtly different way than expand_symtabs_matching.
Perhaps this could be done by another generalization of
expand_symtabs_matching.  Meanwhile, this series does simplify
map_matching_symbols somewhat.



Regression tested on x86-64 Fedora 32.

Let me know what you think.

Tom

Comments

Tom Tromey April 17, 2021, 3:38 p.m. | #1
>>>>> "Tom" == Tom Tromey <tom@tromey.com> writes:


Tom> I have been looking at writing a new implementation of
Tom> quick_symbol_functions, and while doing so I was reminded that there
Tom> is some redundancy in these methods.
...
Tom> This series removes the map_symtabs_matching_filename,
Tom> expand_symtabs_for_function, and lookup_symbol calls, in favor of
Tom> slightly expanding expand_symtabs_matching and using that.
...
Tom> Regression tested on x86-64 Fedora 32.

I've rebased this (no changes needed) and re-tested it.
I'm checking it in now.

Tom