diff options
| author | Jacob Young <jacobly0@users.noreply.github.com> | 2025-10-04 05:05:31 -0400 |
|---|---|---|
| committer | Jacob Young <15544577+jacobly0@users.noreply.github.com> | 2025-10-05 00:25:21 -0400 |
| commit | 906ce2ad7cb3960eb579ab46b79dff3b9eae1ef5 (patch) | |
| tree | 3c6ad18765f6b986e6105f3a91691c6f54f74943 /src/Compilation.zig | |
| parent | 606c7bcc89dd42be52661fe0a7626803e992308b (diff) | |
| download | zig-906ce2ad7cb3960eb579ab46b79dff3b9eae1ef5.tar.gz zig-906ce2ad7cb3960eb579ab46b79dff3b9eae1ef5.zip | |
InternPool: use sequential string indices instead of byte offsets
This allows more bytes to be referenced by a smaller index range.
Closes #22867
Closes #25297
Closes #25339
Diffstat (limited to 'src/Compilation.zig')
| -rw-r--r-- | src/Compilation.zig | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig index 7574fefc20..6ae57f3492 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -3684,6 +3684,7 @@ const Header = extern struct { items_len: u32, extra_len: u32, limbs_len: u32, + strings_len: u32, string_bytes_len: u32, tracked_insts_len: u32, files_len: u32, @@ -3732,7 +3733,8 @@ pub fn saveState(comp: *Compilation) !void { .items_len = @intCast(local.mutate.items.len), .extra_len = @intCast(local.mutate.extra.len), .limbs_len = @intCast(local.mutate.limbs.len), - .string_bytes_len = @intCast(local.mutate.strings.len), + .strings_len = @intCast(local.mutate.strings.len), + .string_bytes_len = @intCast(local.mutate.string_bytes.len), .tracked_insts_len = @intCast(local.mutate.tracked_insts.len), .files_len = @intCast(local.mutate.files.len), }, @@ -3775,8 +3777,11 @@ pub fn saveState(comp: *Compilation) !void { addBuf(&bufs, @ptrCast(local.shared.items.view().items(.data)[0..pt_header.intern_pool.items_len])); addBuf(&bufs, @ptrCast(local.shared.items.view().items(.tag)[0..pt_header.intern_pool.items_len])); } + if (pt_header.intern_pool.strings_len > 0) { + addBuf(&bufs, @ptrCast(local.shared.strings.view().items(.@"0")[0..pt_header.intern_pool.strings_len])); + } if (pt_header.intern_pool.string_bytes_len > 0) { - addBuf(&bufs, local.shared.strings.view().items(.@"0")[0..pt_header.intern_pool.string_bytes_len]); + addBuf(&bufs, local.shared.string_bytes.view().items(.@"0")[0..pt_header.intern_pool.string_bytes_len]); } if (pt_header.intern_pool.tracked_insts_len > 0) { addBuf(&bufs, @ptrCast(local.shared.tracked_insts.view().items(.@"0")[0..pt_header.intern_pool.tracked_insts_len])); |
