authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-05-05 20:48:44-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-06-10 20:42:29-07:00
log6350aabf9d00cbdfe73c6aa0a7d8e8f52fe6d8f1
tree6971ecfd2f2a81253e805cc52122d2b081317a0a
parent9626811725ba7bb979559b718492b1fbe7fc0578

InternPool: fix bug in addLimbsExtraAssumeCapacity


1 files changed, 16 insertions(+), 8 deletions(-)

src/InternPool.zig+16-8
......@@ -1319,7 +1319,7 @@ fn addLimbsExtraAssumeCapacity(ip: *InternPool, extra: anytype) u32 {
13191319 @sizeOf(u64) => {},
13201320 else => @compileError("unsupported host"),
13211321 }
1322 const result = @intCast(u32, ip.extra.items.len);
1322 const result = @intCast(u32, ip.limbs.items.len);
13231323 inline for (@typeInfo(@TypeOf(extra)).Struct.fields, 0..) |field, i| {
13241324 const new: u32 = switch (field.type) {
13251325 u32 => @field(extra, field.name),
......@@ -1452,11 +1452,19 @@ fn dumpFallible(ip: InternPool, arena: Allocator) anyerror!void {
14521452
14531453 std.debug.print(
14541454 \\InternPool size: {d} bytes
1455 \\ items: {d} bytes
1456 \\ extra: {d} bytes
1457 \\ limbs: {d} bytes
1455 \\ {d} items: {d} bytes
1456 \\ {d} extra: {d} bytes
1457 \\ {d} limbs: {d} bytes
14581458 \\
1459 , .{ total_size, items_size, extra_size, limbs_size });
1459 , .{
1460 total_size,
1461 ip.items.len,
1462 items_size,
1463 ip.extra.items.len,
1464 extra_size,
1465 ip.limbs.items.len,
1466 limbs_size,
1467 });
14601468
14611469 const tags = ip.items.items(.tag);
14621470 const datas = ip.items.items(.data);
......@@ -1512,10 +1520,10 @@ fn dumpFallible(ip: InternPool, arena: Allocator) anyerror!void {
15121520 }
15131521 };
15141522 counts.sort(SortContext{ .map = &counts });
1515 const len = @min(50, tags.len);
1516 std.debug.print("top 50 tags:\n", .{});
1523 const len = @min(50, counts.count());
1524 std.debug.print(" top 50 tags:\n", .{});
15171525 for (counts.keys()[0..len], counts.values()[0..len]) |tag, stats| {
1518 std.debug.print(" {s}: {d} occurrences, {d} total bytes\n", .{
1526 std.debug.print(" {s}: {d} occurrences, {d} total bytes\n", .{
15191527 @tagName(tag), stats.count, stats.bytes,
15201528 });
15211529 }