aboutsummaryrefslogtreecommitdiff
path: root/src/Compilation.zig
diff options
context:
space:
mode:
authormlugg <mlugg@mlugg.co.uk>2025-02-04 14:42:09 +0000
committermlugg <mlugg@mlugg.co.uk>2025-02-04 16:20:29 +0000
commit3ca588bcc6d6640b7faa41a271580dd384963927 (patch)
treec47ab77e60e00f5c52a32257124d3bc6b642cf77 /src/Compilation.zig
parent55a2e535fdb663793b84769cb6c3a261bda3fc66 (diff)
downloadzig-3ca588bcc6d6640b7faa41a271580dd384963927.tar.gz
zig-3ca588bcc6d6640b7faa41a271580dd384963927.zip
compiler: integrate importing ZON with incremental compilation
The changes from a few commits earlier, where semantic analysis no longer occurs if any Zig files failed to lower to ZIR, mean `file` dependencies are no longer necessary! However, we now need them for ZON files, to be invalidated whenever a ZON file changes.
Diffstat (limited to 'src/Compilation.zig')
-rw-r--r--src/Compilation.zig16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig
index 93ce5ba6be..14c216854e 100644
--- a/src/Compilation.zig
+++ b/src/Compilation.zig
@@ -2903,10 +2903,12 @@ pub fn makeBinFileWritable(comp: *Compilation) !void {
const Header = extern struct {
intern_pool: extern struct {
thread_count: u32,
- file_deps_len: u32,
src_hash_deps_len: u32,
nav_val_deps_len: u32,
nav_ty_deps_len: u32,
+ interned_deps_len: u32,
+ zon_file_deps_len: u32,
+ embed_file_deps_len: u32,
namespace_deps_len: u32,
namespace_name_deps_len: u32,
first_dependency_len: u32,
@@ -2947,10 +2949,12 @@ pub fn saveState(comp: *Compilation) !void {
const header: Header = .{
.intern_pool = .{
.thread_count = @intCast(ip.locals.len),
- .file_deps_len = @intCast(ip.file_deps.count()),
.src_hash_deps_len = @intCast(ip.src_hash_deps.count()),
.nav_val_deps_len = @intCast(ip.nav_val_deps.count()),
.nav_ty_deps_len = @intCast(ip.nav_ty_deps.count()),
+ .interned_deps_len = @intCast(ip.interned_deps.count()),
+ .zon_file_deps_len = @intCast(ip.zon_file_deps.count()),
+ .embed_file_deps_len = @intCast(ip.embed_file_deps.count()),
.namespace_deps_len = @intCast(ip.namespace_deps.count()),
.namespace_name_deps_len = @intCast(ip.namespace_name_deps.count()),
.first_dependency_len = @intCast(ip.first_dependency.count()),
@@ -2975,14 +2979,18 @@ pub fn saveState(comp: *Compilation) !void {
addBuf(&bufs, mem.asBytes(&header));
addBuf(&bufs, mem.sliceAsBytes(pt_headers.items));
- addBuf(&bufs, mem.sliceAsBytes(ip.file_deps.keys()));
- addBuf(&bufs, mem.sliceAsBytes(ip.file_deps.values()));
addBuf(&bufs, mem.sliceAsBytes(ip.src_hash_deps.keys()));
addBuf(&bufs, mem.sliceAsBytes(ip.src_hash_deps.values()));
addBuf(&bufs, mem.sliceAsBytes(ip.nav_val_deps.keys()));
addBuf(&bufs, mem.sliceAsBytes(ip.nav_val_deps.values()));
addBuf(&bufs, mem.sliceAsBytes(ip.nav_ty_deps.keys()));
addBuf(&bufs, mem.sliceAsBytes(ip.nav_ty_deps.values()));
+ addBuf(&bufs, mem.sliceAsBytes(ip.interned_deps.keys()));
+ addBuf(&bufs, mem.sliceAsBytes(ip.interned_deps.values()));
+ addBuf(&bufs, mem.sliceAsBytes(ip.zon_file_deps.keys()));
+ addBuf(&bufs, mem.sliceAsBytes(ip.zon_file_deps.values()));
+ addBuf(&bufs, mem.sliceAsBytes(ip.embed_file_deps.keys()));
+ addBuf(&bufs, mem.sliceAsBytes(ip.embed_file_deps.values()));
addBuf(&bufs, mem.sliceAsBytes(ip.namespace_deps.keys()));
addBuf(&bufs, mem.sliceAsBytes(ip.namespace_deps.values()));
addBuf(&bufs, mem.sliceAsBytes(ip.namespace_name_deps.keys()));