diff options
| author | mlugg <mlugg@mlugg.co.uk> | 2024-02-04 17:27:41 +0000 |
|---|---|---|
| committer | mlugg <mlugg@mlugg.co.uk> | 2024-02-04 18:38:40 +0000 |
| commit | 0d8207c29236bf731f7d3bad189beb3a1e1b1d0c (patch) | |
| tree | d7cb3a14a5c3b9ce77f299b24502204318993913 /src/Compilation.zig | |
| parent | 269c1ae649017836f15313d1d4977402be11eed5 (diff) | |
| download | zig-0d8207c29236bf731f7d3bad189beb3a1e1b1d0c.tar.gz zig-0d8207c29236bf731f7d3bad189beb3a1e1b1d0c.zip | |
Zcu: refactor Decl.analysis field
* Functions failing codegen now set this failure on the function
analysis state. Decl analysis `codegen_failure` is reserved for
failures generating constant values.
* `liveness_failure` is consolidated into `codegen_failure`, as we do
not need to distinguish these, and Liveness.Verify is just a debugging
feature anyway.
* `sema_failure_retryable` and `codegen_failure_retryable` are removed.
Instead, retryable failures are recorded in the new
`Zcu.retryable_failures` list. On an incremental update, this list is
flushed, and all elements are marked as outdated so that we re-attempt
analysis and code generation.
Also remove the `generation` fields from `Zcu` and `Decl` as these are
not needed by our new strategy for incremental updates.
Diffstat (limited to 'src/Compilation.zig')
| -rw-r--r-- | src/Compilation.zig | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig index 06c0dc7e7f..596b8d5667 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -2141,7 +2141,6 @@ pub fn update(comp: *Compilation, main_progress_node: *std.Progress.Node) !void if (comp.module) |module| { module.compile_log_text.shrinkAndFree(gpa, 0); - module.generation += 1; // Make sure std.zig is inside the import_table. We unconditionally need // it for start.zig. @@ -3491,9 +3490,7 @@ pub fn performAllTheWork( if (comp.module) |mod| { try reportMultiModuleErrors(mod); - } - - if (comp.module) |mod| { + try mod.flushRetryableFailures(); mod.sema_prog_node = main_progress_node.start("Semantic Analysis", 0); mod.sema_prog_node.activate(); } @@ -3551,13 +3548,11 @@ fn processOneJob(comp: *Compilation, job: Job, prog_node: *std.Progress.Node) !v .file_failure, .sema_failure, - .liveness_failure, .codegen_failure, .dependency_failure, - .sema_failure_retryable, => return, - .complete, .codegen_failure_retryable => { + .complete => { const named_frame = tracy.namedFrame("codegen_decl"); defer named_frame.end(); @@ -3592,17 +3587,15 @@ fn processOneJob(comp: *Compilation, job: Job, prog_node: *std.Progress.Node) !v switch (decl.analysis) { .unreferenced => unreachable, .in_progress => unreachable, - .outdated => unreachable, .file_failure, .sema_failure, .dependency_failure, - .sema_failure_retryable, => return, // emit-h only requires semantic analysis of the Decl to be complete, // it does not depend on machine code generation to succeed. - .liveness_failure, .codegen_failure, .codegen_failure_retryable, .complete => { + .codegen_failure, .complete => { const named_frame = tracy.namedFrame("emit_h_decl"); defer named_frame.end(); @@ -3674,7 +3667,8 @@ fn processOneJob(comp: *Compilation, job: Job, prog_node: *std.Progress.Node) !v "unable to update line number: {s}", .{@errorName(err)}, )); - decl.analysis = .codegen_failure_retryable; + decl.analysis = .codegen_failure; + try module.retryable_failures.append(gpa, InternPool.Depender.wrap(.{ .decl = decl_index })); }; }, .analyze_mod => |pkg| { |
