public inbox for gdb-testers@sourceware.org
help / color / mirror / Atom feed
From: gdb-buildbot@sergiodj.net
To: gdb-testers@sourceware.org
Subject: [binutils-gdb] Add a fast_hash function in common-utils
Date: Wed, 23 Oct 2019 22:54:00 -0000	[thread overview]
Message-ID: <1a6ff1a96b302283d517b3cdeae7310adecbe859@gdb-build> (raw)

*** TEST RESULTS FOR COMMIT 1a6ff1a96b302283d517b3cdeae7310adecbe859 ***

commit 1a6ff1a96b302283d517b3cdeae7310adecbe859
Author:     Christian Biesinger <cbiesinger@google.com>
AuthorDate: Fri Sep 27 13:08:25 2019 -0500
Commit:     Christian Biesinger <cbiesinger@google.com>
CommitDate: Tue Oct 22 11:26:17 2019 -0500

    Add a fast_hash function in common-utils
    
    Also updates a caller in symtab.c. For now this just calls htab_hash_string
    but the next patch will change it to xxhash, if available.
    
    gdb/ChangeLog:
    
    2019-10-22  Christian Biesinger  <cbiesinger@google.com>
    
            * utils.h (fast_hash): New function.
            * symtab.c (hash_demangled_name_entry): Call new function
            fast_hash.
    
    Change-Id: I77cac0d9aa78fc65316a2af449f52edcae72dc9b

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index d271330400..bbf5d0897d 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2019-10-22  Christian Biesinger  <cbiesinger@google.com>
+
+	* utils.h (fast_hash): New function.
+	* symtab.c (hash_demangled_name_entry): Call new function
+	fast_hash.
+
 2019-10-22  Christian Biesinger  <cbiesinger@google.com>
 
 	* symtab.c (struct demangled_name_entry): Change type of mangled
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 567d09d355..dff92ca203 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -70,6 +70,7 @@
 #include <algorithm>
 #include "gdbsupport/gdb_string_view.h"
 #include "gdbsupport/pathstuff.h"
+#include "gdbsupport/common-utils.h"
 
 /* Forward declarations for local functions.  */
 
@@ -727,7 +728,7 @@ hash_demangled_name_entry (const void *data)
   const struct demangled_name_entry *e
     = (const struct demangled_name_entry *) data;
 
-  return iterative_hash (e->mangled.data (), e->mangled.length (), 0);
+  return fast_hash (e->mangled.data (), e->mangled.length ());
 }
 
 /* Equality function for the demangled name hash.  */
diff --git a/gdb/utils.h b/gdb/utils.h
index af8b461b6e..478c485e66 100644
--- a/gdb/utils.h
+++ b/gdb/utils.h
@@ -567,4 +567,14 @@ extern void copy_bitwise (gdb_byte *dest, ULONGEST dest_offset,
 			  const gdb_byte *source, ULONGEST source_offset,
 			  ULONGEST nbits, int bits_big_endian);
 
+/* A fast hashing function.  This can be used to hash strings in a fast way
+   when the length is known.  If no fast hashing library is available, falls
+   back to iterative_hash from libiberty.  */
+
+static inline unsigned int
+fast_hash (const char* str, size_t len)
+{
+  return iterative_hash (str, len, 0);
+}
+
 #endif /* UTILS_H */


             reply	other threads:[~2019-10-23 22:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-23 22:54 gdb-buildbot [this message]
2019-10-23 22:54 ` Failures on Ubuntu-Aarch64-m64, branch master gdb-buildbot
2019-10-23 23:28 ` Failures on Ubuntu-Aarch64-native-extended-gdbserver-m64, " gdb-buildbot
2019-10-23 23:56 ` Failures on Ubuntu-Aarch64-native-gdbserver-m64, " gdb-buildbot
2019-11-09 12:24 ` Failures on Fedora-i686, " gdb-buildbot
2019-11-09 12:54 ` Failures on Fedora-x86_64-cc-with-index, " gdb-buildbot
2019-11-09 13:59 ` Failures on Fedora-x86_64-m32, " gdb-buildbot
2019-11-09 14:26 ` Failures on Fedora-x86_64-m64, " gdb-buildbot
2019-11-09 15:44 ` Failures on Fedora-x86_64-native-extended-gdbserver-m32, " gdb-buildbot
2019-11-09 16:14 ` Failures on Fedora-x86_64-native-extended-gdbserver-m64, " gdb-buildbot
2019-11-09 17:15 ` Failures on Fedora-x86_64-native-gdbserver-m32, " gdb-buildbot

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=1a6ff1a96b302283d517b3cdeae7310adecbe859@gdb-build \
    --to=gdb-buildbot@sergiodj.net \
    --cc=gdb-testers@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).