From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20909 invoked by alias); 16 Aug 2010 18:56:02 -0000 Received: (qmail 20893 invoked by uid 22791); 16 Aug 2010 18:56:01 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.44.51) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 16 Aug 2010 18:55:54 +0000 Received: from hpaq3.eem.corp.google.com (hpaq3.eem.corp.google.com [172.25.149.3]) by smtp-out.google.com with ESMTP id o7GItq3x014164 for ; Mon, 16 Aug 2010 11:55:52 -0700 Received: from vws7 (vws7.prod.google.com [10.241.21.135]) by hpaq3.eem.corp.google.com with ESMTP id o7GIsF5T016759 for ; Mon, 16 Aug 2010 11:55:51 -0700 Received: by vws7 with SMTP id 7so4422187vws.13 for ; Mon, 16 Aug 2010 11:55:50 -0700 (PDT) MIME-Version: 1.0 Received: by 10.220.124.211 with SMTP id v19mr3447888vcr.44.1281984950548; Mon, 16 Aug 2010 11:55:50 -0700 (PDT) Received: by 10.220.187.199 with HTTP; Mon, 16 Aug 2010 11:55:50 -0700 (PDT) In-Reply-To: References: <4C6946E1.6000709@redhat.com> Date: Mon, 16 Aug 2010 18:56:00 -0000 Message-ID: Subject: Re: [RFC] Use custom hash function with bcache From: Doug Evans To: sami wagiaalla Cc: gdb-patches@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-System-Of-Record: true X-IsSubscribed: yes 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 X-SW-Source: 2010-08/txt/msg00236.txt.bz2 On Mon, Aug 16, 2010 at 11:28 AM, Doug Evans wrote: > On Mon, Aug 16, 2010 at 7:10 AM, sami wagiaalla wro= te: >> This patch enables the use of custom hash and comparison functions when >> adding elements to a bcache. The patch also introduces hash and comparis= on >> functions which take into consideration only the relevant properties of = the >> psymbol. >> >> Tested by running the test suit on F13 with gcc 4.4.4 on x8664, no >> regressions. >> >> also used 'main print statistics' to ensure that the bcache object count= and >> unique object count are as expected with a small test case. >> >> Sami >> > > Hi. =A0Comments inline with the patch. > > > 2010-08-13 =A0Sami Wagiaalla =A0 > > =A0 =A0 =A0 =A0* psymtab.c (psymbol_hash): New function. > =A0 =A0 =A0 =A0(psymbol_compare): New function. > =A0 =A0 =A0 =A0(add_psymbol_to_bcache): pass psymbol_hash and psymbol_com= pare > =A0 =A0 =A0 =A0to bcache_full. > =A0 =A0 =A0 =A0* bcache.c (hash_continue): New. > =A0 =A0 =A0 =A0(hash): Use hash_continue. > =A0 =A0 =A0 =A0(bcache): Now takes hash_function, compare_function argume= nts. > =A0 =A0 =A0 =A0(bcache_full): Ditto. > =A0 =A0 =A0 =A0* bcache.c (bcache): Update prototype. > =A0 =A0 =A0 =A0(bcache_full): Ditto. > =A0 =A0 =A0 =A0* macrotab.c (macro_bcache): Updated. > =A0 =A0 =A0 =A0* symfile.c (allocate_symtab): Updated. Blech, I forgot to add that we can get rid of the static in "static struct partial_symbol psymbol;" in add_psymbol_to_bcache. I think that should be part of this patch. A couple more things come to mind. 1) We store symbol names such that we can compare them with ptr1 =3D=3D ptr2, but your patch uses strcmp. 2) I'm wondering if there's some abstraction violation with bcache not being aware of the extra memory that is used by gsymbol->language_specific.cplus_specific. Dunno, just wondering.