@@ -3273,7 +3273,7 @@ pub fn performAllTheWork(
if (!build_options.only_c and !build_options.only_core_functionality) {
if (comp.docs_emit != null) {
try taskDocsCopy(comp, &comp.work_queue_wait_group);
comp.thread_pool.spawnWg(&comp.work_queue_wait_group, workerDocsCopy, .{comp});
comp.work_queue_wait_group.spawnManager(workerDocsWasm, .{ comp, &wasm_prog_node });
}
}
@@ -3305,39 +3305,34 @@ pub fn performAllTheWork(
const file = mod.builtin_file orelse continue;
comp.astgen_wait_group.start();
try comp.thread_pool.spawn(workerUpdateBuiltinZigFile, .{
comp, mod, file, &comp.astgen_wait_group,
comp.thread_pool.spawnWg(&comp.astgen_wait_group, workerUpdateBuiltinZigFile, .{
comp, mod, file,
});
}
}
while (comp.astgen_work_queue.readItem()) |file| {
comp.astgen_wait_group.start();
try comp.thread_pool.spawn(workerAstGenFile, .{
comp.thread_pool.spawnWg(&comp.astgen_wait_group, workerAstGenFile, .{
comp, file, &zir_prog_node, &comp.astgen_wait_group, .root,
});
}
while (comp.embed_file_work_queue.readItem()) |embed_file| {
comp.astgen_wait_group.start();
try comp.thread_pool.spawn(workerCheckEmbedFile, .{
comp, embed_file, &comp.astgen_wait_group,
comp.thread_pool.spawnWg(&comp.astgen_wait_group, workerCheckEmbedFile, .{
comp, embed_file,
});
}
while (comp.c_object_work_queue.readItem()) |c_object| {
comp.work_queue_wait_group.start();
try comp.thread_pool.spawn(workerUpdateCObject, .{
comp, c_object, &c_obj_prog_node, &comp.work_queue_wait_group,
comp.thread_pool.spawnWg(&comp.work_queue_wait_group, workerUpdateCObject, .{
comp, c_object, &c_obj_prog_node,
});
}
if (!build_options.only_core_functionality) {
while (comp.win32_resource_work_queue.readItem()) |win32_resource| {
comp.work_queue_wait_group.start();
try comp.thread_pool.spawn(workerUpdateWin32Resource, .{
comp, win32_resource, &win32_resource_prog_node, &comp.work_queue_wait_group,
comp.thread_pool.spawnWg(&comp.work_queue_wait_group, workerUpdateWin32Resource, .{
comp, win32_resource, &win32_resource_prog_node,
});
}
}
@@ -3680,14 +3675,7 @@ fn processOneJob(comp: *Compilation, job: Job, prog_node: *std.Progress.Node) !v
}
}
fn taskDocsCopy(comp: *Compilation, wg: *WaitGroup) !void {
wg.start();
errdefer wg.finish();
try comp.thread_pool.spawn(workerDocsCopy, .{ comp, wg });
}
fn workerDocsCopy(comp: *Compilation, wg: *WaitGroup) void {
defer wg.finish();
fn workerDocsCopy(comp: *Compilation) void {
docsCopyFallible(comp) catch |err| {
return comp.lockAndSetMiscFailure(
.docs_copy,
@@ -3965,8 +3953,6 @@ fn workerAstGenFile(
wg: *WaitGroup,
src: AstGenSrc,
) void {
defer wg.finish();
var child_prog_node = prog_node.start(file.sub_file_path, 0);
child_prog_node.activate();
defer child_prog_node.end();
@@ -4025,13 +4011,9 @@ fn workerAstGenFile(
.importing_file = file,
.import_tok = item.data.token,
} };
wg.start();
comp.thread_pool.spawn(workerAstGenFile, .{
comp.thread_pool.spawnWg(wg, workerAstGenFile, .{
comp, import_result.file, prog_node, wg, sub_src,
}) catch {
wg.finish();
continue;
};
});
}
}
}
@@ -4041,9 +4023,7 @@ fn workerUpdateBuiltinZigFile(
comp: *Compilation,
mod: *Package.Module,
file: *Module.File,
wg: *WaitGroup,
) void {
defer wg.finish();
Builtin.populateFile(comp, mod, file) catch |err| {
comp.mutex.lock();
defer comp.mutex.unlock();
@@ -4054,13 +4034,7 @@ fn workerUpdateBuiltinZigFile(
};
}
fn workerCheckEmbedFile(
comp: *Compilation,
embed_file: *Module.EmbedFile,
wg: *WaitGroup,
) void {
defer wg.finish();
fn workerCheckEmbedFile(comp: *Compilation, embed_file: *Module.EmbedFile) void {
comp.detectEmbedFileUpdate(embed_file) catch |err| {
comp.reportRetryableEmbedFileError(embed_file, err) catch |oom| switch (oom) {
// Swallowing this error is OK because it's implied to be OOM when
@@ -4289,10 +4263,7 @@ fn workerUpdateCObject(
comp: *Compilation,
c_object: *CObject,
progress_node: *std.Progress.Node,
wg: *WaitGroup,
) void {
defer wg.finish();
comp.updateCObject(c_object, progress_node) catch |err| switch (err) {
error.AnalysisFail => return,
else => {
@@ -4309,10 +4280,7 @@ fn workerUpdateWin32Resource(
comp: *Compilation,
win32_resource: *Win32Resource,
progress_node: *std.Progress.Node,
wg: *WaitGroup,
) void {
defer wg.finish();
comp.updateWin32Resource(win32_resource, progress_node) catch |err| switch (err) {
error.AnalysisFail => return,
else => {