Speed up lookup of "type_specific_data"

I noticed that "info locals" on a certain large Ada program was very
slow.  I tracked this down to ada_get_tsd_type expanding nearly every
CU in the program.

This patch fixes the problem by changing this code to use the more
efficient lookup_transparent_type which, unlike the Ada-specific
lookup functions, does not try to find all matching instances.

Note that I first tried fixing this by changing ada_find_any_type, but
this did not work -- I may revisit this approach at some later date.

Also note that the copyright dates on the test files are set that way
because I copied them from another test.

New in v2: the new test failed on the Linaro regression tester.
Looking at the logs, it seems that gdb was picking up a 'value' from
libgnat:

    $1 = {<text variable, no debug info>} 0xf7e227a4 <ada.calendar.formatting.value>

This version renames the local variable in an attempt to work around
this.

v3: In v2, while trying to reproduce the problem locally, I
accidentally forgot to commit one of the changes.
This commit is contained in:
Tom Tromey
2024-02-14 09:48:34 -07:00
parent 12d5d5bfd0
commit 1ab9eefe3c
13 changed files with 200 additions and 20 deletions

View File

@@ -1024,10 +1024,10 @@ cp_lookup_nested_symbol (struct type *parent_type,
released version of GCC with such information.) */
struct type *
cp_lookup_transparent_type (const char *name)
cp_lookup_transparent_type (const char *name, domain_search_flags flags)
{
/* First, try the honest way of looking up the definition. */
struct type *t = basic_lookup_transparent_type (name);
struct type *t = basic_lookup_transparent_type (name, flags);
const char *scope;
if (t != NULL)