authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-12-22 17:29:28-08:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-12-23 22:15:12-08:00
log187d0a692de2f00e64a446548873f7a12d9ddb4f
tree753349f54dc9b6e3af38557f441665cbc7f0a177
parent7c1236e267e536379f8b91148117fb0b8e965334

compiler: handle cancelation from finishPrelinkQueue


3 files changed, 5 insertions(+), 3 deletions(-)

src/Compilation.zig+3-1
...@@ -5056,7 +5056,9 @@ fn dispatchPrelinkWork(comp: *Compilation, main_progress_node: std.Progress.Node...@@ -5056,7 +5056,9 @@ fn dispatchPrelinkWork(comp: *Compilation, main_progress_node: std.Progress.Node
5056 }5056 }
50575057
5058 prelink_group.wait(io);5058 prelink_group.wait(io);
5059 comp.link_queue.finishPrelinkQueue(comp);5059 comp.link_queue.finishPrelinkQueue(comp) catch |err| switch (err) {
5060 error.Canceled => return,
5061 };
5060}5062}
50615063
5062const JobError = Allocator.Error || Io.Cancelable;5064const JobError = Allocator.Error || Io.Cancelable;
src/InternPool.zig-1
...@@ -11,7 +11,6 @@ const assert = std.debug.assert;...@@ -11,7 +11,6 @@ const assert = std.debug.assert;
11const BigIntConst = std.math.big.int.Const;11const BigIntConst = std.math.big.int.Const;
12const BigIntMutable = std.math.big.int.Mutable;12const BigIntMutable = std.math.big.int.Mutable;
13const Cache = std.Build.Cache;13const Cache = std.Build.Cache;
14const Io = std.Io;
15const Limb = std.math.big.Limb;14const Limb = std.math.big.Limb;
16const Hash = std.hash.Wyhash;15const Hash = std.hash.Wyhash;
17const Zir = std.zig.Zir;16const Zir = std.zig.Zir;
src/link/Queue.zig+2-1
...@@ -121,7 +121,7 @@ pub fn enqueueZcu(...@@ -121,7 +121,7 @@ pub fn enqueueZcu(
121 link.doZcuTask(comp, tid, task);121 link.doZcuTask(comp, tid, task);
122}122}
123123
124pub fn finishPrelinkQueue(q: *Queue, comp: *Compilation) void {124pub fn finishPrelinkQueue(q: *Queue, comp: *Compilation) Io.Cancelable!void {
125 if (q.future != null) {125 if (q.future != null) {
126 q.prelink_queue.close(comp.io);126 q.prelink_queue.close(comp.io);
127 return;127 return;
...@@ -136,6 +136,7 @@ pub fn finishPrelinkQueue(q: *Queue, comp: *Compilation) void {...@@ -136,6 +136,7 @@ pub fn finishPrelinkQueue(q: *Queue, comp: *Compilation) void {
136 } else |err| switch (err) {136 } else |err| switch (err) {
137 error.OutOfMemory => comp.link_diags.setAllocFailure(),137 error.OutOfMemory => comp.link_diags.setAllocFailure(),
138 error.LinkFailure => {},138 error.LinkFailure => {},
139 error.Canceled => |e| return e,
139 }140 }
140 }141 }
141}142}