From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1635 invoked by alias); 5 Dec 2014 15:15:17 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 1611 invoked by uid 89); 5 Dec 2014 15:15:14 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.9 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 05 Dec 2014 15:15:12 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sB5FF81L011832 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 5 Dec 2014 10:15:08 -0500 Received: from host2.jankratochvil.net (ovpn-116-31.ams2.redhat.com [10.36.116.31]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id sB5FF5Ta012473 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NO); Fri, 5 Dec 2014 10:15:07 -0500 Date: Fri, 05 Dec 2014 15:15:00 -0000 From: Jan Kratochvil To: Yao Qi Cc: gdb-patches@sourceware.org Subject: Re: [patch +const 2/2] Unify lookup_symbol_in_objfile_symtabs Message-ID: <20141205151504.GA18079@host2.jankratochvil.net> References: <20141203170703.GC25020@host2.jankratochvil.net> <87d27ygtmn.fsf@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87d27ygtmn.fsf@codesourcery.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes X-SW-Source: 2014-12/txt/msg00138.txt.bz2 On Fri, 05 Dec 2014 13:37:20 +0100, Yao Qi wrote: > Jan Kratochvil 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 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