On Sun, 2019-10-27 at 17:13 +0100, Mark Wielaard wrote: > On Fri, 2019-10-25 at 23:11 -0500, Jonathon Anderson wrote: > > A quick grep -r shows that ITERATE and REVERSE are used for the > > asm_symbol_tab. If iteration and insertion are not concurrent we can > > easily add bidirectional iteration (using the same Treiber stack-like > > structure as used for the memory management). Also COMPARE is not > > defined to be (0) in this instance. > > Yes. We would need some other solution for the libasm code. But I think > we can use the concurrent table for everything in libdw.
And everything in libdw besides the abbrev hash is the sig8 hash. And adopting the concurrent dynamic size hash for that is almost trivial. See attached. I only tested it lightly because I don't have any large projects build with -fdebug-types-dection. But it seems to work as intended. Cheers, Mark
From a4bf12a8b906911172897f14d62b3f43cc4066ad Mon Sep 17 00:00:00 2001 From: Mark Wielaard <m...@klomp.org> Date: Mon, 28 Oct 2019 20:54:35 +0100 Subject: [PATCH] libdw: Use dynamicsizehash_concurrent for Dwarf_Sig8_Hash. Dwarf_Sig8_Hash is used as part of a Dwarf object to quickly find a type unit based on the type signature. Use the concurrent variant of the dynamic size hash to make it thread-safe to use. Signed-off-by: Mark Wielaard <m...@klomp.org> --- libdw/ChangeLog | 8 ++++++++ libdw/dwarf_formref_die.c | 2 +- libdw/dwarf_sig8_hash.c | 2 +- libdw/dwarf_sig8_hash.h | 9 +++++++-- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/libdw/ChangeLog b/libdw/ChangeLog index 28563b4d..61231e5c 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -1,3 +1,11 @@ +2019-10-28 Mark Wielaard <m...@klomp.org> + + * dwarf_sig8_hash.h: Include libdw.h. Remove COMPARE. Include + dynamicsizehash_concurrent.h. + * dwarf_sig8_hash.c: Include dynamicsizehash_concurrent.c. + * dwarf_formref_die.c (dwarf_formref_die): Drop NULL argument to + Dwarf_Sig8_Hash_find. + 2019-08-26 Srđan Milaković <sm...@rice.edu@rice.edu> * dwarf_abbrev_hash.{c,h}: Use the *_concurrent hash table. diff --git a/libdw/dwarf_formref_die.c b/libdw/dwarf_formref_die.c index f196331a..48ba8194 100644 --- a/libdw/dwarf_formref_die.c +++ b/libdw/dwarf_formref_die.c @@ -83,7 +83,7 @@ dwarf_formref_die (Dwarf_Attribute *attr, Dwarf_Die *result) have to match in the type unit headers. */ uint64_t sig = read_8ubyte_unaligned (cu->dbg, attr->valp); - cu = Dwarf_Sig8_Hash_find (&cu->dbg->sig8_hash, sig, NULL); + cu = Dwarf_Sig8_Hash_find (&cu->dbg->sig8_hash, sig); if (cu == NULL) { /* Not seen before. We have to scan through the type units. diff --git a/libdw/dwarf_sig8_hash.c b/libdw/dwarf_sig8_hash.c index 043cac78..777f9ebc 100644 --- a/libdw/dwarf_sig8_hash.c +++ b/libdw/dwarf_sig8_hash.c @@ -38,4 +38,4 @@ #define next_prime __libdwarf_next_prime extern size_t next_prime (size_t) attribute_hidden; -#include <dynamicsizehash.c> +#include <dynamicsizehash_concurrent.c> diff --git a/libdw/dwarf_sig8_hash.h b/libdw/dwarf_sig8_hash.h index 705ffbcd..c399919a 100644 --- a/libdw/dwarf_sig8_hash.h +++ b/libdw/dwarf_sig8_hash.h @@ -29,10 +29,15 @@ #ifndef _DWARF_SIG8_HASH_H #define _DWARF_SIG8_HASH_H 1 +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include "libdw.h" + #define NAME Dwarf_Sig8_Hash #define TYPE struct Dwarf_CU * -#define COMPARE(a, b) (0) -#include <dynamicsizehash.h> +#include <dynamicsizehash_concurrent.h> #endif /* dwarf_sig8_hash.h */ -- 2.18.1