This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [rfa] symbol hashing, part 1/n - updates to hash functions


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.

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer

2001-10-12  Daniel Jacobowitz  <drow@mvista.com>

	* 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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]