aboutsummaryrefslogtreecommitdiff
path: root/src/Module.zig
diff options
context:
space:
mode:
authormlugg <mlugg@mlugg.co.uk>2024-02-03 01:22:56 +0000
committermlugg <mlugg@mlugg.co.uk>2024-02-04 18:38:39 +0000
commit1e91ee1e05f08013e3a4edec5d9f0aef978f3f0b (patch)
tree92f1353ae14a77d14b11897cd9c48484b63bd9c3 /src/Module.zig
parent7f4bd247c7735ccf277c9bba42222e014cacf856 (diff)
downloadzig-1e91ee1e05f08013e3a4edec5d9f0aef978f3f0b.tar.gz
zig-1e91ee1e05f08013e3a4edec5d9f0aef978f3f0b.zip
Zir: store extra source hashes required for incremental
Also add corresponding invaidation logic to Zcu. Therefore, the only invalidation logic which is not yet in place is `decl_val` dependencies.
Diffstat (limited to 'src/Module.zig')
-rw-r--r--src/Module.zig12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/Module.zig b/src/Module.zig
index d6ee0485ce..93b5066192 100644
--- a/src/Module.zig
+++ b/src/Module.zig
@@ -2957,6 +2957,18 @@ fn updateZirRefs(zcu: *Module, file: *File, old_zir: Zir) !void {
continue;
};
+ if (old_zir.getAssociatedSrcHash(old_inst)) |old_hash| hash_changed: {
+ if (new_zir.getAssociatedSrcHash(ti.inst)) |new_hash| {
+ if (std.zig.srcHashEql(old_hash, new_hash)) {
+ break :hash_changed;
+ }
+ }
+ // The source hash associated with this instruction changed - invalidate relevant dependencies.
+ zcu.comp.mutex.lock();
+ defer zcu.comp.mutex.unlock();
+ try zcu.markDependeeOutdated(.{ .src_hash = ti_idx });
+ }
+
// If this is a `struct_decl` etc, we must invalidate any outdated namespace dependencies.
const has_namespace = switch (old_tag[@intFromEnum(old_inst)]) {
.extended => switch (old_data[@intFromEnum(old_inst)].extended.opcode) {