authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-10-19 14:17:03-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-10-20 20:02:35-04:00
logbd1f96869e8a3cf31688c16cd0baffb65119d5eb
treee4b3d5212f5c758fc01bd04a49c8fccb416bdfb9
parent328ec15d9cae0373c1f973699c392db5b63ab886

InternPool: fix incomplete hash of pointer values

There is this `common` prefix which was not getting passed in all union tags of pointer vals, resumably making InternPool slower for pointer values.

1 files changed, 3 insertions(+), 3 deletions(-)

src/InternPool.zig+3-3
......@@ -1228,7 +1228,7 @@ pub const Key = union(enum) {
12281228
12291229 .mut_decl => |x| Hash.hash(
12301230 seed2,
1231 asBytes(&x.decl) ++ asBytes(&x.runtime_index),
1231 common ++ asBytes(&x.decl) ++ asBytes(&x.runtime_index),
12321232 ),
12331233
12341234 .anon_decl,
......@@ -1236,11 +1236,11 @@ pub const Key = union(enum) {
12361236 .eu_payload,
12371237 .opt_payload,
12381238 .comptime_field,
1239 => |int| Hash.hash(seed2, asBytes(&int)),
1239 => |int| Hash.hash(seed2, common ++ asBytes(&int)),
12401240
12411241 .elem, .field => |x| Hash.hash(
12421242 seed2,
1243 asBytes(&x.base) ++ asBytes(&x.index),
1243 common ++ asBytes(&x.base) ++ asBytes(&x.index),
12441244 ),
12451245 };
12461246 },