From mboxrd@z Thu Jan 1 00:00:00 1970 From: Elena Zannoni To: Daniel Jacobowitz Cc: Elena Zannoni , gdb-patches@sources.redhat.com Subject: Re: [rfa] symbol hashing, part 1/n - updates to hash functions Date: Fri, 12 Oct 2001 15:34:00 -0000 Message-id: <15303.29112.175272.644001@krustylu.cygnus.com> References: <20011009105716.A7317@nevyn.them.org> <15302.12828.829882.614493@krustylu.cygnus.com> <20011011200054.B22256@nevyn.them.org> <15303.5384.908325.196958@krustylu.cygnus.com> <20011012150818.C16180@nevyn.them.org> X-SW-Source: 2001-10/msg00183.html Daniel Jacobowitz writes: > On Fri, Oct 12, 2001 at 12:06:32PM -0400, Elena Zannoni wrote: > > Just hold on the '%' move until the next patch. > > Everything else is fine. > > OK, I've committed the attached. Great, thanks! Elena > > -- > Daniel Jacobowitz Carnegie Mellon University > MontaVista Software Debian GNU/Linux Developer > > 2001-10-12 Daniel Jacobowitz > > * minsyms.c (msymbol_hash): Use better hash function. > (msymbol_hash_iw): Likewise. Terminate loop at '(' properly. > > * objfiles.h: Increase MINIMAL_SYMBOL_HASH_SIZE to match modern > binaries. > > > Index: gdb/minsyms.c > =================================================================== > RCS file: /cvs/src/src/gdb/minsyms.c,v > retrieving revision 1.17 > diff -u -r1.17 minsyms.c > --- minsyms.c 2001/05/29 10:45:10 1.17 > +++ minsyms.c 2001/10/12 19:02:55 > @@ -96,8 +96,10 @@ > while (isspace (*string)) > ++string; > if (*string && *string != '(') > - hash = (31 * hash) + *string; > - ++string; > + { > + hash = hash * 67 + *string - 113; > + ++string; > + } > } > return hash % MINIMAL_SYMBOL_HASH_SIZE; > } > @@ -109,7 +111,7 @@ > { > unsigned int hash = 0; > for (; *string; ++string) > - hash = (31 * hash) + *string; > + hash = hash * 67 + *string - 113; > return hash % MINIMAL_SYMBOL_HASH_SIZE; > } > > Index: gdb/objfiles.h > =================================================================== > RCS file: /cvs/src/src/gdb/objfiles.h,v > retrieving revision 1.8 > diff -u -r1.8 objfiles.h > --- objfiles.h 2001/03/06 08:21:11 1.8 > +++ objfiles.h 2001/10/12 19:02:55 > @@ -202,7 +202,7 @@ > extern void print_symbol_bcache_statistics (void); > > /* Number of entries in the minimal symbol hash table. */ > -#define MINIMAL_SYMBOL_HASH_SIZE 349 > +#define MINIMAL_SYMBOL_HASH_SIZE 2039 > > /* Master structure for keeping track of each file from which > gdb reads symbols. There are several ways these get allocated: 1.