authorgravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2024-08-19 07:52:16-04:00
committergravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2024-08-20 08:09:33-04:00
log78dec0a3da4bdf617841062d42c172acb1a5dcbb
tree72022eddbda83732c6266e68cf743aef669cadae
parent0a70455095a19a4c18497e6786ca6139c1cc2892

Compilation: fix crash saving incremental state


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

src/Compilation.zig+20-8
...@@ -2997,14 +2997,26 @@ pub fn saveState(comp: *Compilation) !void {...@@ -2997,14 +2997,26 @@ pub fn saveState(comp: *Compilation) !void {
2997 addBuf(&bufs, mem.sliceAsBytes(ip.free_dep_entries.items));2997 addBuf(&bufs, mem.sliceAsBytes(ip.free_dep_entries.items));
29982998
2999 for (ip.locals, pt_headers.items) |*local, pt_header| {2999 for (ip.locals, pt_headers.items) |*local, pt_header| {
3000 addBuf(&bufs, mem.sliceAsBytes(local.shared.limbs.view().items(.@"0")[0..pt_header.intern_pool.limbs_len]));3000 if (pt_header.intern_pool.limbs_len > 0) {
3001 addBuf(&bufs, mem.sliceAsBytes(local.shared.extra.view().items(.@"0")[0..pt_header.intern_pool.extra_len]));3001 addBuf(&bufs, mem.sliceAsBytes(local.shared.limbs.view().items(.@"0")[0..pt_header.intern_pool.limbs_len]));
3002 addBuf(&bufs, mem.sliceAsBytes(local.shared.items.view().items(.data)[0..pt_header.intern_pool.items_len]));3002 }
3003 addBuf(&bufs, mem.sliceAsBytes(local.shared.items.view().items(.tag)[0..pt_header.intern_pool.items_len]));3003 if (pt_header.intern_pool.extra_len > 0) {
3004 addBuf(&bufs, local.shared.strings.view().items(.@"0")[0..pt_header.intern_pool.string_bytes_len]);3004 addBuf(&bufs, mem.sliceAsBytes(local.shared.extra.view().items(.@"0")[0..pt_header.intern_pool.extra_len]));
3005 addBuf(&bufs, mem.sliceAsBytes(local.shared.tracked_insts.view().items(.@"0")[0..pt_header.intern_pool.tracked_insts_len]));3005 }
3006 addBuf(&bufs, mem.sliceAsBytes(local.shared.files.view().items(.bin_digest)[0..pt_header.intern_pool.files_len]));3006 if (pt_header.intern_pool.items_len > 0) {
3007 addBuf(&bufs, mem.sliceAsBytes(local.shared.files.view().items(.root_type)[0..pt_header.intern_pool.files_len]));3007 addBuf(&bufs, mem.sliceAsBytes(local.shared.items.view().items(.data)[0..pt_header.intern_pool.items_len]));
3008 addBuf(&bufs, mem.sliceAsBytes(local.shared.items.view().items(.tag)[0..pt_header.intern_pool.items_len]));
3009 }
3010 if (pt_header.intern_pool.string_bytes_len > 0) {
3011 addBuf(&bufs, local.shared.strings.view().items(.@"0")[0..pt_header.intern_pool.string_bytes_len]);
3012 }
3013 if (pt_header.intern_pool.tracked_insts_len > 0) {
3014 addBuf(&bufs, mem.sliceAsBytes(local.shared.tracked_insts.view().items(.@"0")[0..pt_header.intern_pool.tracked_insts_len]));
3015 }
3016 if (pt_header.intern_pool.files_len > 0) {
3017 addBuf(&bufs, mem.sliceAsBytes(local.shared.files.view().items(.bin_digest)[0..pt_header.intern_pool.files_len]));
3018 addBuf(&bufs, mem.sliceAsBytes(local.shared.files.view().items(.root_type)[0..pt_header.intern_pool.files_len]));
3019 }
3008 }3020 }
30093021
3010 //// TODO: compilation errors3022 //// TODO: compilation errors