Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Yao Qi <yao@codesourcery.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [patch +const 2/2] Unify lookup_symbol_in_objfile_symtabs
Date: Fri, 05 Dec 2014 15:15:00 -0000	[thread overview]
Message-ID: <20141205151504.GA18079@host2.jankratochvil.net> (raw)
In-Reply-To: <87d27ygtmn.fsf@codesourcery.com>

On Fri, 05 Dec 2014 13:37:20 +0100, Yao Qi wrote:
> Jan Kratochvil <jan.kratochvil@redhat.com> writes:
> 
> > -	  sym = block_lookup_symbol (block, name, domain);
> 
> We are using 'block_lookup_symbol' here...
> 
> > -	  if (sym)
> > -	    {
> > -	      block_found = block;
> > -	      return fixup_symbol_section (sym, objfile);
> > -	    }
> > -	}
> > +      
> > +      sym = lookup_symbol_in_objfile_symtabs (objfile, GLOBAL_BLOCK, name,
> > +					      domain);
> 
> ... but lookup_symbol_in_objfile_symtabs calls
> 'block_lookup_symbol_primary'.

It has changed yesterday by:
	commit ba715d7fe49c8a59660fbd571b935b29eb7cfbdb
	Author: Jan Kratochvil <jan.kratochvil@redhat.com>
	    Accelerate lookup_symbol_aux_objfile 85x
	-      sym = block_lookup_symbol (block, name, domain);
	+      sym = block_lookup_symbol_primary (block, name, domain);


> Is it because we are iterating COMPUNITS
> (primary symtab?) so block_lookup_symbol is equivalent to
> block_lookup_symbol_primary under this context?

That's right, block_lookup_symbol_primary()'s additional requirement over
block_lookup_symbol() is:
	Function is useful if one iterates all global/static blocks of an
	objfile.

Which is satisfied both in lookup_symbol_in_objfile_symtabs() and in
lookup_global_symbol_from_objfile() thanks to their's ALL_OBJFILE_COMPUNITS.

In fact after reverting that ba715d7fe49c8a59660fbd571b935b29eb7cfbdb above
the lines of code were exactly the same.

So instead of accelerating both lookup_symbol_in_objfile_symtabs() and
lookup_global_symbol_from_objfile() I just accelerated
lookup_symbol_in_objfile_symtabs() and I am proposing to reuse
lookup_symbol_in_objfile_symtabs() in lookup_global_symbol_from_objfile()
instead.  In fact such unification would already save some lines of code even
before the checked-in acceleration patch above.


Thanks,
Jan


  reply	other threads:[~2014-12-05 15:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-03 17:07 Jan Kratochvil
2014-12-05 12:37 ` Yao Qi
2014-12-05 15:15   ` Jan Kratochvil [this message]
2014-12-05 18:03 ` Doug Evans

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141205151504.GA18079@host2.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=yao@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox