authorgravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2025-02-05 12:23:53+00:00
committergravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2025-02-06 08:21:19+00:00
log62e251dcaa366c15e1e591d859738bb0d735dc9a
tree0871ec81bb2c9f781672e334edaba2f4d20a50a0
parent1a1389c513119c344d2eafefd3b6353b2c6cd343

incremental: codegen types which are recreated

Unfortunately, I can't easily add a test for this, because the repro depends on some details of DWARF layout; but I've confirmed that it fixes a bug repro on another branch.

1 files changed, 15 insertions(+), 0 deletions(-)

src/Zcu/PerThread.zig+15
......@@ -3810,6 +3810,13 @@ fn recreateStructType(
38103810 // No need to re-scan the namespace -- `zirStructDecl` will ultimately do that if the type is still alive.
38113811 try zcu.comp.queueJob(.{ .resolve_type_fully = wip_ty.index });
38123812
3813 codegen_type: {
3814 if (zcu.comp.config.use_llvm) break :codegen_type;
3815 if (file.mod.strip) break :codegen_type;
3816 // This job depends on any resolve_type_fully jobs queued up before it.
3817 try zcu.comp.queueJob(.{ .codegen_type = wip_ty.index });
3818 }
3819
38133820 const new_ty = wip_ty.finish(ip, struct_obj.namespace);
38143821 if (inst_info.inst == .main_struct_inst) {
38153822 // This is the root type of a file! Update the reference.
......@@ -3898,6 +3905,14 @@ fn recreateUnionType(
38983905 zcu.namespacePtr(namespace_index).owner_type = wip_ty.index;
38993906 // No need to re-scan the namespace -- `zirUnionDecl` will ultimately do that if the type is still alive.
39003907 try zcu.comp.queueJob(.{ .resolve_type_fully = wip_ty.index });
3908
3909 codegen_type: {
3910 if (zcu.comp.config.use_llvm) break :codegen_type;
3911 if (file.mod.strip) break :codegen_type;
3912 // This job depends on any resolve_type_fully jobs queued up before it.
3913 try zcu.comp.queueJob(.{ .codegen_type = wip_ty.index });
3914 }
3915
39013916 return wip_ty.finish(ip, namespace_index);
39023917}
39033918