tint/utils: Rework Hashmap / Hashset

Previously Hashmap used to internally use a Hashset which held entries
of key-value pairs. This was cute, but meant that a Hashset held mutable
entries, which was a bag-of-bugs waiting to happen (change the entry to
hash as something different and you're now in an entirely broken state).

Pull the complex bits of Hashset out to HashmapBase, and have both
derive from that. I've opted for inheritance over composition here to
reduce the amount of structure chasing you'd have to do without
debugger pretty-printers.

Change-Id: I99e72244b69206a994edabfefd0e28d5d74d08d9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108240
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
This commit is contained in:
Ben Clayton
2022-11-02 19:46:49 +00:00
committed by Dawn LUCI CQ
parent 9535f72209
commit e372511e1b
9 changed files with 656 additions and 725 deletions

View File

@@ -3419,7 +3419,7 @@ bool FunctionEmitter::EmitStatementsInBasicBlock(const BlockInfo& block_info,
utils::Hashmap<uint32_t, Symbol, 8> copied_phis;
for (const auto assignment : worklist) {
const auto phi_id = assignment.phi_id;
if (read_set.Find(phi_id)) {
if (read_set.Contains(phi_id)) {
auto copy_name = namer_.MakeDerivedName(namer_.Name(phi_id) + "_c" +
std::to_string(block_info.id));
auto copy_sym = builder_.Symbols().Register(copy_name);