Skip to content

Commit 32bcecb

Browse files
committed
attempt 2?
1 parent 28148ff commit 32bcecb

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

Diff for: src/Compilation.zig

+1
Original file line numberDiff line numberDiff line change
@@ -2752,6 +2752,7 @@ pub fn emitLlvmObject(
27522752
.sanitize_address = comp.config.any_sanitize_address,
27532753
.fuzz = comp.config.any_fuzz,
27542754
.lto = comp.config.lto,
2755+
.prog_node = sub_prog_node,
27552756
});
27562757
}
27572758

Diff for: src/codegen/llvm.zig

+21-1
Original file line numberDiff line numberDiff line change
@@ -1058,6 +1058,8 @@ pub const Object = struct {
10581058
sanitize_address: bool,
10591059
fuzz: bool,
10601060
lto: Compilation.Config.LtoMode,
1061+
1062+
prog_node: std.Progress.Node,
10611063
};
10621064

10631065
pub fn emit(o: *Object, options: EmitOptions) error{ LinkFailure, OutOfMemory }!void {
@@ -1320,7 +1322,15 @@ pub const Object = struct {
13201322
if (count <= 0) @panic("ZIG_MULTITHREAD_EMIT must be greater than 0");
13211323
break :blk split_buf[0..count];
13221324
} else split_buf[0..1];
1323-
if (split_res.len > 1) module.split(split_res) else split_res[0] = module;
1325+
if (split_res.len > 1) {
1326+
const sub = options.prog_node.start("Split Module", 1);
1327+
defer sub.end();
1328+
1329+
module.split(split_res);
1330+
} else split_res[0] = module;
1331+
1332+
const sub = options.prog_node.start("Do Emit", split_res.len);
1333+
defer sub.end();
13241334

13251335
var threads: [32]std.Thread = undefined;
13261336
for (split_res, threads[0..split_res.len], 0..) |m, *t, i| {
@@ -1335,11 +1345,18 @@ pub const Object = struct {
13351345
m,
13361346
&options,
13371347
i,
1348+
sub,
13381349
}) catch @panic("thread spawn fail");
13391350
}
13401351
for (threads[0..split_res.len]) |*t| {
13411352
t.join();
13421353
}
1354+
1355+
// done!
1356+
if (split_res.len > 1) {
1357+
std.log.err("LLVM SPLIT EMIT ENDED. EARLY-EXITING.", .{});
1358+
std.process.exit(0);
1359+
}
13431360
}
13441361
fn emit_thread(
13451362
target: *llvm.Target,
@@ -1352,7 +1369,10 @@ pub const Object = struct {
13521369
module: *llvm.Module,
13531370
options: *const EmitOptions,
13541371
index: usize,
1372+
prog_node: std.Progress.Node,
13551373
) void {
1374+
defer prog_node.completeOne();
1375+
13561376
var error_message: [*:0]const u8 = undefined;
13571377
var target_machine = llvm.TargetMachine.create(
13581378
target,

0 commit comments

Comments
 (0)