authorgravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2025-02-04 12:00:34+00:00
committergravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2025-02-04 16:20:29+00:00
log0907432fffd2d9f5319022332a60fc88d3aacf4e
tree2f7972c6df3344599e01d99c72b82e75e1a990aa
parenta8e53801d0bfe2132831b8286c4a237788aea8fa
signaturelock-open Commit is signed but in an unrecognized format.

compiler: a few renames

This is mainly in preparation for integrating ZonGen into the pipeline properly, although these names are better because `astGenFile` isn't *necessarily* running AstGen; it may determine that the current ZIR is up-to-date, or load cached ZIR.

4 files changed, 9 insertions(+), 9 deletions(-)

src/Compilation.zig+6-6
...@@ -3779,7 +3779,7 @@ fn performAllTheWorkInner(...@@ -3779,7 +3779,7 @@ fn performAllTheWorkInner(
3779 // will be needed by the worker threads.3779 // will be needed by the worker threads.
3780 const path_digest = zcu.filePathDigest(file_index);3780 const path_digest = zcu.filePathDigest(file_index);
3781 const file = zcu.fileByIndex(file_index);3781 const file = zcu.fileByIndex(file_index);
3782 comp.thread_pool.spawnWgId(&astgen_wait_group, workerAstGenFile, .{3782 comp.thread_pool.spawnWgId(&astgen_wait_group, workerUpdateFile, .{
3783 comp, file, file_index, path_digest, zir_prog_node, &astgen_wait_group, .root,3783 comp, file, file_index, path_digest, zir_prog_node, &astgen_wait_group, .root,
3784 });3784 });
3785 }3785 }
...@@ -3787,7 +3787,7 @@ fn performAllTheWorkInner(...@@ -3787,7 +3787,7 @@ fn performAllTheWorkInner(
37873787
3788 for (0.., zcu.embed_table.values()) |ef_index_usize, ef| {3788 for (0.., zcu.embed_table.values()) |ef_index_usize, ef| {
3789 const ef_index: Zcu.EmbedFile.Index = @enumFromInt(ef_index_usize);3789 const ef_index: Zcu.EmbedFile.Index = @enumFromInt(ef_index_usize);
3790 comp.thread_pool.spawnWgId(&astgen_wait_group, workerCheckEmbedFile, .{3790 comp.thread_pool.spawnWgId(&astgen_wait_group, workerUpdateEmbedFile, .{
3791 comp, ef_index, ef,3791 comp, ef_index, ef,
3792 });3792 });
3793 }3793 }
...@@ -4280,7 +4280,7 @@ fn workerDocsWasmFallible(comp: *Compilation, prog_node: std.Progress.Node) anye...@@ -4280,7 +4280,7 @@ fn workerDocsWasmFallible(comp: *Compilation, prog_node: std.Progress.Node) anye
4280 };4280 };
4281}4281}
42824282
4283fn workerAstGenFile(4283fn workerUpdateFile(
4284 tid: usize,4284 tid: usize,
4285 comp: *Compilation,4285 comp: *Compilation,
4286 file: *Zcu.File,4286 file: *Zcu.File,
...@@ -4296,7 +4296,7 @@ fn workerAstGenFile(...@@ -4296,7 +4296,7 @@ fn workerAstGenFile(
42964296
4297 const pt: Zcu.PerThread = .activate(comp.zcu.?, @enumFromInt(tid));4297 const pt: Zcu.PerThread = .activate(comp.zcu.?, @enumFromInt(tid));
4298 defer pt.deactivate();4298 defer pt.deactivate();
4299 pt.astGenFile(file, path_digest) catch |err| switch (err) {4299 pt.updateFile(file, path_digest) catch |err| switch (err) {
4300 error.AnalysisFail => return,4300 error.AnalysisFail => return,
4301 else => {4301 else => {
4302 pt.reportRetryableAstGenError(src, file_index, err) catch |oom| switch (oom) {4302 pt.reportRetryableAstGenError(src, file_index, err) catch |oom| switch (oom) {
...@@ -4352,7 +4352,7 @@ fn workerAstGenFile(...@@ -4352,7 +4352,7 @@ fn workerAstGenFile(
4352 .importing_file = file_index,4352 .importing_file = file_index,
4353 .import_tok = item.data.token,4353 .import_tok = item.data.token,
4354 } };4354 } };
4355 comp.thread_pool.spawnWgId(wg, workerAstGenFile, .{4355 comp.thread_pool.spawnWgId(wg, workerUpdateFile, .{
4356 comp, import_result.file, import_result.file_index, imported_path_digest, prog_node, wg, sub_src,4356 comp, import_result.file, import_result.file_index, imported_path_digest, prog_node, wg, sub_src,
4357 });4357 });
4358 }4358 }
...@@ -4375,7 +4375,7 @@ fn workerUpdateBuiltinZigFile(...@@ -4375,7 +4375,7 @@ fn workerUpdateBuiltinZigFile(
4375 };4375 };
4376}4376}
43774377
4378fn workerCheckEmbedFile(tid: usize, comp: *Compilation, ef_index: Zcu.EmbedFile.Index, ef: *Zcu.EmbedFile) void {4378fn workerUpdateEmbedFile(tid: usize, comp: *Compilation, ef_index: Zcu.EmbedFile.Index, ef: *Zcu.EmbedFile) void {
4379 comp.detectEmbedFileUpdate(@enumFromInt(tid), ef_index, ef) catch |err| switch (err) {4379 comp.detectEmbedFileUpdate(@enumFromInt(tid), ef_index, ef) catch |err| switch (err) {
4380 error.OutOfMemory => {4380 error.OutOfMemory => {
4381 comp.mutex.lock();4381 comp.mutex.lock();
src/Sema.zig+1-1
...@@ -6140,7 +6140,7 @@ fn zirCImport(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileEr...@@ -6140,7 +6140,7 @@ fn zirCImport(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileEr
6140 return sema.fail(&child_block, src, "C import failed: {s}", .{@errorName(err)});6140 return sema.fail(&child_block, src, "C import failed: {s}", .{@errorName(err)});
61416141
6142 const path_digest = zcu.filePathDigest(result.file_index);6142 const path_digest = zcu.filePathDigest(result.file_index);
6143 pt.astGenFile(result.file, path_digest) catch |err|6143 pt.updateFile(result.file, path_digest) catch |err|
6144 return sema.fail(&child_block, src, "C import failed: {s}", .{@errorName(err)});6144 return sema.fail(&child_block, src, "C import failed: {s}", .{@errorName(err)});
61456145
6146 try sema.declareDependency(.{ .file = result.file_index });6146 try sema.declareDependency(.{ .file = result.file_index });
src/Zcu.zig+1-1
...@@ -785,7 +785,7 @@ pub const File = struct {...@@ -785,7 +785,7 @@ pub const File = struct {
785785
786 // Here we do not modify stat fields because this function is the one786 // Here we do not modify stat fields because this function is the one
787 // used for error reporting. We need to keep the stat fields stale so that787 // used for error reporting. We need to keep the stat fields stale so that
788 // astGenFile can know to regenerate ZIR.788 // updateFile can know to regenerate ZIR.
789789
790 file.source = source;790 file.source = source;
791 errdefer comptime unreachable; // don't error after populating `source`791 errdefer comptime unreachable; // don't error after populating `source`
src/Zcu/PerThread.zig+1-1
...@@ -73,7 +73,7 @@ pub fn destroyFile(pt: Zcu.PerThread, file_index: Zcu.File.Index) void {...@@ -73,7 +73,7 @@ pub fn destroyFile(pt: Zcu.PerThread, file_index: Zcu.File.Index) void {
73 if (!is_builtin) gpa.destroy(file);73 if (!is_builtin) gpa.destroy(file);
74}74}
7575
76pub fn astGenFile(76pub fn updateFile(
77 pt: Zcu.PerThread,77 pt: Zcu.PerThread,
78 file: *Zcu.File,78 file: *Zcu.File,
79 path_digest: Cache.BinDigest,79 path_digest: Cache.BinDigest,