[PATCH v3 00/19] Add a C++ hash table to gdbsupport

Tom Tromey tom@tromey.com
Fri Oct 4 20:14:15 GMT 2024


>>>>> "Simon" == Simon Marchi <simon.marchi@efficios.com> writes:

Simon> In this version, I added the `gdbsupport/unordered_{map,set}.h` files,
Simon> which provide the `gdb::unordered_{map,set}` types, which are aliases
Simon> for `ankerl::unordered_dense::{map,set}`.

I get why you did this but I kind of wish the names were just hash_set
and hash_map.  Not that big a deal though.

Simon>    In the case of patch 16, the change consists of changing a
Simon>    `gdb::unordered_set<decl_field *>` to a `gdb::unordered_map<type *,
Simon>    decl_field *>`.  This is slightly wasteful in terms of space, because
Simon>    the `type *` use as a key is found inside the `decl_field *`.  But I
Simon>    think this better represent what we want to do: we want to be able to
Simon>    easily find a `decl_field *` given a `type *`.  Having the type as
Simon>    the key makes the code clearer, so I went ahead and did the change.

I didn't read the patch yet, but if this was needed in this case, then
it's a strike against this implementation.  Using a projection from the
value as the "set key" is totally normal with htab_t.

Simon> After hacking around these issues, I did do a test run with
Simon> `gdb::unordered_{map,set}` aliased to `std::unordered_{map,set}`, and it
Simon> worked just fine.  I don't plan to propose merging a mode that uses the
Simon> standard types, because I don't really see the advantage of
Simon> having it.

Yeah, I don't think this is important at all.

Tom


More information about the Gdb-patches mailing list