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) {...@@ -1228,7 +1228,7 @@ pub const Key = union(enum) {
12281228
1229 .mut_decl => |x| Hash.hash(1229 .mut_decl => |x| Hash.hash(
1230 seed2,1230 seed2,
1231 asBytes(&x.decl) ++ asBytes(&x.runtime_index),1231 common ++ asBytes(&x.decl) ++ asBytes(&x.runtime_index),
1232 ),1232 ),
12331233
1234 .anon_decl,1234 .anon_decl,
...@@ -1236,11 +1236,11 @@ pub const Key = union(enum) {...@@ -1236,11 +1236,11 @@ pub const Key = union(enum) {
1236 .eu_payload,1236 .eu_payload,
1237 .opt_payload,1237 .opt_payload,
1238 .comptime_field,1238 .comptime_field,
1239 => |int| Hash.hash(seed2, asBytes(&int)),1239 => |int| Hash.hash(seed2, common ++ asBytes(&int)),
12401240
1241 .elem, .field => |x| Hash.hash(1241 .elem, .field => |x| Hash.hash(
1242 seed2,1242 seed2,
1243 asBytes(&x.base) ++ asBytes(&x.index),1243 common ++ asBytes(&x.base) ++ asBytes(&x.index),
1244 ),1244 ),
1245 };1245 };
1246 },1246 },