aboutsummaryrefslogtreecommitdiff
path: root/src/InternPool.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2023-05-05 20:48:44 -0700
committerAndrew Kelley <andrew@ziglang.org>2023-06-10 20:42:29 -0700
commit6350aabf9d00cbdfe73c6aa0a7d8e8f52fe6d8f1 (patch)
tree6971ecfd2f2a81253e805cc52122d2b081317a0a /src/InternPool.zig
parent9626811725ba7bb979559b718492b1fbe7fc0578 (diff)
downloadzig-6350aabf9d00cbdfe73c6aa0a7d8e8f52fe6d8f1.tar.gz
zig-6350aabf9d00cbdfe73c6aa0a7d8e8f52fe6d8f1.zip
InternPool: fix bug in addLimbsExtraAssumeCapacity
Diffstat (limited to 'src/InternPool.zig')
-rw-r--r--src/InternPool.zig24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/InternPool.zig b/src/InternPool.zig
index 15b6e318ed..fec5e721d0 100644
--- a/src/InternPool.zig
+++ b/src/InternPool.zig
@@ -1319,7 +1319,7 @@ fn addLimbsExtraAssumeCapacity(ip: *InternPool, extra: anytype) u32 {
@sizeOf(u64) => {},
else => @compileError("unsupported host"),
}
- const result = @intCast(u32, ip.extra.items.len);
+ const result = @intCast(u32, ip.limbs.items.len);
inline for (@typeInfo(@TypeOf(extra)).Struct.fields, 0..) |field, i| {
const new: u32 = switch (field.type) {
u32 => @field(extra, field.name),
@@ -1452,11 +1452,19 @@ fn dumpFallible(ip: InternPool, arena: Allocator) anyerror!void {
std.debug.print(
\\InternPool size: {d} bytes
- \\ items: {d} bytes
- \\ extra: {d} bytes
- \\ limbs: {d} bytes
+ \\ {d} items: {d} bytes
+ \\ {d} extra: {d} bytes
+ \\ {d} limbs: {d} bytes
\\
- , .{ total_size, items_size, extra_size, limbs_size });
+ , .{
+ total_size,
+ ip.items.len,
+ items_size,
+ ip.extra.items.len,
+ extra_size,
+ ip.limbs.items.len,
+ limbs_size,
+ });
const tags = ip.items.items(.tag);
const datas = ip.items.items(.data);
@@ -1512,10 +1520,10 @@ fn dumpFallible(ip: InternPool, arena: Allocator) anyerror!void {
}
};
counts.sort(SortContext{ .map = &counts });
- const len = @min(50, tags.len);
- std.debug.print("top 50 tags:\n", .{});
+ const len = @min(50, counts.count());
+ std.debug.print(" top 50 tags:\n", .{});
for (counts.keys()[0..len], counts.values()[0..len]) |tag, stats| {
- std.debug.print(" {s}: {d} occurrences, {d} total bytes\n", .{
+ std.debug.print(" {s}: {d} occurrences, {d} total bytes\n", .{
@tagName(tag), stats.count, stats.bytes,
});
}