| author | |
| committer | |
| log | f97c2f28fdc3061bc7e30ccfcafaccbee77993b6 |
| tree | a2c4165829d84b35df23346b1808a43e0cccec41 |
| parent | f6873c6b00544923d5699737651f2bc4fe29fd06 |
49 files changed, 226 insertions(+), 355 deletions(-)
lib/compiler/aro/aro/Diagnostics.zig+2-2| ... | @@ -528,7 +528,7 @@ const MsgWriter = struct { | ... | @@ -528,7 +528,7 @@ const MsgWriter = struct { |
| 528 | config: std.io.tty.Config, | 528 | config: std.io.tty.Config, |
| 529 | 529 | ||
| 530 | fn init(config: std.io.tty.Config) MsgWriter { | 530 | fn init(config: std.io.tty.Config) MsgWriter { |
| 531 | std.debug.getStderrMutex().lock(); | 531 | std.debug.lockStdErr(); |
| 532 | return .{ | 532 | return .{ |
| 533 | .w = std.io.bufferedWriter(std.io.getStdErr().writer()), | 533 | .w = std.io.bufferedWriter(std.io.getStdErr().writer()), |
| 534 | .config = config, | 534 | .config = config, |
| ... | @@ -537,7 +537,7 @@ const MsgWriter = struct { | ... | @@ -537,7 +537,7 @@ const MsgWriter = struct { |
| 537 | 537 | ||
| 538 | pub fn deinit(m: *MsgWriter) void { | 538 | pub fn deinit(m: *MsgWriter) void { |
| 539 | m.w.flush() catch {}; | 539 | m.w.flush() catch {}; |
| 540 | std.debug.getStderrMutex().unlock(); | 540 | std.debug.unlockStdErr(); |
| 541 | } | 541 | } |
| 542 | 542 | ||
| 543 | pub fn print(m: *MsgWriter, comptime fmt: []const u8, args: anytype) void { | 543 | pub fn print(m: *MsgWriter, comptime fmt: []const u8, args: anytype) void { |
lib/compiler/build_runner.zig+9-11| ... | @@ -289,8 +289,7 @@ pub fn main() !void { | ... | @@ -289,8 +289,7 @@ pub fn main() !void { |
| 289 | .windows_api => {}, | 289 | .windows_api => {}, |
| 290 | } | 290 | } |
| 291 | 291 | ||
| 292 | var progress: std.Progress = .{ .dont_print_on_dumb = true }; | 292 | const main_progress_node = std.Progress.start(.{}); |
| 293 | const main_progress_node = progress.start("", 0); | ||
| 294 | 293 | ||
| 295 | builder.debug_log_scopes = debug_log_scopes.items; | 294 | builder.debug_log_scopes = debug_log_scopes.items; |
| 296 | builder.resolveInstallPrefix(install_prefix, dir_list); | 295 | builder.resolveInstallPrefix(install_prefix, dir_list); |
| ... | @@ -385,7 +384,7 @@ fn runStepNames( | ... | @@ -385,7 +384,7 @@ fn runStepNames( |
| 385 | arena: std.mem.Allocator, | 384 | arena: std.mem.Allocator, |
| 386 | b: *std.Build, | 385 | b: *std.Build, |
| 387 | step_names: []const []const u8, | 386 | step_names: []const []const u8, |
| 388 | parent_prog_node: *std.Progress.Node, | 387 | parent_prog_node: std.Progress.Node, |
| 389 | thread_pool_options: std.Thread.Pool.Options, | 388 | thread_pool_options: std.Thread.Pool.Options, |
| 390 | run: *Run, | 389 | run: *Run, |
| 391 | seed: u32, | 390 | seed: u32, |
| ... | @@ -452,7 +451,7 @@ fn runStepNames( | ... | @@ -452,7 +451,7 @@ fn runStepNames( |
| 452 | { | 451 | { |
| 453 | defer parent_prog_node.end(); | 452 | defer parent_prog_node.end(); |
| 454 | 453 | ||
| 455 | var step_prog = parent_prog_node.start("steps", step_stack.count()); | 454 | const step_prog = parent_prog_node.start("steps", step_stack.count()); |
| 456 | defer step_prog.end(); | 455 | defer step_prog.end(); |
| 457 | 456 | ||
| 458 | var wait_group: std.Thread.WaitGroup = .{}; | 457 | var wait_group: std.Thread.WaitGroup = .{}; |
| ... | @@ -467,7 +466,7 @@ fn runStepNames( | ... | @@ -467,7 +466,7 @@ fn runStepNames( |
| 467 | if (step.state == .skipped_oom) continue; | 466 | if (step.state == .skipped_oom) continue; |
| 468 | 467 | ||
| 469 | thread_pool.spawnWg(&wait_group, workerMakeOneStep, .{ | 468 | thread_pool.spawnWg(&wait_group, workerMakeOneStep, .{ |
| 470 | &wait_group, &thread_pool, b, step, &step_prog, run, | 469 | &wait_group, &thread_pool, b, step, step_prog, run, |
| 471 | }); | 470 | }); |
| 472 | } | 471 | } |
| 473 | } | 472 | } |
| ... | @@ -891,7 +890,7 @@ fn workerMakeOneStep( | ... | @@ -891,7 +890,7 @@ fn workerMakeOneStep( |
| 891 | thread_pool: *std.Thread.Pool, | 890 | thread_pool: *std.Thread.Pool, |
| 892 | b: *std.Build, | 891 | b: *std.Build, |
| 893 | s: *Step, | 892 | s: *Step, |
| 894 | prog_node: *std.Progress.Node, | 893 | prog_node: std.Progress.Node, |
| 895 | run: *Run, | 894 | run: *Run, |
| 896 | ) void { | 895 | ) void { |
| 897 | // First, check the conditions for running this step. If they are not met, | 896 | // First, check the conditions for running this step. If they are not met, |
| ... | @@ -941,11 +940,10 @@ fn workerMakeOneStep( | ... | @@ -941,11 +940,10 @@ fn workerMakeOneStep( |
| 941 | } | 940 | } |
| 942 | } | 941 | } |
| 943 | 942 | ||
| 944 | var sub_prog_node = prog_node.start(s.name, 0); | 943 | const sub_prog_node = prog_node.start(s.name, 0); |
| 945 | sub_prog_node.activate(); | ||
| 946 | defer sub_prog_node.end(); | 944 | defer sub_prog_node.end(); |
| 947 | 945 | ||
| 948 | const make_result = s.make(&sub_prog_node); | 946 | const make_result = s.make(sub_prog_node); |
| 949 | 947 | ||
| 950 | // No matter the result, we want to display error/warning messages. | 948 | // No matter the result, we want to display error/warning messages. |
| 951 | const show_compile_errors = !run.prominent_compile_errors and | 949 | const show_compile_errors = !run.prominent_compile_errors and |
| ... | @@ -954,8 +952,8 @@ fn workerMakeOneStep( | ... | @@ -954,8 +952,8 @@ fn workerMakeOneStep( |
| 954 | const show_stderr = s.result_stderr.len > 0; | 952 | const show_stderr = s.result_stderr.len > 0; |
| 955 | 953 | ||
| 956 | if (show_error_msgs or show_compile_errors or show_stderr) { | 954 | if (show_error_msgs or show_compile_errors or show_stderr) { |
| 957 | sub_prog_node.context.lock_stderr(); | 955 | std.debug.lockStdErr(); |
| 958 | defer sub_prog_node.context.unlock_stderr(); | 956 | defer std.debug.unlockStdErr(); |
| 959 | 957 | ||
| 960 | printErrorMessages(b, s, run) catch {}; | 958 | printErrorMessages(b, s, run) catch {}; |
| 961 | } | 959 | } |
lib/std/Build.zig+5-5| ... | @@ -1059,7 +1059,7 @@ pub fn getUninstallStep(b: *Build) *Step { | ... | @@ -1059,7 +1059,7 @@ pub fn getUninstallStep(b: *Build) *Step { |
| 1059 | return &b.uninstall_tls.step; | 1059 | return &b.uninstall_tls.step; |
| 1060 | } | 1060 | } |
| 1061 | 1061 | ||
| 1062 | fn makeUninstall(uninstall_step: *Step, prog_node: *std.Progress.Node) anyerror!void { | 1062 | fn makeUninstall(uninstall_step: *Step, prog_node: std.Progress.Node) anyerror!void { |
| 1063 | _ = prog_node; | 1063 | _ = prog_node; |
| 1064 | const uninstall_tls: *TopLevelStep = @fieldParentPtr("step", uninstall_step); | 1064 | const uninstall_tls: *TopLevelStep = @fieldParentPtr("step", uninstall_step); |
| 1065 | const b: *Build = @fieldParentPtr("uninstall_tls", uninstall_tls); | 1065 | const b: *Build = @fieldParentPtr("uninstall_tls", uninstall_tls); |
| ... | @@ -2281,10 +2281,10 @@ pub const LazyPath = union(enum) { | ... | @@ -2281,10 +2281,10 @@ pub const LazyPath = union(enum) { |
| 2281 | .cwd_relative => |p| return src_builder.pathFromCwd(p), | 2281 | .cwd_relative => |p| return src_builder.pathFromCwd(p), |
| 2282 | .generated => |gen| { | 2282 | .generated => |gen| { |
| 2283 | var file_path: []const u8 = gen.file.step.owner.pathFromRoot(gen.file.path orelse { | 2283 | var file_path: []const u8 = gen.file.step.owner.pathFromRoot(gen.file.path orelse { |
| 2284 | std.debug.getStderrMutex().lock(); | 2284 | std.debug.lockStdErr(); |
| 2285 | const stderr = std.io.getStdErr(); | 2285 | const stderr = std.io.getStdErr(); |
| 2286 | dumpBadGetPathHelp(gen.file.step, stderr, src_builder, asking_step) catch {}; | 2286 | dumpBadGetPathHelp(gen.file.step, stderr, src_builder, asking_step) catch {}; |
| 2287 | std.debug.getStderrMutex().unlock(); | 2287 | std.debug.unlockStdErr(); |
| 2288 | @panic("misconfigured build script"); | 2288 | @panic("misconfigured build script"); |
| 2289 | }); | 2289 | }); |
| 2290 | 2290 | ||
| ... | @@ -2351,8 +2351,8 @@ fn dumpBadDirnameHelp( | ... | @@ -2351,8 +2351,8 @@ fn dumpBadDirnameHelp( |
| 2351 | comptime msg: []const u8, | 2351 | comptime msg: []const u8, |
| 2352 | args: anytype, | 2352 | args: anytype, |
| 2353 | ) anyerror!void { | 2353 | ) anyerror!void { |
| 2354 | debug.getStderrMutex().lock(); | 2354 | debug.lockStdErr(); |
| 2355 | defer debug.getStderrMutex().unlock(); | 2355 | defer debug.unlockStdErr(); |
| 2356 | 2356 | ||
| 2357 | const stderr = io.getStdErr(); | 2357 | const stderr = io.getStdErr(); |
| 2358 | const w = stderr.writer(); | 2358 | const w = stderr.writer(); |
lib/std/Build/Step.zig+8-14| ... | @@ -58,7 +58,7 @@ pub const TestResults = struct { | ... | @@ -58,7 +58,7 @@ pub const TestResults = struct { |
| 58 | } | 58 | } |
| 59 | }; | 59 | }; |
| 60 | 60 | ||
| 61 | pub const MakeFn = *const fn (step: *Step, prog_node: *std.Progress.Node) anyerror!void; | 61 | pub const MakeFn = *const fn (step: *Step, prog_node: std.Progress.Node) anyerror!void; |
| 62 | 62 | ||
| 63 | pub const State = enum { | 63 | pub const State = enum { |
| 64 | precheck_unstarted, | 64 | precheck_unstarted, |
| ... | @@ -176,7 +176,7 @@ pub fn init(options: StepOptions) Step { | ... | @@ -176,7 +176,7 @@ pub fn init(options: StepOptions) Step { |
| 176 | /// If the Step's `make` function reports `error.MakeFailed`, it indicates they | 176 | /// If the Step's `make` function reports `error.MakeFailed`, it indicates they |
| 177 | /// have already reported the error. Otherwise, we add a simple error report | 177 | /// have already reported the error. Otherwise, we add a simple error report |
| 178 | /// here. | 178 | /// here. |
| 179 | pub fn make(s: *Step, prog_node: *std.Progress.Node) error{ MakeFailed, MakeSkipped }!void { | 179 | pub fn make(s: *Step, prog_node: std.Progress.Node) error{ MakeFailed, MakeSkipped }!void { |
| 180 | const arena = s.owner.allocator; | 180 | const arena = s.owner.allocator; |
| 181 | 181 | ||
| 182 | s.makeFn(s, prog_node) catch |err| switch (err) { | 182 | s.makeFn(s, prog_node) catch |err| switch (err) { |
| ... | @@ -217,7 +217,7 @@ pub fn getStackTrace(s: *Step) ?std.builtin.StackTrace { | ... | @@ -217,7 +217,7 @@ pub fn getStackTrace(s: *Step) ?std.builtin.StackTrace { |
| 217 | }; | 217 | }; |
| 218 | } | 218 | } |
| 219 | 219 | ||
| 220 | fn makeNoOp(step: *Step, prog_node: *std.Progress.Node) anyerror!void { | 220 | fn makeNoOp(step: *Step, prog_node: std.Progress.Node) anyerror!void { |
| 221 | _ = prog_node; | 221 | _ = prog_node; |
| 222 | 222 | ||
| 223 | var all_cached = true; | 223 | var all_cached = true; |
| ... | @@ -303,7 +303,7 @@ pub fn addError(step: *Step, comptime fmt: []const u8, args: anytype) error{OutO | ... | @@ -303,7 +303,7 @@ pub fn addError(step: *Step, comptime fmt: []const u8, args: anytype) error{OutO |
| 303 | pub fn evalZigProcess( | 303 | pub fn evalZigProcess( |
| 304 | s: *Step, | 304 | s: *Step, |
| 305 | argv: []const []const u8, | 305 | argv: []const []const u8, |
| 306 | prog_node: *std.Progress.Node, | 306 | prog_node: std.Progress.Node, |
| 307 | ) !?[]const u8 { | 307 | ) !?[]const u8 { |
| 308 | assert(argv.len != 0); | 308 | assert(argv.len != 0); |
| 309 | const b = s.owner; | 309 | const b = s.owner; |
| ... | @@ -313,12 +313,16 @@ pub fn evalZigProcess( | ... | @@ -313,12 +313,16 @@ pub fn evalZigProcess( |
| 313 | try handleChildProcUnsupported(s, null, argv); | 313 | try handleChildProcUnsupported(s, null, argv); |
| 314 | try handleVerbose(s.owner, null, argv); | 314 | try handleVerbose(s.owner, null, argv); |
| 315 | 315 | ||
| 316 | const sub_prog_node = prog_node.start("", 0); | ||
| 317 | defer sub_prog_node.end(); | ||
| 318 | |||
| 316 | var child = std.process.Child.init(argv, arena); | 319 | var child = std.process.Child.init(argv, arena); |
| 317 | child.env_map = &b.graph.env_map; | 320 | child.env_map = &b.graph.env_map; |
| 318 | child.stdin_behavior = .Pipe; | 321 | child.stdin_behavior = .Pipe; |
| 319 | child.stdout_behavior = .Pipe; | 322 | child.stdout_behavior = .Pipe; |
| 320 | child.stderr_behavior = .Pipe; | 323 | child.stderr_behavior = .Pipe; |
| 321 | child.request_resource_usage_statistics = true; | 324 | child.request_resource_usage_statistics = true; |
| 325 | child.progress_node = sub_prog_node; | ||
| 322 | 326 | ||
| 323 | child.spawn() catch |err| return s.fail("unable to spawn {s}: {s}", .{ | 327 | child.spawn() catch |err| return s.fail("unable to spawn {s}: {s}", .{ |
| 324 | argv[0], @errorName(err), | 328 | argv[0], @errorName(err), |
| ... | @@ -337,11 +341,6 @@ pub fn evalZigProcess( | ... | @@ -337,11 +341,6 @@ pub fn evalZigProcess( |
| 337 | const Header = std.zig.Server.Message.Header; | 341 | const Header = std.zig.Server.Message.Header; |
| 338 | var result: ?[]const u8 = null; | 342 | var result: ?[]const u8 = null; |
| 339 | 343 | ||
| 340 | var node_name: std.ArrayListUnmanaged(u8) = .{}; | ||
| 341 | defer node_name.deinit(gpa); | ||
| 342 | var sub_prog_node = prog_node.start("", 0); | ||
| 343 | defer sub_prog_node.end(); | ||
| 344 | |||
| 345 | const stdout = poller.fifo(.stdout); | 344 | const stdout = poller.fifo(.stdout); |
| 346 | 345 | ||
| 347 | poll: while (true) { | 346 | poll: while (true) { |
| ... | @@ -379,11 +378,6 @@ pub fn evalZigProcess( | ... | @@ -379,11 +378,6 @@ pub fn evalZigProcess( |
| 379 | .extra = extra_array, | 378 | .extra = extra_array, |
| 380 | }; | 379 | }; |
| 381 | }, | 380 | }, |
| 382 | .progress => { | ||
| 383 | node_name.clearRetainingCapacity(); | ||
| 384 | try node_name.appendSlice(gpa, body); | ||
| 385 | sub_prog_node.setName(node_name.items); | ||
| 386 | }, | ||
| 387 | .emit_bin_path => { | 381 | .emit_bin_path => { |
| 388 | const EbpHdr = std.zig.Server.Message.EmitBinPath; | 382 | const EbpHdr = std.zig.Server.Message.EmitBinPath; |
| 389 | const ebp_hdr = @as(*align(1) const EbpHdr, @ptrCast(body)); | 383 | const ebp_hdr = @as(*align(1) const EbpHdr, @ptrCast(body)); |
lib/std/Build/Step/CheckFile.zig+1-1| ... | @@ -46,7 +46,7 @@ pub fn setName(check_file: *CheckFile, name: []const u8) void { | ... | @@ -46,7 +46,7 @@ pub fn setName(check_file: *CheckFile, name: []const u8) void { |
| 46 | check_file.step.name = name; | 46 | check_file.step.name = name; |
| 47 | } | 47 | } |
| 48 | 48 | ||
| 49 | fn make(step: *Step, prog_node: *std.Progress.Node) !void { | 49 | fn make(step: *Step, prog_node: std.Progress.Node) !void { |
| 50 | _ = prog_node; | 50 | _ = prog_node; |
| 51 | const b = step.owner; | 51 | const b = step.owner; |
| 52 | const check_file: *CheckFile = @fieldParentPtr("step", step); | 52 | const check_file: *CheckFile = @fieldParentPtr("step", step); |
lib/std/Build/Step/CheckObject.zig+1-1| ... | @@ -550,7 +550,7 @@ pub fn checkComputeCompare( | ... | @@ -550,7 +550,7 @@ pub fn checkComputeCompare( |
| 550 | check_object.checks.append(check) catch @panic("OOM"); | 550 | check_object.checks.append(check) catch @panic("OOM"); |
| 551 | } | 551 | } |
| 552 | 552 | ||
| 553 | fn make(step: *Step, prog_node: *std.Progress.Node) !void { | 553 | fn make(step: *Step, prog_node: std.Progress.Node) !void { |
| 554 | _ = prog_node; | 554 | _ = prog_node; |
| 555 | const b = step.owner; | 555 | const b = step.owner; |
| 556 | const gpa = b.allocator; | 556 | const gpa = b.allocator; |
lib/std/Build/Step/Compile.zig+3-3| ... | @@ -967,7 +967,7 @@ fn getGeneratedFilePath(compile: *Compile, comptime tag_name: []const u8, asking | ... | @@ -967,7 +967,7 @@ fn getGeneratedFilePath(compile: *Compile, comptime tag_name: []const u8, asking |
| 967 | const maybe_path: ?*GeneratedFile = @field(compile, tag_name); | 967 | const maybe_path: ?*GeneratedFile = @field(compile, tag_name); |
| 968 | 968 | ||
| 969 | const generated_file = maybe_path orelse { | 969 | const generated_file = maybe_path orelse { |
| 970 | std.debug.getStderrMutex().lock(); | 970 | std.debug.lockStdErr(); |
| 971 | const stderr = std.io.getStdErr(); | 971 | const stderr = std.io.getStdErr(); |
| 972 | 972 | ||
| 973 | std.Build.dumpBadGetPathHelp(&compile.step, stderr, compile.step.owner, asking_step) catch {}; | 973 | std.Build.dumpBadGetPathHelp(&compile.step, stderr, compile.step.owner, asking_step) catch {}; |
| ... | @@ -976,7 +976,7 @@ fn getGeneratedFilePath(compile: *Compile, comptime tag_name: []const u8, asking | ... | @@ -976,7 +976,7 @@ fn getGeneratedFilePath(compile: *Compile, comptime tag_name: []const u8, asking |
| 976 | }; | 976 | }; |
| 977 | 977 | ||
| 978 | const path = generated_file.path orelse { | 978 | const path = generated_file.path orelse { |
| 979 | std.debug.getStderrMutex().lock(); | 979 | std.debug.lockStdErr(); |
| 980 | const stderr = std.io.getStdErr(); | 980 | const stderr = std.io.getStdErr(); |
| 981 | 981 | ||
| 982 | std.Build.dumpBadGetPathHelp(&compile.step, stderr, compile.step.owner, asking_step) catch {}; | 982 | std.Build.dumpBadGetPathHelp(&compile.step, stderr, compile.step.owner, asking_step) catch {}; |
| ... | @@ -987,7 +987,7 @@ fn getGeneratedFilePath(compile: *Compile, comptime tag_name: []const u8, asking | ... | @@ -987,7 +987,7 @@ fn getGeneratedFilePath(compile: *Compile, comptime tag_name: []const u8, asking |
| 987 | return path; | 987 | return path; |
| 988 | } | 988 | } |
| 989 | 989 | ||
| 990 | fn make(step: *Step, prog_node: *std.Progress.Node) !void { | 990 | fn make(step: *Step, prog_node: std.Progress.Node) !void { |
| 991 | const b = step.owner; | 991 | const b = step.owner; |
| 992 | const arena = b.allocator; | 992 | const arena = b.allocator; |
| 993 | const compile: *Compile = @fieldParentPtr("step", step); | 993 | const compile: *Compile = @fieldParentPtr("step", step); |
lib/std/Build/Step/ConfigHeader.zig+1-1| ... | @@ -164,7 +164,7 @@ fn putValue(config_header: *ConfigHeader, field_name: []const u8, comptime T: ty | ... | @@ -164,7 +164,7 @@ fn putValue(config_header: *ConfigHeader, field_name: []const u8, comptime T: ty |
| 164 | } | 164 | } |
| 165 | } | 165 | } |
| 166 | 166 | ||
| 167 | fn make(step: *Step, prog_node: *std.Progress.Node) !void { | 167 | fn make(step: *Step, prog_node: std.Progress.Node) !void { |
| 168 | _ = prog_node; | 168 | _ = prog_node; |
| 169 | const b = step.owner; | 169 | const b = step.owner; |
| 170 | const config_header: *ConfigHeader = @fieldParentPtr("step", step); | 170 | const config_header: *ConfigHeader = @fieldParentPtr("step", step); |
lib/std/Build/Step/Fmt.zig+1-1| ... | @@ -36,7 +36,7 @@ pub fn create(owner: *std.Build, options: Options) *Fmt { | ... | @@ -36,7 +36,7 @@ pub fn create(owner: *std.Build, options: Options) *Fmt { |
| 36 | return fmt; | 36 | return fmt; |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | fn make(step: *Step, prog_node: *std.Progress.Node) !void { | 39 | fn make(step: *Step, prog_node: std.Progress.Node) !void { |
| 40 | // zig fmt is fast enough that no progress is needed. | 40 | // zig fmt is fast enough that no progress is needed. |
| 41 | _ = prog_node; | 41 | _ = prog_node; |
| 42 | 42 |
lib/std/Build/Step/InstallArtifact.zig+1-1| ... | @@ -115,7 +115,7 @@ pub fn create(owner: *std.Build, artifact: *Step.Compile, options: Options) *Ins | ... | @@ -115,7 +115,7 @@ pub fn create(owner: *std.Build, artifact: *Step.Compile, options: Options) *Ins |
| 115 | return install_artifact; | 115 | return install_artifact; |
| 116 | } | 116 | } |
| 117 | 117 | ||
| 118 | fn make(step: *Step, prog_node: *std.Progress.Node) !void { | 118 | fn make(step: *Step, prog_node: std.Progress.Node) !void { |
| 119 | _ = prog_node; | 119 | _ = prog_node; |
| 120 | const install_artifact: *InstallArtifact = @fieldParentPtr("step", step); | 120 | const install_artifact: *InstallArtifact = @fieldParentPtr("step", step); |
| 121 | const b = step.owner; | 121 | const b = step.owner; |
lib/std/Build/Step/InstallDir.zig+1-1| ... | @@ -56,7 +56,7 @@ pub fn create(owner: *std.Build, options: Options) *InstallDir { | ... | @@ -56,7 +56,7 @@ pub fn create(owner: *std.Build, options: Options) *InstallDir { |
| 56 | return install_dir; | 56 | return install_dir; |
| 57 | } | 57 | } |
| 58 | 58 | ||
| 59 | fn make(step: *Step, prog_node: *std.Progress.Node) !void { | 59 | fn make(step: *Step, prog_node: std.Progress.Node) !void { |
| 60 | _ = prog_node; | 60 | _ = prog_node; |
| 61 | const b = step.owner; | 61 | const b = step.owner; |
| 62 | const install_dir: *InstallDir = @fieldParentPtr("step", step); | 62 | const install_dir: *InstallDir = @fieldParentPtr("step", step); |
lib/std/Build/Step/InstallFile.zig+1-1| ... | @@ -36,7 +36,7 @@ pub fn create( | ... | @@ -36,7 +36,7 @@ pub fn create( |
| 36 | return install_file; | 36 | return install_file; |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | fn make(step: *Step, prog_node: *std.Progress.Node) !void { | 39 | fn make(step: *Step, prog_node: std.Progress.Node) !void { |
| 40 | _ = prog_node; | 40 | _ = prog_node; |
| 41 | const b = step.owner; | 41 | const b = step.owner; |
| 42 | const install_file: *InstallFile = @fieldParentPtr("step", step); | 42 | const install_file: *InstallFile = @fieldParentPtr("step", step); |
lib/std/Build/Step/ObjCopy.zig+1-1| ... | @@ -90,7 +90,7 @@ pub fn getOutputSeparatedDebug(objcopy: *const ObjCopy) ?std.Build.LazyPath { | ... | @@ -90,7 +90,7 @@ pub fn getOutputSeparatedDebug(objcopy: *const ObjCopy) ?std.Build.LazyPath { |
| 90 | return if (objcopy.output_file_debug) |*file| .{ .generated = .{ .file = file } } else null; | 90 | return if (objcopy.output_file_debug) |*file| .{ .generated = .{ .file = file } } else null; |
| 91 | } | 91 | } |
| 92 | 92 | ||
| 93 | fn make(step: *Step, prog_node: *std.Progress.Node) !void { | 93 | fn make(step: *Step, prog_node: std.Progress.Node) !void { |
| 94 | const b = step.owner; | 94 | const b = step.owner; |
| 95 | const objcopy: *ObjCopy = @fieldParentPtr("step", step); | 95 | const objcopy: *ObjCopy = @fieldParentPtr("step", step); |
| 96 | 96 |
lib/std/Build/Step/Options.zig+1-1| ... | @@ -410,7 +410,7 @@ pub fn getOutput(options: *Options) LazyPath { | ... | @@ -410,7 +410,7 @@ pub fn getOutput(options: *Options) LazyPath { |
| 410 | return .{ .generated = .{ .file = &options.generated_file } }; | 410 | return .{ .generated = .{ .file = &options.generated_file } }; |
| 411 | } | 411 | } |
| 412 | 412 | ||
| 413 | fn make(step: *Step, prog_node: *std.Progress.Node) !void { | 413 | fn make(step: *Step, prog_node: std.Progress.Node) !void { |
| 414 | // This step completes so quickly that no progress is necessary. | 414 | // This step completes so quickly that no progress is necessary. |
| 415 | _ = prog_node; | 415 | _ = prog_node; |
| 416 | 416 |
lib/std/Build/Step/RemoveDir.zig+1-1| ... | @@ -22,7 +22,7 @@ pub fn create(owner: *std.Build, dir_path: []const u8) *RemoveDir { | ... | @@ -22,7 +22,7 @@ pub fn create(owner: *std.Build, dir_path: []const u8) *RemoveDir { |
| 22 | return remove_dir; | 22 | return remove_dir; |
| 23 | } | 23 | } |
| 24 | 24 | ||
| 25 | fn make(step: *Step, prog_node: *std.Progress.Node) !void { | 25 | fn make(step: *Step, prog_node: std.Progress.Node) !void { |
| 26 | // TODO update progress node while walking file system. | 26 | // TODO update progress node while walking file system. |
| 27 | // Should the standard library support this use case?? | 27 | // Should the standard library support this use case?? |
| 28 | _ = prog_node; | 28 | _ = prog_node; |
lib/std/Build/Step/Run.zig+11-7| ... | @@ -574,7 +574,7 @@ const IndexedOutput = struct { | ... | @@ -574,7 +574,7 @@ const IndexedOutput = struct { |
| 574 | tag: @typeInfo(Arg).Union.tag_type.?, | 574 | tag: @typeInfo(Arg).Union.tag_type.?, |
| 575 | output: *Output, | 575 | output: *Output, |
| 576 | }; | 576 | }; |
| 577 | fn make(step: *Step, prog_node: *std.Progress.Node) !void { | 577 | fn make(step: *Step, prog_node: std.Progress.Node) !void { |
| 578 | const b = step.owner; | 578 | const b = step.owner; |
| 579 | const arena = b.allocator; | 579 | const arena = b.allocator; |
| 580 | const run: *Run = @fieldParentPtr("step", step); | 580 | const run: *Run = @fieldParentPtr("step", step); |
| ... | @@ -878,7 +878,7 @@ fn runCommand( | ... | @@ -878,7 +878,7 @@ fn runCommand( |
| 878 | argv: []const []const u8, | 878 | argv: []const []const u8, |
| 879 | has_side_effects: bool, | 879 | has_side_effects: bool, |
| 880 | output_dir_path: []const u8, | 880 | output_dir_path: []const u8, |
| 881 | prog_node: *std.Progress.Node, | 881 | prog_node: std.Progress.Node, |
| 882 | ) !void { | 882 | ) !void { |
| 883 | const step = &run.step; | 883 | const step = &run.step; |
| 884 | const b = step.owner; | 884 | const b = step.owner; |
| ... | @@ -1195,7 +1195,7 @@ fn spawnChildAndCollect( | ... | @@ -1195,7 +1195,7 @@ fn spawnChildAndCollect( |
| 1195 | run: *Run, | 1195 | run: *Run, |
| 1196 | argv: []const []const u8, | 1196 | argv: []const []const u8, |
| 1197 | has_side_effects: bool, | 1197 | has_side_effects: bool, |
| 1198 | prog_node: *std.Progress.Node, | 1198 | prog_node: std.Progress.Node, |
| 1199 | ) !ChildProcResult { | 1199 | ) !ChildProcResult { |
| 1200 | const b = run.step.owner; | 1200 | const b = run.step.owner; |
| 1201 | const arena = b.allocator; | 1201 | const arena = b.allocator; |
| ... | @@ -1235,6 +1235,10 @@ fn spawnChildAndCollect( | ... | @@ -1235,6 +1235,10 @@ fn spawnChildAndCollect( |
| 1235 | child.stdin_behavior = .Pipe; | 1235 | child.stdin_behavior = .Pipe; |
| 1236 | } | 1236 | } |
| 1237 | 1237 | ||
| 1238 | if (run.stdio != .zig_test) { | ||
| 1239 | child.progress_node = prog_node.start("", 0); | ||
| 1240 | } | ||
| 1241 | |||
| 1238 | try child.spawn(); | 1242 | try child.spawn(); |
| 1239 | var timer = try std.time.Timer.start(); | 1243 | var timer = try std.time.Timer.start(); |
| 1240 | 1244 | ||
| ... | @@ -1264,7 +1268,7 @@ const StdIoResult = struct { | ... | @@ -1264,7 +1268,7 @@ const StdIoResult = struct { |
| 1264 | fn evalZigTest( | 1268 | fn evalZigTest( |
| 1265 | run: *Run, | 1269 | run: *Run, |
| 1266 | child: *std.process.Child, | 1270 | child: *std.process.Child, |
| 1267 | prog_node: *std.Progress.Node, | 1271 | prog_node: std.Progress.Node, |
| 1268 | ) !StdIoResult { | 1272 | ) !StdIoResult { |
| 1269 | const gpa = run.step.owner.allocator; | 1273 | const gpa = run.step.owner.allocator; |
| 1270 | const arena = run.step.owner.allocator; | 1274 | const arena = run.step.owner.allocator; |
| ... | @@ -1291,7 +1295,7 @@ fn evalZigTest( | ... | @@ -1291,7 +1295,7 @@ fn evalZigTest( |
| 1291 | var metadata: ?TestMetadata = null; | 1295 | var metadata: ?TestMetadata = null; |
| 1292 | 1296 | ||
| 1293 | var sub_prog_node: ?std.Progress.Node = null; | 1297 | var sub_prog_node: ?std.Progress.Node = null; |
| 1294 | defer if (sub_prog_node) |*n| n.end(); | 1298 | defer if (sub_prog_node) |n| n.end(); |
| 1295 | 1299 | ||
| 1296 | poll: while (true) { | 1300 | poll: while (true) { |
| 1297 | while (stdout.readableLength() < @sizeOf(Header)) { | 1301 | while (stdout.readableLength() < @sizeOf(Header)) { |
| ... | @@ -1406,7 +1410,7 @@ const TestMetadata = struct { | ... | @@ -1406,7 +1410,7 @@ const TestMetadata = struct { |
| 1406 | expected_panic_msgs: []const u32, | 1410 | expected_panic_msgs: []const u32, |
| 1407 | string_bytes: []const u8, | 1411 | string_bytes: []const u8, |
| 1408 | next_index: u32, | 1412 | next_index: u32, |
| 1409 | prog_node: *std.Progress.Node, | 1413 | prog_node: std.Progress.Node, |
| 1410 | 1414 | ||
| 1411 | fn testName(tm: TestMetadata, index: u32) []const u8 { | 1415 | fn testName(tm: TestMetadata, index: u32) []const u8 { |
| 1412 | return std.mem.sliceTo(tm.string_bytes[tm.names[index]..], 0); | 1416 | return std.mem.sliceTo(tm.string_bytes[tm.names[index]..], 0); |
| ... | @@ -1421,7 +1425,7 @@ fn requestNextTest(in: fs.File, metadata: *TestMetadata, sub_prog_node: *?std.Pr | ... | @@ -1421,7 +1425,7 @@ fn requestNextTest(in: fs.File, metadata: *TestMetadata, sub_prog_node: *?std.Pr |
| 1421 | if (metadata.expected_panic_msgs[i] != 0) continue; | 1425 | if (metadata.expected_panic_msgs[i] != 0) continue; |
| 1422 | 1426 | ||
| 1423 | const name = metadata.testName(i); | 1427 | const name = metadata.testName(i); |
| 1424 | if (sub_prog_node.*) |*n| n.end(); | 1428 | if (sub_prog_node.*) |n| n.end(); |
| 1425 | sub_prog_node.* = metadata.prog_node.start(name, 0); | 1429 | sub_prog_node.* = metadata.prog_node.start(name, 0); |
| 1426 | 1430 | ||
| 1427 | try sendRunTestMessage(in, i); | 1431 | try sendRunTestMessage(in, i); |
lib/std/Build/Step/TranslateC.zig+1-1| ... | @@ -116,7 +116,7 @@ pub fn defineCMacroRaw(translate_c: *TranslateC, name_and_value: []const u8) voi | ... | @@ -116,7 +116,7 @@ pub fn defineCMacroRaw(translate_c: *TranslateC, name_and_value: []const u8) voi |
| 116 | translate_c.c_macros.append(translate_c.step.owner.dupe(name_and_value)) catch @panic("OOM"); | 116 | translate_c.c_macros.append(translate_c.step.owner.dupe(name_and_value)) catch @panic("OOM"); |
| 117 | } | 117 | } |
| 118 | 118 | ||
| 119 | fn make(step: *Step, prog_node: *std.Progress.Node) !void { | 119 | fn make(step: *Step, prog_node: std.Progress.Node) !void { |
| 120 | const b = step.owner; | 120 | const b = step.owner; |
| 121 | const translate_c: *TranslateC = @fieldParentPtr("step", step); | 121 | const translate_c: *TranslateC = @fieldParentPtr("step", step); |
| 122 | 122 |
lib/std/Build/Step/WriteFile.zig+1-1| ... | @@ -198,7 +198,7 @@ fn maybeUpdateName(write_file: *WriteFile) void { | ... | @@ -198,7 +198,7 @@ fn maybeUpdateName(write_file: *WriteFile) void { |
| 198 | } | 198 | } |
| 199 | } | 199 | } |
| 200 | 200 | ||
| 201 | fn make(step: *Step, prog_node: *std.Progress.Node) !void { | 201 | fn make(step: *Step, prog_node: std.Progress.Node) !void { |
| 202 | _ = prog_node; | 202 | _ = prog_node; |
| 203 | const b = step.owner; | 203 | const b = step.owner; |
| 204 | const write_file: *WriteFile = @fieldParentPtr("step", step); | 204 | const write_file: *WriteFile = @fieldParentPtr("step", step); |
lib/std/Progress.zig+39-4| ... | @@ -58,7 +58,7 @@ pub const Options = struct { | ... | @@ -58,7 +58,7 @@ pub const Options = struct { |
| 58 | /// cannot fit into this buffer which will look bad but not cause any malfunctions. | 58 | /// cannot fit into this buffer which will look bad but not cause any malfunctions. |
| 59 | /// | 59 | /// |
| 60 | /// Must be at least 200 bytes. | 60 | /// Must be at least 200 bytes. |
| 61 | draw_buffer: []u8, | 61 | draw_buffer: []u8 = &default_draw_buffer, |
| 62 | /// How many nanoseconds between writing updates to the terminal. | 62 | /// How many nanoseconds between writing updates to the terminal. |
| 63 | refresh_rate_ns: u64 = 60 * std.time.ns_per_ms, | 63 | refresh_rate_ns: u64 = 60 * std.time.ns_per_ms, |
| 64 | /// How many nanoseconds to keep the output hidden | 64 | /// How many nanoseconds to keep the output hidden |
| ... | @@ -67,6 +67,7 @@ pub const Options = struct { | ... | @@ -67,6 +67,7 @@ pub const Options = struct { |
| 67 | /// 0 means unknown. | 67 | /// 0 means unknown. |
| 68 | estimated_total_items: usize = 0, | 68 | estimated_total_items: usize = 0, |
| 69 | root_name: []const u8 = "", | 69 | root_name: []const u8 = "", |
| 70 | disable_printing: bool = false, | ||
| 70 | }; | 71 | }; |
| 71 | 72 | ||
| 72 | /// Represents one unit of progress. Each node can have children nodes, or | 73 | /// Represents one unit of progress. Each node can have children nodes, or |
| ... | @@ -203,6 +204,13 @@ pub const Node = struct { | ... | @@ -203,6 +204,13 @@ pub const Node = struct { |
| 203 | @atomicStore(u32, &storage.estimated_total_count, std.math.lossyCast(u32, count), .monotonic); | 204 | @atomicStore(u32, &storage.estimated_total_count, std.math.lossyCast(u32, count), .monotonic); |
| 204 | } | 205 | } |
| 205 | 206 | ||
| 207 | /// Thread-safe. | ||
| 208 | pub fn increaseEstimatedTotalItems(n: Node, count: usize) void { | ||
| 209 | const index = n.index.unwrap() orelse return; | ||
| 210 | const storage = storageByIndex(index); | ||
| 211 | _ = @atomicRmw(u32, &storage.estimated_total_count, .Add, std.math.lossyCast(u32, count), .monotonic); | ||
| 212 | } | ||
| 213 | |||
| 206 | /// Finish a started `Node`. Thread-safe. | 214 | /// Finish a started `Node`. Thread-safe. |
| 207 | pub fn end(n: Node) void { | 215 | pub fn end(n: Node) void { |
| 208 | const index = n.index.unwrap() orelse return; | 216 | const index = n.index.unwrap() orelse return; |
| ... | @@ -290,6 +298,8 @@ var node_parents_buffer: [default_node_storage_buffer_len]Node.Parent = undefine | ... | @@ -290,6 +298,8 @@ var node_parents_buffer: [default_node_storage_buffer_len]Node.Parent = undefine |
| 290 | var node_storage_buffer: [default_node_storage_buffer_len]Node.Storage = undefined; | 298 | var node_storage_buffer: [default_node_storage_buffer_len]Node.Storage = undefined; |
| 291 | var node_freelist_buffer: [default_node_storage_buffer_len]Node.OptionalIndex = undefined; | 299 | var node_freelist_buffer: [default_node_storage_buffer_len]Node.OptionalIndex = undefined; |
| 292 | 300 | ||
| 301 | var default_draw_buffer: [2000]u8 = undefined; | ||
| 302 | |||
| 293 | /// Initializes a global Progress instance. | 303 | /// Initializes a global Progress instance. |
| 294 | /// | 304 | /// |
| 295 | /// Asserts there is only one global Progress instance. | 305 | /// Asserts there is only one global Progress instance. |
| ... | @@ -318,6 +328,9 @@ pub fn start(options: Options) Node { | ... | @@ -318,6 +328,9 @@ pub fn start(options: Options) Node { |
| 318 | } | 328 | } |
| 319 | } else |env_err| switch (env_err) { | 329 | } else |env_err| switch (env_err) { |
| 320 | error.EnvironmentVariableNotFound => { | 330 | error.EnvironmentVariableNotFound => { |
| 331 | if (options.disable_printing) { | ||
| 332 | return .{ .index = .none }; | ||
| 333 | } | ||
| 321 | const stderr = std.io.getStdErr(); | 334 | const stderr = std.io.getStdErr(); |
| 322 | if (stderr.supportsAnsiEscapeCodes()) { | 335 | if (stderr.supportsAnsiEscapeCodes()) { |
| 323 | global_progress.terminal = stderr; | 336 | global_progress.terminal = stderr; |
| ... | @@ -330,7 +343,7 @@ pub fn start(options: Options) Node { | ... | @@ -330,7 +343,7 @@ pub fn start(options: Options) Node { |
| 330 | global_progress.terminal = stderr; | 343 | global_progress.terminal = stderr; |
| 331 | } | 344 | } |
| 332 | 345 | ||
| 333 | if (global_progress.terminal == null) { | 346 | if (global_progress.terminal == null or !global_progress.supports_ansi_escape_codes) { |
| 334 | return .{ .index = .none }; | 347 | return .{ .index = .none }; |
| 335 | } | 348 | } |
| 336 | 349 | ||
| ... | @@ -379,7 +392,10 @@ fn updateThreadRun() void { | ... | @@ -379,7 +392,10 @@ fn updateThreadRun() void { |
| 379 | return clearTerminal(); | 392 | return clearTerminal(); |
| 380 | 393 | ||
| 381 | const buffer = computeRedraw(); | 394 | const buffer = computeRedraw(); |
| 382 | write(buffer); | 395 | if (stderr_mutex.tryLock()) { |
| 396 | defer stderr_mutex.unlock(); | ||
| 397 | write(buffer); | ||
| 398 | } | ||
| 383 | } | 399 | } |
| 384 | 400 | ||
| 385 | while (true) { | 401 | while (true) { |
| ... | @@ -390,10 +406,25 @@ fn updateThreadRun() void { | ... | @@ -390,10 +406,25 @@ fn updateThreadRun() void { |
| 390 | return clearTerminal(); | 406 | return clearTerminal(); |
| 391 | 407 | ||
| 392 | const buffer = computeRedraw(); | 408 | const buffer = computeRedraw(); |
| 393 | write(buffer); | 409 | if (stderr_mutex.tryLock()) { |
| 410 | defer stderr_mutex.unlock(); | ||
| 411 | write(buffer); | ||
| 412 | } | ||
| 394 | } | 413 | } |
| 395 | } | 414 | } |
| 396 | 415 | ||
| 416 | /// Allows the caller to freely write to stderr until `unlockStdErr` is called. | ||
| 417 | /// | ||
| 418 | /// During the lock, any `std.Progress` information is cleared from the terminal. | ||
| 419 | pub fn lockStdErr() void { | ||
| 420 | stderr_mutex.lock(); | ||
| 421 | clearTerminal(); | ||
| 422 | } | ||
| 423 | |||
| 424 | pub fn unlockStdErr() void { | ||
| 425 | stderr_mutex.unlock(); | ||
| 426 | } | ||
| 427 | |||
| 397 | fn ipcThreadRun(fd: posix.fd_t) anyerror!void { | 428 | fn ipcThreadRun(fd: posix.fd_t) anyerror!void { |
| 398 | { | 429 | { |
| 399 | _ = wait(global_progress.initial_delay_ns); | 430 | _ = wait(global_progress.initial_delay_ns); |
| ... | @@ -432,6 +463,8 @@ const tree_line = "\x1B\x28\x30\x78\x1B\x28\x42 "; // │ | ... | @@ -432,6 +463,8 @@ const tree_line = "\x1B\x28\x30\x78\x1B\x28\x42 "; // │ |
| 432 | const tree_langle = "\x1B\x28\x30\x6d\x71\x1B\x28\x42 "; // └─ | 463 | const tree_langle = "\x1B\x28\x30\x6d\x71\x1B\x28\x42 "; // └─ |
| 433 | 464 | ||
| 434 | fn clearTerminal() void { | 465 | fn clearTerminal() void { |
| 466 | if (global_progress.newline_count == 0) return; | ||
| 467 | |||
| 435 | var i: usize = 0; | 468 | var i: usize = 0; |
| 436 | const buf = global_progress.draw_buffer; | 469 | const buf = global_progress.draw_buffer; |
| 437 | 470 | ||
| ... | @@ -876,3 +909,5 @@ fn handleSigWinch(sig: i32, info: *const posix.siginfo_t, ctx_ptr: ?*anyopaque) | ... | @@ -876,3 +909,5 @@ fn handleSigWinch(sig: i32, info: *const posix.siginfo_t, ctx_ptr: ?*anyopaque) |
| 876 | assert(sig == posix.SIG.WINCH); | 909 | assert(sig == posix.SIG.WINCH); |
| 877 | global_progress.redraw_event.set(); | 910 | global_progress.redraw_event.set(); |
| 878 | } | 911 | } |
| 912 | |||
| 913 | var stderr_mutex: std.Thread.Mutex = .{}; |
lib/std/debug.zig+15-6| ... | @@ -77,19 +77,28 @@ const PdbOrDwarf = union(enum) { | ... | @@ -77,19 +77,28 @@ const PdbOrDwarf = union(enum) { |
| 77 | } | 77 | } |
| 78 | }; | 78 | }; |
| 79 | 79 | ||
| 80 | var stderr_mutex = std.Thread.Mutex{}; | 80 | /// Allows the caller to freely write to stderr until `unlockStdErr` is called. |
| 81 | /// | ||
| 82 | /// During the lock, any `std.Progress` information is cleared from the terminal. | ||
| 83 | pub fn lockStdErr() void { | ||
| 84 | std.Progress.lockStdErr(); | ||
| 85 | } | ||
| 86 | |||
| 87 | pub fn unlockStdErr() void { | ||
| 88 | std.Progress.unlockStdErr(); | ||
| 89 | } | ||
| 81 | 90 | ||
| 82 | /// Print to stderr, unbuffered, and silently returning on failure. Intended | 91 | /// Print to stderr, unbuffered, and silently returning on failure. Intended |
| 83 | /// for use in "printf debugging." Use `std.log` functions for proper logging. | 92 | /// for use in "printf debugging." Use `std.log` functions for proper logging. |
| 84 | pub fn print(comptime fmt: []const u8, args: anytype) void { | 93 | pub fn print(comptime fmt: []const u8, args: anytype) void { |
| 85 | stderr_mutex.lock(); | 94 | lockStdErr(); |
| 86 | defer stderr_mutex.unlock(); | 95 | defer unlockStdErr(); |
| 87 | const stderr = io.getStdErr().writer(); | 96 | const stderr = io.getStdErr().writer(); |
| 88 | nosuspend stderr.print(fmt, args) catch return; | 97 | nosuspend stderr.print(fmt, args) catch return; |
| 89 | } | 98 | } |
| 90 | 99 | ||
| 91 | pub fn getStderrMutex() *std.Thread.Mutex { | 100 | pub fn getStderrMutex() *std.Thread.Mutex { |
| 92 | return &stderr_mutex; | 101 | @compileError("deprecated. call std.debug.lockStdErr() and std.debug.unlockStdErr() instead which will integrate properly with std.Progress"); |
| 93 | } | 102 | } |
| 94 | 103 | ||
| 95 | /// TODO multithreaded awareness | 104 | /// TODO multithreaded awareness |
| ... | @@ -107,8 +116,8 @@ pub fn getSelfDebugInfo() !*DebugInfo { | ... | @@ -107,8 +116,8 @@ pub fn getSelfDebugInfo() !*DebugInfo { |
| 107 | /// Tries to print a hexadecimal view of the bytes, unbuffered, and ignores any error returned. | 116 | /// Tries to print a hexadecimal view of the bytes, unbuffered, and ignores any error returned. |
| 108 | /// Obtains the stderr mutex while dumping. | 117 | /// Obtains the stderr mutex while dumping. |
| 109 | pub fn dump_hex(bytes: []const u8) void { | 118 | pub fn dump_hex(bytes: []const u8) void { |
| 110 | stderr_mutex.lock(); | 119 | lockStdErr(); |
| 111 | defer stderr_mutex.unlock(); | 120 | defer unlockStdErr(); |
| 112 | dump_hex_fallible(bytes) catch {}; | 121 | dump_hex_fallible(bytes) catch {}; |
| 113 | } | 122 | } |
| 114 | 123 |
lib/std/json/dynamic.zig+2-2| ... | @@ -52,8 +52,8 @@ pub const Value = union(enum) { | ... | @@ -52,8 +52,8 @@ pub const Value = union(enum) { |
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | pub fn dump(self: Value) void { | 54 | pub fn dump(self: Value) void { |
| 55 | std.debug.getStderrMutex().lock(); | 55 | std.debug.lockStdErr(); |
| 56 | defer std.debug.getStderrMutex().unlock(); | 56 | defer std.debug.unlockStdErr(); |
| 57 | 57 | ||
| 58 | const stderr = std.io.getStdErr().writer(); | 58 | const stderr = std.io.getStdErr().writer(); |
| 59 | stringify(self, .{}, stderr) catch return; | 59 | stringify(self, .{}, stderr) catch return; |
lib/std/log.zig+4-4| ... | @@ -45,8 +45,8 @@ | ... | @@ -45,8 +45,8 @@ |
| 45 | //! const prefix = "[" ++ comptime level.asText() ++ "] " ++ scope_prefix; | 45 | //! const prefix = "[" ++ comptime level.asText() ++ "] " ++ scope_prefix; |
| 46 | //! | 46 | //! |
| 47 | //! // Print the message to stderr, silently ignoring any errors | 47 | //! // Print the message to stderr, silently ignoring any errors |
| 48 | //! std.debug.getStderrMutex().lock(); | 48 | //! std.debug.lockStdErr(); |
| 49 | //! defer std.debug.getStderrMutex().unlock(); | 49 | //! defer std.debug.unlockStdErr(); |
| 50 | //! const stderr = std.io.getStdErr().writer(); | 50 | //! const stderr = std.io.getStdErr().writer(); |
| 51 | //! nosuspend stderr.print(prefix ++ format ++ "\n", args) catch return; | 51 | //! nosuspend stderr.print(prefix ++ format ++ "\n", args) catch return; |
| 52 | //! } | 52 | //! } |
| ... | @@ -152,8 +152,8 @@ pub fn defaultLog( | ... | @@ -152,8 +152,8 @@ pub fn defaultLog( |
| 152 | var bw = std.io.bufferedWriter(stderr); | 152 | var bw = std.io.bufferedWriter(stderr); |
| 153 | const writer = bw.writer(); | 153 | const writer = bw.writer(); |
| 154 | 154 | ||
| 155 | std.debug.getStderrMutex().lock(); | 155 | std.debug.lockStdErr(); |
| 156 | defer std.debug.getStderrMutex().unlock(); | 156 | defer std.debug.unlockStdErr(); |
| 157 | nosuspend { | 157 | nosuspend { |
| 158 | writer.print(level_txt ++ prefix2 ++ format ++ "\n", args) catch return; | 158 | writer.print(level_txt ++ prefix2 ++ format ++ "\n", args) catch return; |
| 159 | bw.flush() catch return; | 159 | bw.flush() catch return; |
lib/std/zig/ErrorBundle.zig+2-2| ... | @@ -155,8 +155,8 @@ pub const RenderOptions = struct { | ... | @@ -155,8 +155,8 @@ pub const RenderOptions = struct { |
| 155 | }; | 155 | }; |
| 156 | 156 | ||
| 157 | pub fn renderToStdErr(eb: ErrorBundle, options: RenderOptions) void { | 157 | pub fn renderToStdErr(eb: ErrorBundle, options: RenderOptions) void { |
| 158 | std.debug.getStderrMutex().lock(); | 158 | std.debug.lockStdErr(); |
| 159 | defer std.debug.getStderrMutex().unlock(); | 159 | defer std.debug.unlockStdErr(); |
| 160 | const stderr = std.io.getStdErr(); | 160 | const stderr = std.io.getStdErr(); |
| 161 | return renderToWriter(eb, options, stderr.writer()) catch return; | 161 | return renderToWriter(eb, options, stderr.writer()) catch return; |
| 162 | } | 162 | } |
lib/std/zig/Server.zig-2| ... | @@ -14,8 +14,6 @@ pub const Message = struct { | ... | @@ -14,8 +14,6 @@ pub const Message = struct { |
| 14 | zig_version, | 14 | zig_version, |
| 15 | /// Body is an ErrorBundle. | 15 | /// Body is an ErrorBundle. |
| 16 | error_bundle, | 16 | error_bundle, |
| 17 | /// Body is a UTF-8 string. | ||
| 18 | progress, | ||
| 19 | /// Body is a EmitBinPath. | 17 | /// Body is a EmitBinPath. |
| 20 | emit_bin_path, | 18 | emit_bin_path, |
| 21 | /// Body is a TestMetadata | 19 | /// Body is a TestMetadata |
src/Compilation.zig+38-63| ... | @@ -1273,8 +1273,8 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil | ... | @@ -1273,8 +1273,8 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil |
| 1273 | if (options.verbose_llvm_cpu_features) { | 1273 | if (options.verbose_llvm_cpu_features) { |
| 1274 | if (options.root_mod.resolved_target.llvm_cpu_features) |cf| print: { | 1274 | if (options.root_mod.resolved_target.llvm_cpu_features) |cf| print: { |
| 1275 | const target = options.root_mod.resolved_target.result; | 1275 | const target = options.root_mod.resolved_target.result; |
| 1276 | std.debug.getStderrMutex().lock(); | 1276 | std.debug.lockStdErr(); |
| 1277 | defer std.debug.getStderrMutex().unlock(); | 1277 | defer std.debug.unlockStdErr(); |
| 1278 | const stderr = std.io.getStdErr().writer(); | 1278 | const stderr = std.io.getStdErr().writer(); |
| 1279 | nosuspend { | 1279 | nosuspend { |
| 1280 | stderr.print("compilation: {s}\n", .{options.root_name}) catch break :print; | 1280 | stderr.print("compilation: {s}\n", .{options.root_name}) catch break :print; |
| ... | @@ -1934,7 +1934,7 @@ pub fn getTarget(self: Compilation) Target { | ... | @@ -1934,7 +1934,7 @@ pub fn getTarget(self: Compilation) Target { |
| 1934 | /// Only legal to call when cache mode is incremental and a link file is present. | 1934 | /// Only legal to call when cache mode is incremental and a link file is present. |
| 1935 | pub fn hotCodeSwap( | 1935 | pub fn hotCodeSwap( |
| 1936 | comp: *Compilation, | 1936 | comp: *Compilation, |
| 1937 | prog_node: *std.Progress.Node, | 1937 | prog_node: std.Progress.Node, |
| 1938 | pid: std.process.Child.Id, | 1938 | pid: std.process.Child.Id, |
| 1939 | ) !void { | 1939 | ) !void { |
| 1940 | const lf = comp.bin_file.?; | 1940 | const lf = comp.bin_file.?; |
| ... | @@ -1966,7 +1966,7 @@ fn cleanupAfterUpdate(comp: *Compilation) void { | ... | @@ -1966,7 +1966,7 @@ fn cleanupAfterUpdate(comp: *Compilation) void { |
| 1966 | } | 1966 | } |
| 1967 | 1967 | ||
| 1968 | /// Detect changes to source files, perform semantic analysis, and update the output files. | 1968 | /// Detect changes to source files, perform semantic analysis, and update the output files. |
| 1969 | pub fn update(comp: *Compilation, main_progress_node: *std.Progress.Node) !void { | 1969 | pub fn update(comp: *Compilation, main_progress_node: std.Progress.Node) !void { |
| 1970 | const tracy_trace = trace(@src()); | 1970 | const tracy_trace = trace(@src()); |
| 1971 | defer tracy_trace.end(); | 1971 | defer tracy_trace.end(); |
| 1972 | 1972 | ||
| ... | @@ -2256,7 +2256,7 @@ pub fn update(comp: *Compilation, main_progress_node: *std.Progress.Node) !void | ... | @@ -2256,7 +2256,7 @@ pub fn update(comp: *Compilation, main_progress_node: *std.Progress.Node) !void |
| 2256 | } | 2256 | } |
| 2257 | } | 2257 | } |
| 2258 | 2258 | ||
| 2259 | fn flush(comp: *Compilation, arena: Allocator, prog_node: *std.Progress.Node) !void { | 2259 | fn flush(comp: *Compilation, arena: Allocator, prog_node: std.Progress.Node) !void { |
| 2260 | if (comp.bin_file) |lf| { | 2260 | if (comp.bin_file) |lf| { |
| 2261 | // This is needed before reading the error flags. | 2261 | // This is needed before reading the error flags. |
| 2262 | lf.flush(arena, prog_node) catch |err| switch (err) { | 2262 | lf.flush(arena, prog_node) catch |err| switch (err) { |
| ... | @@ -2566,13 +2566,11 @@ pub fn emitLlvmObject( | ... | @@ -2566,13 +2566,11 @@ pub fn emitLlvmObject( |
| 2566 | default_emit: Emit, | 2566 | default_emit: Emit, |
| 2567 | bin_emit_loc: ?EmitLoc, | 2567 | bin_emit_loc: ?EmitLoc, |
| 2568 | llvm_object: *LlvmObject, | 2568 | llvm_object: *LlvmObject, |
| 2569 | prog_node: *std.Progress.Node, | 2569 | prog_node: std.Progress.Node, |
| 2570 | ) !void { | 2570 | ) !void { |
| 2571 | if (build_options.only_c) @compileError("unreachable"); | 2571 | if (build_options.only_c) @compileError("unreachable"); |
| 2572 | 2572 | ||
| 2573 | var sub_prog_node = prog_node.start("LLVM Emit Object", 0); | 2573 | const sub_prog_node = prog_node.start("LLVM Emit Object", 0); |
| 2574 | sub_prog_node.activate(); | ||
| 2575 | sub_prog_node.context.refresh(); | ||
| 2576 | defer sub_prog_node.end(); | 2574 | defer sub_prog_node.end(); |
| 2577 | 2575 | ||
| 2578 | try llvm_object.emit(.{ | 2576 | try llvm_object.emit(.{ |
| ... | @@ -3249,23 +3247,23 @@ pub fn addZirErrorMessages(eb: *ErrorBundle.Wip, file: *Module.File) !void { | ... | @@ -3249,23 +3247,23 @@ pub fn addZirErrorMessages(eb: *ErrorBundle.Wip, file: *Module.File) !void { |
| 3249 | 3247 | ||
| 3250 | pub fn performAllTheWork( | 3248 | pub fn performAllTheWork( |
| 3251 | comp: *Compilation, | 3249 | comp: *Compilation, |
| 3252 | main_progress_node: *std.Progress.Node, | 3250 | main_progress_node: std.Progress.Node, |
| 3253 | ) error{ TimerUnsupported, OutOfMemory }!void { | 3251 | ) error{ TimerUnsupported, OutOfMemory }!void { |
| 3254 | // Here we queue up all the AstGen tasks first, followed by C object compilation. | 3252 | // Here we queue up all the AstGen tasks first, followed by C object compilation. |
| 3255 | // We wait until the AstGen tasks are all completed before proceeding to the | 3253 | // We wait until the AstGen tasks are all completed before proceeding to the |
| 3256 | // (at least for now) single-threaded main work queue. However, C object compilation | 3254 | // (at least for now) single-threaded main work queue. However, C object compilation |
| 3257 | // only needs to be finished by the end of this function. | 3255 | // only needs to be finished by the end of this function. |
| 3258 | 3256 | ||
| 3259 | var zir_prog_node = main_progress_node.start("AST Lowering", 0); | 3257 | const zir_prog_node = main_progress_node.start("AST Lowering", 0); |
| 3260 | defer zir_prog_node.end(); | 3258 | defer zir_prog_node.end(); |
| 3261 | 3259 | ||
| 3262 | var wasm_prog_node = main_progress_node.start("Compile Autodocs", 0); | 3260 | const wasm_prog_node = main_progress_node.start("Compile Autodocs", 0); |
| 3263 | defer wasm_prog_node.end(); | 3261 | defer wasm_prog_node.end(); |
| 3264 | 3262 | ||
| 3265 | var c_obj_prog_node = main_progress_node.start("Compile C Objects", comp.c_source_files.len); | 3263 | const c_obj_prog_node = main_progress_node.start("Compile C Objects", comp.c_source_files.len); |
| 3266 | defer c_obj_prog_node.end(); | 3264 | defer c_obj_prog_node.end(); |
| 3267 | 3265 | ||
| 3268 | var win32_resource_prog_node = main_progress_node.start("Compile Win32 Resources", comp.rc_source_files.len); | 3266 | const win32_resource_prog_node = main_progress_node.start("Compile Win32 Resources", comp.rc_source_files.len); |
| 3269 | defer win32_resource_prog_node.end(); | 3267 | defer win32_resource_prog_node.end(); |
| 3270 | 3268 | ||
| 3271 | comp.work_queue_wait_group.reset(); | 3269 | comp.work_queue_wait_group.reset(); |
| ... | @@ -3274,7 +3272,7 @@ pub fn performAllTheWork( | ... | @@ -3274,7 +3272,7 @@ pub fn performAllTheWork( |
| 3274 | if (!build_options.only_c and !build_options.only_core_functionality) { | 3272 | if (!build_options.only_c and !build_options.only_core_functionality) { |
| 3275 | if (comp.docs_emit != null) { | 3273 | if (comp.docs_emit != null) { |
| 3276 | comp.thread_pool.spawnWg(&comp.work_queue_wait_group, workerDocsCopy, .{comp}); | 3274 | comp.thread_pool.spawnWg(&comp.work_queue_wait_group, workerDocsCopy, .{comp}); |
| 3277 | comp.work_queue_wait_group.spawnManager(workerDocsWasm, .{ comp, &wasm_prog_node }); | 3275 | comp.work_queue_wait_group.spawnManager(workerDocsWasm, .{ comp, wasm_prog_node }); |
| 3278 | } | 3276 | } |
| 3279 | } | 3277 | } |
| 3280 | 3278 | ||
| ... | @@ -3313,7 +3311,7 @@ pub fn performAllTheWork( | ... | @@ -3313,7 +3311,7 @@ pub fn performAllTheWork( |
| 3313 | 3311 | ||
| 3314 | while (comp.astgen_work_queue.readItem()) |file| { | 3312 | while (comp.astgen_work_queue.readItem()) |file| { |
| 3315 | comp.thread_pool.spawnWg(&comp.astgen_wait_group, workerAstGenFile, .{ | 3313 | comp.thread_pool.spawnWg(&comp.astgen_wait_group, workerAstGenFile, .{ |
| 3316 | comp, file, &zir_prog_node, &comp.astgen_wait_group, .root, | 3314 | comp, file, zir_prog_node, &comp.astgen_wait_group, .root, |
| 3317 | }); | 3315 | }); |
| 3318 | } | 3316 | } |
| 3319 | 3317 | ||
| ... | @@ -3325,14 +3323,14 @@ pub fn performAllTheWork( | ... | @@ -3325,14 +3323,14 @@ pub fn performAllTheWork( |
| 3325 | 3323 | ||
| 3326 | while (comp.c_object_work_queue.readItem()) |c_object| { | 3324 | while (comp.c_object_work_queue.readItem()) |c_object| { |
| 3327 | comp.thread_pool.spawnWg(&comp.work_queue_wait_group, workerUpdateCObject, .{ | 3325 | comp.thread_pool.spawnWg(&comp.work_queue_wait_group, workerUpdateCObject, .{ |
| 3328 | comp, c_object, &c_obj_prog_node, | 3326 | comp, c_object, c_obj_prog_node, |
| 3329 | }); | 3327 | }); |
| 3330 | } | 3328 | } |
| 3331 | 3329 | ||
| 3332 | if (!build_options.only_core_functionality) { | 3330 | if (!build_options.only_core_functionality) { |
| 3333 | while (comp.win32_resource_work_queue.readItem()) |win32_resource| { | 3331 | while (comp.win32_resource_work_queue.readItem()) |win32_resource| { |
| 3334 | comp.thread_pool.spawnWg(&comp.work_queue_wait_group, workerUpdateWin32Resource, .{ | 3332 | comp.thread_pool.spawnWg(&comp.work_queue_wait_group, workerUpdateWin32Resource, .{ |
| 3335 | comp, win32_resource, &win32_resource_prog_node, | 3333 | comp, win32_resource, win32_resource_prog_node, |
| 3336 | }); | 3334 | }); |
| 3337 | } | 3335 | } |
| 3338 | } | 3336 | } |
| ... | @@ -3342,7 +3340,6 @@ pub fn performAllTheWork( | ... | @@ -3342,7 +3340,6 @@ pub fn performAllTheWork( |
| 3342 | try reportMultiModuleErrors(mod); | 3340 | try reportMultiModuleErrors(mod); |
| 3343 | try mod.flushRetryableFailures(); | 3341 | try mod.flushRetryableFailures(); |
| 3344 | mod.sema_prog_node = main_progress_node.start("Semantic Analysis", 0); | 3342 | mod.sema_prog_node = main_progress_node.start("Semantic Analysis", 0); |
| 3345 | mod.sema_prog_node.activate(); | ||
| 3346 | } | 3343 | } |
| 3347 | defer if (comp.module) |mod| { | 3344 | defer if (comp.module) |mod| { |
| 3348 | mod.sema_prog_node.end(); | 3345 | mod.sema_prog_node.end(); |
| ... | @@ -3379,7 +3376,7 @@ pub fn performAllTheWork( | ... | @@ -3379,7 +3376,7 @@ pub fn performAllTheWork( |
| 3379 | } | 3376 | } |
| 3380 | } | 3377 | } |
| 3381 | 3378 | ||
| 3382 | fn processOneJob(comp: *Compilation, job: Job, prog_node: *std.Progress.Node) !void { | 3379 | fn processOneJob(comp: *Compilation, job: Job, prog_node: std.Progress.Node) !void { |
| 3383 | switch (job) { | 3380 | switch (job) { |
| 3384 | .codegen_decl => |decl_index| { | 3381 | .codegen_decl => |decl_index| { |
| 3385 | const module = comp.module.?; | 3382 | const module = comp.module.?; |
| ... | @@ -3803,7 +3800,7 @@ fn docsCopyModule(comp: *Compilation, module: *Package.Module, name: []const u8, | ... | @@ -3803,7 +3800,7 @@ fn docsCopyModule(comp: *Compilation, module: *Package.Module, name: []const u8, |
| 3803 | } | 3800 | } |
| 3804 | } | 3801 | } |
| 3805 | 3802 | ||
| 3806 | fn workerDocsWasm(comp: *Compilation, prog_node: *std.Progress.Node) void { | 3803 | fn workerDocsWasm(comp: *Compilation, prog_node: std.Progress.Node) void { |
| 3807 | workerDocsWasmFallible(comp, prog_node) catch |err| { | 3804 | workerDocsWasmFallible(comp, prog_node) catch |err| { |
| 3808 | comp.lockAndSetMiscFailure(.docs_wasm, "unable to build autodocs: {s}", .{ | 3805 | comp.lockAndSetMiscFailure(.docs_wasm, "unable to build autodocs: {s}", .{ |
| 3809 | @errorName(err), | 3806 | @errorName(err), |
| ... | @@ -3811,7 +3808,7 @@ fn workerDocsWasm(comp: *Compilation, prog_node: *std.Progress.Node) void { | ... | @@ -3811,7 +3808,7 @@ fn workerDocsWasm(comp: *Compilation, prog_node: *std.Progress.Node) void { |
| 3811 | }; | 3808 | }; |
| 3812 | } | 3809 | } |
| 3813 | 3810 | ||
| 3814 | fn workerDocsWasmFallible(comp: *Compilation, prog_node: *std.Progress.Node) anyerror!void { | 3811 | fn workerDocsWasmFallible(comp: *Compilation, prog_node: std.Progress.Node) anyerror!void { |
| 3815 | const gpa = comp.gpa; | 3812 | const gpa = comp.gpa; |
| 3816 | 3813 | ||
| 3817 | var arena_allocator = std.heap.ArenaAllocator.init(gpa); | 3814 | var arena_allocator = std.heap.ArenaAllocator.init(gpa); |
| ... | @@ -3952,12 +3949,11 @@ const AstGenSrc = union(enum) { | ... | @@ -3952,12 +3949,11 @@ const AstGenSrc = union(enum) { |
| 3952 | fn workerAstGenFile( | 3949 | fn workerAstGenFile( |
| 3953 | comp: *Compilation, | 3950 | comp: *Compilation, |
| 3954 | file: *Module.File, | 3951 | file: *Module.File, |
| 3955 | prog_node: *std.Progress.Node, | 3952 | prog_node: std.Progress.Node, |
| 3956 | wg: *WaitGroup, | 3953 | wg: *WaitGroup, |
| 3957 | src: AstGenSrc, | 3954 | src: AstGenSrc, |
| 3958 | ) void { | 3955 | ) void { |
| 3959 | var child_prog_node = prog_node.start(file.sub_file_path, 0); | 3956 | const child_prog_node = prog_node.start(file.sub_file_path, 0); |
| 3960 | child_prog_node.activate(); | ||
| 3961 | defer child_prog_node.end(); | 3957 | defer child_prog_node.end(); |
| 3962 | 3958 | ||
| 3963 | const mod = comp.module.?; | 3959 | const mod = comp.module.?; |
| ... | @@ -4265,7 +4261,7 @@ pub fn cImport(comp: *Compilation, c_src: []const u8, owner_mod: *Package.Module | ... | @@ -4265,7 +4261,7 @@ pub fn cImport(comp: *Compilation, c_src: []const u8, owner_mod: *Package.Module |
| 4265 | fn workerUpdateCObject( | 4261 | fn workerUpdateCObject( |
| 4266 | comp: *Compilation, | 4262 | comp: *Compilation, |
| 4267 | c_object: *CObject, | 4263 | c_object: *CObject, |
| 4268 | progress_node: *std.Progress.Node, | 4264 | progress_node: std.Progress.Node, |
| 4269 | ) void { | 4265 | ) void { |
| 4270 | comp.updateCObject(c_object, progress_node) catch |err| switch (err) { | 4266 | comp.updateCObject(c_object, progress_node) catch |err| switch (err) { |
| 4271 | error.AnalysisFail => return, | 4267 | error.AnalysisFail => return, |
| ... | @@ -4282,7 +4278,7 @@ fn workerUpdateCObject( | ... | @@ -4282,7 +4278,7 @@ fn workerUpdateCObject( |
| 4282 | fn workerUpdateWin32Resource( | 4278 | fn workerUpdateWin32Resource( |
| 4283 | comp: *Compilation, | 4279 | comp: *Compilation, |
| 4284 | win32_resource: *Win32Resource, | 4280 | win32_resource: *Win32Resource, |
| 4285 | progress_node: *std.Progress.Node, | 4281 | progress_node: std.Progress.Node, |
| 4286 | ) void { | 4282 | ) void { |
| 4287 | comp.updateWin32Resource(win32_resource, progress_node) catch |err| switch (err) { | 4283 | comp.updateWin32Resource(win32_resource, progress_node) catch |err| switch (err) { |
| 4288 | error.AnalysisFail => return, | 4284 | error.AnalysisFail => return, |
| ... | @@ -4300,7 +4296,7 @@ fn buildCompilerRtOneShot( | ... | @@ -4300,7 +4296,7 @@ fn buildCompilerRtOneShot( |
| 4300 | comp: *Compilation, | 4296 | comp: *Compilation, |
| 4301 | output_mode: std.builtin.OutputMode, | 4297 | output_mode: std.builtin.OutputMode, |
| 4302 | out: *?CRTFile, | 4298 | out: *?CRTFile, |
| 4303 | prog_node: *std.Progress.Node, | 4299 | prog_node: std.Progress.Node, |
| 4304 | ) void { | 4300 | ) void { |
| 4305 | comp.buildOutputFromZig( | 4301 | comp.buildOutputFromZig( |
| 4306 | "compiler_rt.zig", | 4302 | "compiler_rt.zig", |
| ... | @@ -4427,7 +4423,7 @@ fn reportRetryableEmbedFileError( | ... | @@ -4427,7 +4423,7 @@ fn reportRetryableEmbedFileError( |
| 4427 | } | 4423 | } |
| 4428 | } | 4424 | } |
| 4429 | 4425 | ||
| 4430 | fn updateCObject(comp: *Compilation, c_object: *CObject, c_obj_prog_node: *std.Progress.Node) !void { | 4426 | fn updateCObject(comp: *Compilation, c_object: *CObject, c_obj_prog_node: std.Progress.Node) !void { |
| 4431 | if (comp.config.c_frontend == .aro) { | 4427 | if (comp.config.c_frontend == .aro) { |
| 4432 | return comp.failCObj(c_object, "aro does not support compiling C objects yet", .{}); | 4428 | return comp.failCObj(c_object, "aro does not support compiling C objects yet", .{}); |
| 4433 | } | 4429 | } |
| ... | @@ -4467,9 +4463,7 @@ fn updateCObject(comp: *Compilation, c_object: *CObject, c_obj_prog_node: *std.P | ... | @@ -4467,9 +4463,7 @@ fn updateCObject(comp: *Compilation, c_object: *CObject, c_obj_prog_node: *std.P |
| 4467 | 4463 | ||
| 4468 | const c_source_basename = std.fs.path.basename(c_object.src.src_path); | 4464 | const c_source_basename = std.fs.path.basename(c_object.src.src_path); |
| 4469 | 4465 | ||
| 4470 | c_obj_prog_node.activate(); | 4466 | const child_progress_node = c_obj_prog_node.start(c_source_basename, 0); |
| 4471 | var child_progress_node = c_obj_prog_node.start(c_source_basename, 0); | ||
| 4472 | child_progress_node.activate(); | ||
| 4473 | defer child_progress_node.end(); | 4467 | defer child_progress_node.end(); |
| 4474 | 4468 | ||
| 4475 | // Special case when doing build-obj for just one C file. When there are more than one object | 4469 | // Special case when doing build-obj for just one C file. When there are more than one object |
| ... | @@ -4731,7 +4725,7 @@ fn updateCObject(comp: *Compilation, c_object: *CObject, c_obj_prog_node: *std.P | ... | @@ -4731,7 +4725,7 @@ fn updateCObject(comp: *Compilation, c_object: *CObject, c_obj_prog_node: *std.P |
| 4731 | }; | 4725 | }; |
| 4732 | } | 4726 | } |
| 4733 | 4727 | ||
| 4734 | fn updateWin32Resource(comp: *Compilation, win32_resource: *Win32Resource, win32_resource_prog_node: *std.Progress.Node) !void { | 4728 | fn updateWin32Resource(comp: *Compilation, win32_resource: *Win32Resource, win32_resource_prog_node: std.Progress.Node) !void { |
| 4735 | if (!std.process.can_spawn) { | 4729 | if (!std.process.can_spawn) { |
| 4736 | return comp.failWin32Resource(win32_resource, "{s} does not support spawning a child process", .{@tagName(builtin.os.tag)}); | 4730 | return comp.failWin32Resource(win32_resource, "{s} does not support spawning a child process", .{@tagName(builtin.os.tag)}); |
| 4737 | } | 4731 | } |
| ... | @@ -4763,9 +4757,7 @@ fn updateWin32Resource(comp: *Compilation, win32_resource: *Win32Resource, win32 | ... | @@ -4763,9 +4757,7 @@ fn updateWin32Resource(comp: *Compilation, win32_resource: *Win32Resource, win32 |
| 4763 | _ = comp.failed_win32_resources.swapRemove(win32_resource); | 4757 | _ = comp.failed_win32_resources.swapRemove(win32_resource); |
| 4764 | } | 4758 | } |
| 4765 | 4759 | ||
| 4766 | win32_resource_prog_node.activate(); | 4760 | const child_progress_node = win32_resource_prog_node.start(src_basename, 0); |
| 4767 | var child_progress_node = win32_resource_prog_node.start(src_basename, 0); | ||
| 4768 | child_progress_node.activate(); | ||
| 4769 | defer child_progress_node.end(); | 4761 | defer child_progress_node.end(); |
| 4770 | 4762 | ||
| 4771 | var man = comp.obtainWin32ResourceCacheManifest(); | 4763 | var man = comp.obtainWin32ResourceCacheManifest(); |
| ... | @@ -4833,7 +4825,7 @@ fn updateWin32Resource(comp: *Compilation, win32_resource: *Win32Resource, win32 | ... | @@ -4833,7 +4825,7 @@ fn updateWin32Resource(comp: *Compilation, win32_resource: *Win32Resource, win32 |
| 4833 | }); | 4825 | }); |
| 4834 | try argv.appendSlice(&.{ "--", in_rc_path, out_res_path }); | 4826 | try argv.appendSlice(&.{ "--", in_rc_path, out_res_path }); |
| 4835 | 4827 | ||
| 4836 | try spawnZigRc(comp, win32_resource, src_basename, arena, argv.items, &child_progress_node); | 4828 | try spawnZigRc(comp, win32_resource, arena, argv.items, child_progress_node); |
| 4837 | 4829 | ||
| 4838 | break :blk digest; | 4830 | break :blk digest; |
| 4839 | }; | 4831 | }; |
| ... | @@ -4901,7 +4893,7 @@ fn updateWin32Resource(comp: *Compilation, win32_resource: *Win32Resource, win32 | ... | @@ -4901,7 +4893,7 @@ fn updateWin32Resource(comp: *Compilation, win32_resource: *Win32Resource, win32 |
| 4901 | try argv.appendSlice(rc_src.extra_flags); | 4893 | try argv.appendSlice(rc_src.extra_flags); |
| 4902 | try argv.appendSlice(&.{ "--", rc_src.src_path, out_res_path }); | 4894 | try argv.appendSlice(&.{ "--", rc_src.src_path, out_res_path }); |
| 4903 | 4895 | ||
| 4904 | try spawnZigRc(comp, win32_resource, src_basename, arena, argv.items, &child_progress_node); | 4896 | try spawnZigRc(comp, win32_resource, arena, argv.items, child_progress_node); |
| 4905 | 4897 | ||
| 4906 | // Read depfile and update cache manifest | 4898 | // Read depfile and update cache manifest |
| 4907 | { | 4899 | { |
| ... | @@ -4966,10 +4958,9 @@ fn updateWin32Resource(comp: *Compilation, win32_resource: *Win32Resource, win32 | ... | @@ -4966,10 +4958,9 @@ fn updateWin32Resource(comp: *Compilation, win32_resource: *Win32Resource, win32 |
| 4966 | fn spawnZigRc( | 4958 | fn spawnZigRc( |
| 4967 | comp: *Compilation, | 4959 | comp: *Compilation, |
| 4968 | win32_resource: *Win32Resource, | 4960 | win32_resource: *Win32Resource, |
| 4969 | src_basename: []const u8, | ||
| 4970 | arena: Allocator, | 4961 | arena: Allocator, |
| 4971 | argv: []const []const u8, | 4962 | argv: []const []const u8, |
| 4972 | child_progress_node: *std.Progress.Node, | 4963 | child_progress_node: std.Progress.Node, |
| 4973 | ) !void { | 4964 | ) !void { |
| 4974 | var node_name: std.ArrayListUnmanaged(u8) = .{}; | 4965 | var node_name: std.ArrayListUnmanaged(u8) = .{}; |
| 4975 | defer node_name.deinit(arena); | 4966 | defer node_name.deinit(arena); |
| ... | @@ -4978,6 +4969,7 @@ fn spawnZigRc( | ... | @@ -4978,6 +4969,7 @@ fn spawnZigRc( |
| 4978 | child.stdin_behavior = .Ignore; | 4969 | child.stdin_behavior = .Ignore; |
| 4979 | child.stdout_behavior = .Pipe; | 4970 | child.stdout_behavior = .Pipe; |
| 4980 | child.stderr_behavior = .Pipe; | 4971 | child.stderr_behavior = .Pipe; |
| 4972 | child.progress_node = child_progress_node; | ||
| 4981 | 4973 | ||
| 4982 | child.spawn() catch |err| { | 4974 | child.spawn() catch |err| { |
| 4983 | return comp.failWin32Resource(win32_resource, "unable to spawn {s} rc: {s}", .{ argv[0], @errorName(err) }); | 4975 | return comp.failWin32Resource(win32_resource, "unable to spawn {s} rc: {s}", .{ argv[0], @errorName(err) }); |
| ... | @@ -5019,22 +5011,6 @@ fn spawnZigRc( | ... | @@ -5019,22 +5011,6 @@ fn spawnZigRc( |
| 5019 | }; | 5011 | }; |
| 5020 | return comp.failWin32ResourceWithOwnedBundle(win32_resource, error_bundle); | 5012 | return comp.failWin32ResourceWithOwnedBundle(win32_resource, error_bundle); |
| 5021 | }, | 5013 | }, |
| 5022 | .progress => { | ||
| 5023 | node_name.clearRetainingCapacity(); | ||
| 5024 | // <resinator> is a special string that indicates that the child | ||
| 5025 | // process has reached resinator's main function | ||
| 5026 | if (std.mem.eql(u8, body, "<resinator>")) { | ||
| 5027 | child_progress_node.setName(src_basename); | ||
| 5028 | } | ||
| 5029 | // Ignore 0-length strings since if multiple zig rc commands | ||
| 5030 | // are executed at the same time, only one will send progress strings | ||
| 5031 | // while the other(s) will send empty strings. | ||
| 5032 | else if (body.len > 0) { | ||
| 5033 | try node_name.appendSlice(arena, "build 'zig rc'... "); | ||
| 5034 | try node_name.appendSlice(arena, body); | ||
| 5035 | child_progress_node.setName(node_name.items); | ||
| 5036 | } | ||
| 5037 | }, | ||
| 5038 | else => {}, // ignore other messages | 5014 | else => {}, // ignore other messages |
| 5039 | } | 5015 | } |
| 5040 | 5016 | ||
| ... | @@ -5937,8 +5913,8 @@ pub fn lockAndParseLldStderr(comp: *Compilation, prefix: []const u8, stderr: []c | ... | @@ -5937,8 +5913,8 @@ pub fn lockAndParseLldStderr(comp: *Compilation, prefix: []const u8, stderr: []c |
| 5937 | } | 5913 | } |
| 5938 | 5914 | ||
| 5939 | pub fn dump_argv(argv: []const []const u8) void { | 5915 | pub fn dump_argv(argv: []const []const u8) void { |
| 5940 | std.debug.getStderrMutex().lock(); | 5916 | std.debug.lockStdErr(); |
| 5941 | defer std.debug.getStderrMutex().unlock(); | 5917 | defer std.debug.unlockStdErr(); |
| 5942 | const stderr = std.io.getStdErr().writer(); | 5918 | const stderr = std.io.getStdErr().writer(); |
| 5943 | for (argv[0 .. argv.len - 1]) |arg| { | 5919 | for (argv[0 .. argv.len - 1]) |arg| { |
| 5944 | nosuspend stderr.print("{s} ", .{arg}) catch return; | 5920 | nosuspend stderr.print("{s} ", .{arg}) catch return; |
| ... | @@ -5989,11 +5965,10 @@ pub fn updateSubCompilation( | ... | @@ -5989,11 +5965,10 @@ pub fn updateSubCompilation( |
| 5989 | parent_comp: *Compilation, | 5965 | parent_comp: *Compilation, |
| 5990 | sub_comp: *Compilation, | 5966 | sub_comp: *Compilation, |
| 5991 | misc_task: MiscTask, | 5967 | misc_task: MiscTask, |
| 5992 | prog_node: *std.Progress.Node, | 5968 | prog_node: std.Progress.Node, |
| 5993 | ) !void { | 5969 | ) !void { |
| 5994 | { | 5970 | { |
| 5995 | var sub_node = prog_node.start(@tagName(misc_task), 0); | 5971 | const sub_node = prog_node.start(@tagName(misc_task), 0); |
| 5996 | sub_node.activate(); | ||
| 5997 | defer sub_node.end(); | 5972 | defer sub_node.end(); |
| 5998 | 5973 | ||
| 5999 | try sub_comp.update(prog_node); | 5974 | try sub_comp.update(prog_node); |
| ... | @@ -6024,7 +5999,7 @@ fn buildOutputFromZig( | ... | @@ -6024,7 +5999,7 @@ fn buildOutputFromZig( |
| 6024 | output_mode: std.builtin.OutputMode, | 5999 | output_mode: std.builtin.OutputMode, |
| 6025 | out: *?CRTFile, | 6000 | out: *?CRTFile, |
| 6026 | misc_task_tag: MiscTask, | 6001 | misc_task_tag: MiscTask, |
| 6027 | prog_node: *std.Progress.Node, | 6002 | prog_node: std.Progress.Node, |
| 6028 | ) !void { | 6003 | ) !void { |
| 6029 | const tracy_trace = trace(@src()); | 6004 | const tracy_trace = trace(@src()); |
| 6030 | defer tracy_trace.end(); | 6005 | defer tracy_trace.end(); |
| ... | @@ -6131,7 +6106,7 @@ pub fn build_crt_file( | ... | @@ -6131,7 +6106,7 @@ pub fn build_crt_file( |
| 6131 | root_name: []const u8, | 6106 | root_name: []const u8, |
| 6132 | output_mode: std.builtin.OutputMode, | 6107 | output_mode: std.builtin.OutputMode, |
| 6133 | misc_task_tag: MiscTask, | 6108 | misc_task_tag: MiscTask, |
| 6134 | prog_node: *std.Progress.Node, | 6109 | prog_node: std.Progress.Node, |
| 6135 | /// These elements have to get mutated to add the owner module after it is | 6110 | /// These elements have to get mutated to add the owner module after it is |
| 6136 | /// created within this function. | 6111 | /// created within this function. |
| 6137 | c_source_files: []CSourceFile, | 6112 | c_source_files: []CSourceFile, |
src/Module.zig+2-4| ... | @@ -2991,8 +2991,7 @@ pub fn ensureDeclAnalyzed(mod: *Module, decl_index: Decl.Index) SemaError!void { | ... | @@ -2991,8 +2991,7 @@ pub fn ensureDeclAnalyzed(mod: *Module, decl_index: Decl.Index) SemaError!void { |
| 2991 | try mod.deleteDeclExports(decl_index); | 2991 | try mod.deleteDeclExports(decl_index); |
| 2992 | } | 2992 | } |
| 2993 | 2993 | ||
| 2994 | var decl_prog_node = mod.sema_prog_node.start("", 0); | 2994 | const decl_prog_node = mod.sema_prog_node.start("", 0); |
| 2995 | decl_prog_node.activate(); | ||
| 2996 | defer decl_prog_node.end(); | 2995 | defer decl_prog_node.end(); |
| 2997 | 2996 | ||
| 2998 | const sema_result: SemaDeclResult = blk: { | 2997 | const sema_result: SemaDeclResult = blk: { |
| ... | @@ -5316,7 +5315,7 @@ fn handleUpdateExports( | ... | @@ -5316,7 +5315,7 @@ fn handleUpdateExports( |
| 5316 | 5315 | ||
| 5317 | pub fn populateTestFunctions( | 5316 | pub fn populateTestFunctions( |
| 5318 | mod: *Module, | 5317 | mod: *Module, |
| 5319 | main_progress_node: *std.Progress.Node, | 5318 | main_progress_node: std.Progress.Node, |
| 5320 | ) !void { | 5319 | ) !void { |
| 5321 | const gpa = mod.gpa; | 5320 | const gpa = mod.gpa; |
| 5322 | const ip = &mod.intern_pool; | 5321 | const ip = &mod.intern_pool; |
| ... | @@ -5333,7 +5332,6 @@ pub fn populateTestFunctions( | ... | @@ -5333,7 +5332,6 @@ pub fn populateTestFunctions( |
| 5333 | // We have to call `ensureDeclAnalyzed` here in case `builtin.test_functions` | 5332 | // We have to call `ensureDeclAnalyzed` here in case `builtin.test_functions` |
| 5334 | // was not referenced by start code. | 5333 | // was not referenced by start code. |
| 5335 | mod.sema_prog_node = main_progress_node.start("Semantic Analysis", 0); | 5334 | mod.sema_prog_node = main_progress_node.start("Semantic Analysis", 0); |
| 5336 | mod.sema_prog_node.activate(); | ||
| 5337 | defer { | 5335 | defer { |
| 5338 | mod.sema_prog_node.end(); | 5336 | mod.sema_prog_node.end(); |
| 5339 | mod.sema_prog_node = undefined; | 5337 | mod.sema_prog_node = undefined; |
src/Package/Fetch.zig+5-9| ... | @@ -35,7 +35,7 @@ name_tok: std.zig.Ast.TokenIndex, | ... | @@ -35,7 +35,7 @@ name_tok: std.zig.Ast.TokenIndex, |
| 35 | lazy_status: LazyStatus, | 35 | lazy_status: LazyStatus, |
| 36 | parent_package_root: Cache.Path, | 36 | parent_package_root: Cache.Path, |
| 37 | parent_manifest_ast: ?*const std.zig.Ast, | 37 | parent_manifest_ast: ?*const std.zig.Ast, |
| 38 | prog_node: *std.Progress.Node, | 38 | prog_node: std.Progress.Node, |
| 39 | job_queue: *JobQueue, | 39 | job_queue: *JobQueue, |
| 40 | /// If true, don't add an error for a missing hash. This flag is not passed | 40 | /// If true, don't add an error for a missing hash. This flag is not passed |
| 41 | /// down to recursive dependencies. It's intended to be used only be the CLI. | 41 | /// down to recursive dependencies. It's intended to be used only be the CLI. |
| ... | @@ -720,8 +720,7 @@ fn queueJobsForDeps(f: *Fetch) RunError!void { | ... | @@ -720,8 +720,7 @@ fn queueJobsForDeps(f: *Fetch) RunError!void { |
| 720 | }; | 720 | }; |
| 721 | } | 721 | } |
| 722 | 722 | ||
| 723 | // job_queue mutex is locked so this is OK. | 723 | f.prog_node.increaseEstimatedTotalItems(new_fetch_index); |
| 724 | f.prog_node.unprotected_estimated_total_items += new_fetch_index; | ||
| 725 | 724 | ||
| 726 | break :nf .{ new_fetches[0..new_fetch_index], prog_names[0..new_fetch_index] }; | 725 | break :nf .{ new_fetches[0..new_fetch_index], prog_names[0..new_fetch_index] }; |
| 727 | }; | 726 | }; |
| ... | @@ -751,9 +750,8 @@ pub fn relativePathDigest( | ... | @@ -751,9 +750,8 @@ pub fn relativePathDigest( |
| 751 | } | 750 | } |
| 752 | 751 | ||
| 753 | pub fn workerRun(f: *Fetch, prog_name: []const u8) void { | 752 | pub fn workerRun(f: *Fetch, prog_name: []const u8) void { |
| 754 | var prog_node = f.prog_node.start(prog_name, 0); | 753 | const prog_node = f.prog_node.start(prog_name, 0); |
| 755 | defer prog_node.end(); | 754 | defer prog_node.end(); |
| 756 | prog_node.activate(); | ||
| 757 | 755 | ||
| 758 | run(f) catch |err| switch (err) { | 756 | run(f) catch |err| switch (err) { |
| 759 | error.OutOfMemory => f.oom_flag = true, | 757 | error.OutOfMemory => f.oom_flag = true, |
| ... | @@ -1311,9 +1309,8 @@ fn unpackGitPack(f: *Fetch, out_dir: fs.Dir, resource: *Resource) anyerror!Unpac | ... | @@ -1311,9 +1309,8 @@ fn unpackGitPack(f: *Fetch, out_dir: fs.Dir, resource: *Resource) anyerror!Unpac |
| 1311 | var index_file = try pack_dir.createFile("pkg.idx", .{ .read = true }); | 1309 | var index_file = try pack_dir.createFile("pkg.idx", .{ .read = true }); |
| 1312 | defer index_file.close(); | 1310 | defer index_file.close(); |
| 1313 | { | 1311 | { |
| 1314 | var index_prog_node = f.prog_node.start("Index pack", 0); | 1312 | const index_prog_node = f.prog_node.start("Index pack", 0); |
| 1315 | defer index_prog_node.end(); | 1313 | defer index_prog_node.end(); |
| 1316 | index_prog_node.activate(); | ||
| 1317 | var index_buffered_writer = std.io.bufferedWriter(index_file.writer()); | 1314 | var index_buffered_writer = std.io.bufferedWriter(index_file.writer()); |
| 1318 | try git.indexPack(gpa, pack_file, index_buffered_writer.writer()); | 1315 | try git.indexPack(gpa, pack_file, index_buffered_writer.writer()); |
| 1319 | try index_buffered_writer.flush(); | 1316 | try index_buffered_writer.flush(); |
| ... | @@ -1321,9 +1318,8 @@ fn unpackGitPack(f: *Fetch, out_dir: fs.Dir, resource: *Resource) anyerror!Unpac | ... | @@ -1321,9 +1318,8 @@ fn unpackGitPack(f: *Fetch, out_dir: fs.Dir, resource: *Resource) anyerror!Unpac |
| 1321 | } | 1318 | } |
| 1322 | 1319 | ||
| 1323 | { | 1320 | { |
| 1324 | var checkout_prog_node = f.prog_node.start("Checkout", 0); | 1321 | const checkout_prog_node = f.prog_node.start("Checkout", 0); |
| 1325 | defer checkout_prog_node.end(); | 1322 | defer checkout_prog_node.end(); |
| 1326 | checkout_prog_node.activate(); | ||
| 1327 | var repository = try git.Repository.init(gpa, pack_file, index_file); | 1323 | var repository = try git.Repository.init(gpa, pack_file, index_file); |
| 1328 | defer repository.deinit(); | 1324 | defer repository.deinit(); |
| 1329 | var diagnostics: git.Diagnostics = .{ .allocator = arena }; | 1325 | var diagnostics: git.Diagnostics = .{ .allocator = arena }; |
src/glibc.zig+3-3| ... | @@ -160,7 +160,7 @@ pub const CRTFile = enum { | ... | @@ -160,7 +160,7 @@ pub const CRTFile = enum { |
| 160 | libc_nonshared_a, | 160 | libc_nonshared_a, |
| 161 | }; | 161 | }; |
| 162 | 162 | ||
| 163 | pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progress.Node) !void { | 163 | pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: std.Progress.Node) !void { |
| 164 | if (!build_options.have_llvm) { | 164 | if (!build_options.have_llvm) { |
| 165 | return error.ZigCompilerNotBuiltWithLLVMExtensions; | 165 | return error.ZigCompilerNotBuiltWithLLVMExtensions; |
| 166 | } | 166 | } |
| ... | @@ -658,7 +658,7 @@ pub const BuiltSharedObjects = struct { | ... | @@ -658,7 +658,7 @@ pub const BuiltSharedObjects = struct { |
| 658 | 658 | ||
| 659 | const all_map_basename = "all.map"; | 659 | const all_map_basename = "all.map"; |
| 660 | 660 | ||
| 661 | pub fn buildSharedObjects(comp: *Compilation, prog_node: *std.Progress.Node) !void { | 661 | pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) !void { |
| 662 | const tracy = trace(@src()); | 662 | const tracy = trace(@src()); |
| 663 | defer tracy.end(); | 663 | defer tracy.end(); |
| 664 | 664 | ||
| ... | @@ -1065,7 +1065,7 @@ fn buildSharedLib( | ... | @@ -1065,7 +1065,7 @@ fn buildSharedLib( |
| 1065 | bin_directory: Compilation.Directory, | 1065 | bin_directory: Compilation.Directory, |
| 1066 | asm_file_basename: []const u8, | 1066 | asm_file_basename: []const u8, |
| 1067 | lib: Lib, | 1067 | lib: Lib, |
| 1068 | prog_node: *std.Progress.Node, | 1068 | prog_node: std.Progress.Node, |
| 1069 | ) !void { | 1069 | ) !void { |
| 1070 | const tracy = trace(@src()); | 1070 | const tracy = trace(@src()); |
| 1071 | defer tracy.end(); | 1071 | defer tracy.end(); |
src/libcxx.zig+2-2| ... | @@ -113,7 +113,7 @@ pub const BuildError = error{ | ... | @@ -113,7 +113,7 @@ pub const BuildError = error{ |
| 113 | ZigCompilerNotBuiltWithLLVMExtensions, | 113 | ZigCompilerNotBuiltWithLLVMExtensions, |
| 114 | }; | 114 | }; |
| 115 | 115 | ||
| 116 | pub fn buildLibCXX(comp: *Compilation, prog_node: *std.Progress.Node) BuildError!void { | 116 | pub fn buildLibCXX(comp: *Compilation, prog_node: std.Progress.Node) BuildError!void { |
| 117 | if (!build_options.have_llvm) { | 117 | if (!build_options.have_llvm) { |
| 118 | return error.ZigCompilerNotBuiltWithLLVMExtensions; | 118 | return error.ZigCompilerNotBuiltWithLLVMExtensions; |
| 119 | } | 119 | } |
| ... | @@ -357,7 +357,7 @@ pub fn buildLibCXX(comp: *Compilation, prog_node: *std.Progress.Node) BuildError | ... | @@ -357,7 +357,7 @@ pub fn buildLibCXX(comp: *Compilation, prog_node: *std.Progress.Node) BuildError |
| 357 | comp.libcxx_static_lib = try sub_compilation.toCrtFile(); | 357 | comp.libcxx_static_lib = try sub_compilation.toCrtFile(); |
| 358 | } | 358 | } |
| 359 | 359 | ||
| 360 | pub fn buildLibCXXABI(comp: *Compilation, prog_node: *std.Progress.Node) BuildError!void { | 360 | pub fn buildLibCXXABI(comp: *Compilation, prog_node: std.Progress.Node) BuildError!void { |
| 361 | if (!build_options.have_llvm) { | 361 | if (!build_options.have_llvm) { |
| 362 | return error.ZigCompilerNotBuiltWithLLVMExtensions; | 362 | return error.ZigCompilerNotBuiltWithLLVMExtensions; |
| 363 | } | 363 | } |
src/libtsan.zig+1-1| ... | @@ -13,7 +13,7 @@ pub const BuildError = error{ | ... | @@ -13,7 +13,7 @@ pub const BuildError = error{ |
| 13 | TSANUnsupportedCPUArchitecture, | 13 | TSANUnsupportedCPUArchitecture, |
| 14 | }; | 14 | }; |
| 15 | 15 | ||
| 16 | pub fn buildTsan(comp: *Compilation, prog_node: *std.Progress.Node) BuildError!void { | 16 | pub fn buildTsan(comp: *Compilation, prog_node: std.Progress.Node) BuildError!void { |
| 17 | if (!build_options.have_llvm) { | 17 | if (!build_options.have_llvm) { |
| 18 | return error.ZigCompilerNotBuiltWithLLVMExtensions; | 18 | return error.ZigCompilerNotBuiltWithLLVMExtensions; |
| 19 | } | 19 | } |
src/libunwind.zig+1-1| ... | @@ -14,7 +14,7 @@ pub const BuildError = error{ | ... | @@ -14,7 +14,7 @@ pub const BuildError = error{ |
| 14 | ZigCompilerNotBuiltWithLLVMExtensions, | 14 | ZigCompilerNotBuiltWithLLVMExtensions, |
| 15 | }; | 15 | }; |
| 16 | 16 | ||
| 17 | pub fn buildStaticLib(comp: *Compilation, prog_node: *std.Progress.Node) BuildError!void { | 17 | pub fn buildStaticLib(comp: *Compilation, prog_node: std.Progress.Node) BuildError!void { |
| 18 | if (!build_options.have_llvm) { | 18 | if (!build_options.have_llvm) { |
| 19 | return error.ZigCompilerNotBuiltWithLLVMExtensions; | 19 | return error.ZigCompilerNotBuiltWithLLVMExtensions; |
| 20 | } | 20 | } |
src/link.zig+4-4| ... | @@ -535,7 +535,7 @@ pub const File = struct { | ... | @@ -535,7 +535,7 @@ pub const File = struct { |
| 535 | /// Commit pending changes and write headers. Takes into account final output mode | 535 | /// Commit pending changes and write headers. Takes into account final output mode |
| 536 | /// and `use_lld`, not only `effectiveOutputMode`. | 536 | /// and `use_lld`, not only `effectiveOutputMode`. |
| 537 | /// `arena` has the lifetime of the call to `Compilation.update`. | 537 | /// `arena` has the lifetime of the call to `Compilation.update`. |
| 538 | pub fn flush(base: *File, arena: Allocator, prog_node: *std.Progress.Node) FlushError!void { | 538 | pub fn flush(base: *File, arena: Allocator, prog_node: std.Progress.Node) FlushError!void { |
| 539 | if (build_options.only_c) { | 539 | if (build_options.only_c) { |
| 540 | assert(base.tag == .c); | 540 | assert(base.tag == .c); |
| 541 | return @as(*C, @fieldParentPtr("base", base)).flush(arena, prog_node); | 541 | return @as(*C, @fieldParentPtr("base", base)).flush(arena, prog_node); |
| ... | @@ -572,7 +572,7 @@ pub const File = struct { | ... | @@ -572,7 +572,7 @@ pub const File = struct { |
| 572 | 572 | ||
| 573 | /// Commit pending changes and write headers. Works based on `effectiveOutputMode` | 573 | /// Commit pending changes and write headers. Works based on `effectiveOutputMode` |
| 574 | /// rather than final output mode. | 574 | /// rather than final output mode. |
| 575 | pub fn flushModule(base: *File, arena: Allocator, prog_node: *std.Progress.Node) FlushError!void { | 575 | pub fn flushModule(base: *File, arena: Allocator, prog_node: std.Progress.Node) FlushError!void { |
| 576 | switch (base.tag) { | 576 | switch (base.tag) { |
| 577 | inline else => |tag| { | 577 | inline else => |tag| { |
| 578 | if (tag != .c and build_options.only_c) unreachable; | 578 | if (tag != .c and build_options.only_c) unreachable; |
| ... | @@ -688,7 +688,7 @@ pub const File = struct { | ... | @@ -688,7 +688,7 @@ pub const File = struct { |
| 688 | } | 688 | } |
| 689 | } | 689 | } |
| 690 | 690 | ||
| 691 | pub fn linkAsArchive(base: *File, arena: Allocator, prog_node: *std.Progress.Node) FlushError!void { | 691 | pub fn linkAsArchive(base: *File, arena: Allocator, prog_node: std.Progress.Node) FlushError!void { |
| 692 | const tracy = trace(@src()); | 692 | const tracy = trace(@src()); |
| 693 | defer tracy.end(); | 693 | defer tracy.end(); |
| 694 | 694 | ||
| ... | @@ -966,7 +966,7 @@ pub const File = struct { | ... | @@ -966,7 +966,7 @@ pub const File = struct { |
| 966 | base: File, | 966 | base: File, |
| 967 | arena: Allocator, | 967 | arena: Allocator, |
| 968 | llvm_object: *LlvmObject, | 968 | llvm_object: *LlvmObject, |
| 969 | prog_node: *std.Progress.Node, | 969 | prog_node: std.Progress.Node, |
| 970 | ) !void { | 970 | ) !void { |
| 971 | return base.comp.emitLlvmObject(arena, base.emit, .{ | 971 | return base.comp.emitLlvmObject(arena, base.emit, .{ |
| 972 | .directory = null, | 972 | .directory = null, |
src/link/C.zig+3-4| ... | @@ -370,7 +370,7 @@ pub fn updateDeclLineNumber(self: *C, zcu: *Zcu, decl_index: InternPool.DeclInde | ... | @@ -370,7 +370,7 @@ pub fn updateDeclLineNumber(self: *C, zcu: *Zcu, decl_index: InternPool.DeclInde |
| 370 | _ = decl_index; | 370 | _ = decl_index; |
| 371 | } | 371 | } |
| 372 | 372 | ||
| 373 | pub fn flush(self: *C, arena: Allocator, prog_node: *std.Progress.Node) !void { | 373 | pub fn flush(self: *C, arena: Allocator, prog_node: std.Progress.Node) !void { |
| 374 | return self.flushModule(arena, prog_node); | 374 | return self.flushModule(arena, prog_node); |
| 375 | } | 375 | } |
| 376 | 376 | ||
| ... | @@ -389,14 +389,13 @@ fn abiDefines(self: *C, target: std.Target) !std.ArrayList(u8) { | ... | @@ -389,14 +389,13 @@ fn abiDefines(self: *C, target: std.Target) !std.ArrayList(u8) { |
| 389 | return defines; | 389 | return defines; |
| 390 | } | 390 | } |
| 391 | 391 | ||
| 392 | pub fn flushModule(self: *C, arena: Allocator, prog_node: *std.Progress.Node) !void { | 392 | pub fn flushModule(self: *C, arena: Allocator, prog_node: std.Progress.Node) !void { |
| 393 | _ = arena; // Has the same lifetime as the call to Compilation.update. | 393 | _ = arena; // Has the same lifetime as the call to Compilation.update. |
| 394 | 394 | ||
| 395 | const tracy = trace(@src()); | 395 | const tracy = trace(@src()); |
| 396 | defer tracy.end(); | 396 | defer tracy.end(); |
| 397 | 397 | ||
| 398 | var sub_prog_node = prog_node.start("Flush Module", 0); | 398 | const sub_prog_node = prog_node.start("Flush Module", 0); |
| 399 | sub_prog_node.activate(); | ||
| 400 | defer sub_prog_node.end(); | 399 | defer sub_prog_node.end(); |
| 401 | 400 | ||
| 402 | const comp = self.base.comp; | 401 | const comp = self.base.comp; |
src/link/Coff.zig+3-4| ... | @@ -1702,7 +1702,7 @@ fn resolveGlobalSymbol(self: *Coff, current: SymbolWithLoc) !void { | ... | @@ -1702,7 +1702,7 @@ fn resolveGlobalSymbol(self: *Coff, current: SymbolWithLoc) !void { |
| 1702 | gop.value_ptr.* = current; | 1702 | gop.value_ptr.* = current; |
| 1703 | } | 1703 | } |
| 1704 | 1704 | ||
| 1705 | pub fn flush(self: *Coff, arena: Allocator, prog_node: *std.Progress.Node) link.File.FlushError!void { | 1705 | pub fn flush(self: *Coff, arena: Allocator, prog_node: std.Progress.Node) link.File.FlushError!void { |
| 1706 | const comp = self.base.comp; | 1706 | const comp = self.base.comp; |
| 1707 | const use_lld = build_options.have_llvm and comp.config.use_lld; | 1707 | const use_lld = build_options.have_llvm and comp.config.use_lld; |
| 1708 | if (use_lld) { | 1708 | if (use_lld) { |
| ... | @@ -1714,7 +1714,7 @@ pub fn flush(self: *Coff, arena: Allocator, prog_node: *std.Progress.Node) link. | ... | @@ -1714,7 +1714,7 @@ pub fn flush(self: *Coff, arena: Allocator, prog_node: *std.Progress.Node) link. |
| 1714 | } | 1714 | } |
| 1715 | } | 1715 | } |
| 1716 | 1716 | ||
| 1717 | pub fn flushModule(self: *Coff, arena: Allocator, prog_node: *std.Progress.Node) link.File.FlushError!void { | 1717 | pub fn flushModule(self: *Coff, arena: Allocator, prog_node: std.Progress.Node) link.File.FlushError!void { |
| 1718 | const tracy = trace(@src()); | 1718 | const tracy = trace(@src()); |
| 1719 | defer tracy.end(); | 1719 | defer tracy.end(); |
| 1720 | 1720 | ||
| ... | @@ -1726,8 +1726,7 @@ pub fn flushModule(self: *Coff, arena: Allocator, prog_node: *std.Progress.Node) | ... | @@ -1726,8 +1726,7 @@ pub fn flushModule(self: *Coff, arena: Allocator, prog_node: *std.Progress.Node) |
| 1726 | return; | 1726 | return; |
| 1727 | } | 1727 | } |
| 1728 | 1728 | ||
| 1729 | var sub_prog_node = prog_node.start("COFF Flush", 0); | 1729 | const sub_prog_node = prog_node.start("COFF Flush", 0); |
| 1730 | sub_prog_node.activate(); | ||
| 1731 | defer sub_prog_node.end(); | 1730 | defer sub_prog_node.end(); |
| 1732 | 1731 | ||
| 1733 | const module = comp.module orelse return error.LinkingWithoutZigSourceUnimplemented; | 1732 | const module = comp.module orelse return error.LinkingWithoutZigSourceUnimplemented; |
src/link/Coff/lld.zig+2-4| ... | @@ -16,7 +16,7 @@ const Allocator = mem.Allocator; | ... | @@ -16,7 +16,7 @@ const Allocator = mem.Allocator; |
| 16 | const Coff = @import("../Coff.zig"); | 16 | const Coff = @import("../Coff.zig"); |
| 17 | const Compilation = @import("../../Compilation.zig"); | 17 | const Compilation = @import("../../Compilation.zig"); |
| 18 | 18 | ||
| 19 | pub fn linkWithLLD(self: *Coff, arena: Allocator, prog_node: *std.Progress.Node) !void { | 19 | pub fn linkWithLLD(self: *Coff, arena: Allocator, prog_node: std.Progress.Node) !void { |
| 20 | const tracy = trace(@src()); | 20 | const tracy = trace(@src()); |
| 21 | defer tracy.end(); | 21 | defer tracy.end(); |
| 22 | 22 | ||
| ... | @@ -38,9 +38,7 @@ pub fn linkWithLLD(self: *Coff, arena: Allocator, prog_node: *std.Progress.Node) | ... | @@ -38,9 +38,7 @@ pub fn linkWithLLD(self: *Coff, arena: Allocator, prog_node: *std.Progress.Node) |
| 38 | } | 38 | } |
| 39 | } else null; | 39 | } else null; |
| 40 | 40 | ||
| 41 | var sub_prog_node = prog_node.start("LLD Link", 0); | 41 | const sub_prog_node = prog_node.start("LLD Link", 0); |
| 42 | sub_prog_node.activate(); | ||
| 43 | sub_prog_node.context.refresh(); | ||
| 44 | defer sub_prog_node.end(); | 42 | defer sub_prog_node.end(); |
| 45 | 43 | ||
| 46 | const is_lib = comp.config.output_mode == .Lib; | 44 | const is_lib = comp.config.output_mode == .Lib; |
src/link/Elf.zig+5-8| ... | @@ -1064,7 +1064,7 @@ pub fn markDirty(self: *Elf, shdr_index: u32) void { | ... | @@ -1064,7 +1064,7 @@ pub fn markDirty(self: *Elf, shdr_index: u32) void { |
| 1064 | } | 1064 | } |
| 1065 | } | 1065 | } |
| 1066 | 1066 | ||
| 1067 | pub fn flush(self: *Elf, arena: Allocator, prog_node: *std.Progress.Node) link.File.FlushError!void { | 1067 | pub fn flush(self: *Elf, arena: Allocator, prog_node: std.Progress.Node) link.File.FlushError!void { |
| 1068 | const use_lld = build_options.have_llvm and self.base.comp.config.use_lld; | 1068 | const use_lld = build_options.have_llvm and self.base.comp.config.use_lld; |
| 1069 | if (use_lld) { | 1069 | if (use_lld) { |
| 1070 | return self.linkWithLLD(arena, prog_node); | 1070 | return self.linkWithLLD(arena, prog_node); |
| ... | @@ -1072,7 +1072,7 @@ pub fn flush(self: *Elf, arena: Allocator, prog_node: *std.Progress.Node) link.F | ... | @@ -1072,7 +1072,7 @@ pub fn flush(self: *Elf, arena: Allocator, prog_node: *std.Progress.Node) link.F |
| 1072 | try self.flushModule(arena, prog_node); | 1072 | try self.flushModule(arena, prog_node); |
| 1073 | } | 1073 | } |
| 1074 | 1074 | ||
| 1075 | pub fn flushModule(self: *Elf, arena: Allocator, prog_node: *std.Progress.Node) link.File.FlushError!void { | 1075 | pub fn flushModule(self: *Elf, arena: Allocator, prog_node: std.Progress.Node) link.File.FlushError!void { |
| 1076 | const tracy = trace(@src()); | 1076 | const tracy = trace(@src()); |
| 1077 | defer tracy.end(); | 1077 | defer tracy.end(); |
| 1078 | 1078 | ||
| ... | @@ -1085,8 +1085,7 @@ pub fn flushModule(self: *Elf, arena: Allocator, prog_node: *std.Progress.Node) | ... | @@ -1085,8 +1085,7 @@ pub fn flushModule(self: *Elf, arena: Allocator, prog_node: *std.Progress.Node) |
| 1085 | if (use_lld) return; | 1085 | if (use_lld) return; |
| 1086 | } | 1086 | } |
| 1087 | 1087 | ||
| 1088 | var sub_prog_node = prog_node.start("ELF Flush", 0); | 1088 | const sub_prog_node = prog_node.start("ELF Flush", 0); |
| 1089 | sub_prog_node.activate(); | ||
| 1090 | defer sub_prog_node.end(); | 1089 | defer sub_prog_node.end(); |
| 1091 | 1090 | ||
| 1092 | const target = comp.root_mod.resolved_target.result; | 1091 | const target = comp.root_mod.resolved_target.result; |
| ... | @@ -2147,7 +2146,7 @@ fn scanRelocs(self: *Elf) !void { | ... | @@ -2147,7 +2146,7 @@ fn scanRelocs(self: *Elf) !void { |
| 2147 | } | 2146 | } |
| 2148 | } | 2147 | } |
| 2149 | 2148 | ||
| 2150 | fn linkWithLLD(self: *Elf, arena: Allocator, prog_node: *std.Progress.Node) !void { | 2149 | fn linkWithLLD(self: *Elf, arena: Allocator, prog_node: std.Progress.Node) !void { |
| 2151 | const tracy = trace(@src()); | 2150 | const tracy = trace(@src()); |
| 2152 | defer tracy.end(); | 2151 | defer tracy.end(); |
| 2153 | 2152 | ||
| ... | @@ -2169,9 +2168,7 @@ fn linkWithLLD(self: *Elf, arena: Allocator, prog_node: *std.Progress.Node) !voi | ... | @@ -2169,9 +2168,7 @@ fn linkWithLLD(self: *Elf, arena: Allocator, prog_node: *std.Progress.Node) !voi |
| 2169 | } | 2168 | } |
| 2170 | } else null; | 2169 | } else null; |
| 2171 | 2170 | ||
| 2172 | var sub_prog_node = prog_node.start("LLD Link", 0); | 2171 | const sub_prog_node = prog_node.start("LLD Link", 0); |
| 2173 | sub_prog_node.activate(); | ||
| 2174 | sub_prog_node.context.refresh(); | ||
| 2175 | defer sub_prog_node.end(); | 2172 | defer sub_prog_node.end(); |
| 2176 | 2173 | ||
| 2177 | const output_mode = comp.config.output_mode; | 2174 | const output_mode = comp.config.output_mode; |
src/link/MachO.zig+3-4| ... | @@ -360,11 +360,11 @@ pub fn deinit(self: *MachO) void { | ... | @@ -360,11 +360,11 @@ pub fn deinit(self: *MachO) void { |
| 360 | self.unwind_records.deinit(gpa); | 360 | self.unwind_records.deinit(gpa); |
| 361 | } | 361 | } |
| 362 | 362 | ||
| 363 | pub fn flush(self: *MachO, arena: Allocator, prog_node: *std.Progress.Node) link.File.FlushError!void { | 363 | pub fn flush(self: *MachO, arena: Allocator, prog_node: std.Progress.Node) link.File.FlushError!void { |
| 364 | try self.flushModule(arena, prog_node); | 364 | try self.flushModule(arena, prog_node); |
| 365 | } | 365 | } |
| 366 | 366 | ||
| 367 | pub fn flushModule(self: *MachO, arena: Allocator, prog_node: *std.Progress.Node) link.File.FlushError!void { | 367 | pub fn flushModule(self: *MachO, arena: Allocator, prog_node: std.Progress.Node) link.File.FlushError!void { |
| 368 | const tracy = trace(@src()); | 368 | const tracy = trace(@src()); |
| 369 | defer tracy.end(); | 369 | defer tracy.end(); |
| 370 | 370 | ||
| ... | @@ -375,8 +375,7 @@ pub fn flushModule(self: *MachO, arena: Allocator, prog_node: *std.Progress.Node | ... | @@ -375,8 +375,7 @@ pub fn flushModule(self: *MachO, arena: Allocator, prog_node: *std.Progress.Node |
| 375 | try self.base.emitLlvmObject(arena, llvm_object, prog_node); | 375 | try self.base.emitLlvmObject(arena, llvm_object, prog_node); |
| 376 | } | 376 | } |
| 377 | 377 | ||
| 378 | var sub_prog_node = prog_node.start("MachO Flush", 0); | 378 | const sub_prog_node = prog_node.start("MachO Flush", 0); |
| 379 | sub_prog_node.activate(); | ||
| 380 | defer sub_prog_node.end(); | 379 | defer sub_prog_node.end(); |
| 381 | 380 | ||
| 382 | const directory = self.base.emit.directory; | 381 | const directory = self.base.emit.directory; |
src/link/NvPtx.zig+2-2| ... | @@ -106,11 +106,11 @@ pub fn freeDecl(self: *NvPtx, decl_index: InternPool.DeclIndex) void { | ... | @@ -106,11 +106,11 @@ pub fn freeDecl(self: *NvPtx, decl_index: InternPool.DeclIndex) void { |
| 106 | return self.llvm_object.freeDecl(decl_index); | 106 | return self.llvm_object.freeDecl(decl_index); |
| 107 | } | 107 | } |
| 108 | 108 | ||
| 109 | pub fn flush(self: *NvPtx, arena: Allocator, prog_node: *std.Progress.Node) link.File.FlushError!void { | 109 | pub fn flush(self: *NvPtx, arena: Allocator, prog_node: std.Progress.Node) link.File.FlushError!void { |
| 110 | return self.flushModule(arena, prog_node); | 110 | return self.flushModule(arena, prog_node); |
| 111 | } | 111 | } |
| 112 | 112 | ||
| 113 | pub fn flushModule(self: *NvPtx, arena: Allocator, prog_node: *std.Progress.Node) link.File.FlushError!void { | 113 | pub fn flushModule(self: *NvPtx, arena: Allocator, prog_node: std.Progress.Node) link.File.FlushError!void { |
| 114 | if (build_options.skip_non_native) | 114 | if (build_options.skip_non_native) |
| 115 | @panic("Attempted to compile for architecture that was disabled by build configuration"); | 115 | @panic("Attempted to compile for architecture that was disabled by build configuration"); |
| 116 | 116 |
src/link/Plan9.zig+3-4| ... | @@ -604,7 +604,7 @@ fn allocateGotIndex(self: *Plan9) usize { | ... | @@ -604,7 +604,7 @@ fn allocateGotIndex(self: *Plan9) usize { |
| 604 | } | 604 | } |
| 605 | } | 605 | } |
| 606 | 606 | ||
| 607 | pub fn flush(self: *Plan9, arena: Allocator, prog_node: *std.Progress.Node) link.File.FlushError!void { | 607 | pub fn flush(self: *Plan9, arena: Allocator, prog_node: std.Progress.Node) link.File.FlushError!void { |
| 608 | const comp = self.base.comp; | 608 | const comp = self.base.comp; |
| 609 | const use_lld = build_options.have_llvm and comp.config.use_lld; | 609 | const use_lld = build_options.have_llvm and comp.config.use_lld; |
| 610 | assert(!use_lld); | 610 | assert(!use_lld); |
| ... | @@ -663,7 +663,7 @@ fn atomCount(self: *Plan9) usize { | ... | @@ -663,7 +663,7 @@ fn atomCount(self: *Plan9) usize { |
| 663 | return data_decl_count + fn_decl_count + unnamed_const_count + lazy_atom_count + extern_atom_count + anon_atom_count; | 663 | return data_decl_count + fn_decl_count + unnamed_const_count + lazy_atom_count + extern_atom_count + anon_atom_count; |
| 664 | } | 664 | } |
| 665 | 665 | ||
| 666 | pub fn flushModule(self: *Plan9, arena: Allocator, prog_node: *std.Progress.Node) link.File.FlushError!void { | 666 | pub fn flushModule(self: *Plan9, arena: Allocator, prog_node: std.Progress.Node) link.File.FlushError!void { |
| 667 | if (build_options.skip_non_native and builtin.object_format != .plan9) { | 667 | if (build_options.skip_non_native and builtin.object_format != .plan9) { |
| 668 | @panic("Attempted to compile for object format that was disabled by build configuration"); | 668 | @panic("Attempted to compile for object format that was disabled by build configuration"); |
| 669 | } | 669 | } |
| ... | @@ -677,8 +677,7 @@ pub fn flushModule(self: *Plan9, arena: Allocator, prog_node: *std.Progress.Node | ... | @@ -677,8 +677,7 @@ pub fn flushModule(self: *Plan9, arena: Allocator, prog_node: *std.Progress.Node |
| 677 | const tracy = trace(@src()); | 677 | const tracy = trace(@src()); |
| 678 | defer tracy.end(); | 678 | defer tracy.end(); |
| 679 | 679 | ||
| 680 | var sub_prog_node = prog_node.start("Flush Module", 0); | 680 | const sub_prog_node = prog_node.start("Flush Module", 0); |
| 681 | sub_prog_node.activate(); | ||
| 682 | defer sub_prog_node.end(); | 681 | defer sub_prog_node.end(); |
| 683 | 682 | ||
| 684 | log.debug("flushModule", .{}); | 683 | log.debug("flushModule", .{}); |
src/link/SpirV.zig+5-6| ... | @@ -193,11 +193,11 @@ pub fn freeDecl(self: *SpirV, decl_index: InternPool.DeclIndex) void { | ... | @@ -193,11 +193,11 @@ pub fn freeDecl(self: *SpirV, decl_index: InternPool.DeclIndex) void { |
| 193 | _ = decl_index; | 193 | _ = decl_index; |
| 194 | } | 194 | } |
| 195 | 195 | ||
| 196 | pub fn flush(self: *SpirV, arena: Allocator, prog_node: *std.Progress.Node) link.File.FlushError!void { | 196 | pub fn flush(self: *SpirV, arena: Allocator, prog_node: std.Progress.Node) link.File.FlushError!void { |
| 197 | return self.flushModule(arena, prog_node); | 197 | return self.flushModule(arena, prog_node); |
| 198 | } | 198 | } |
| 199 | 199 | ||
| 200 | pub fn flushModule(self: *SpirV, arena: Allocator, prog_node: *std.Progress.Node) link.File.FlushError!void { | 200 | pub fn flushModule(self: *SpirV, arena: Allocator, prog_node: std.Progress.Node) link.File.FlushError!void { |
| 201 | if (build_options.skip_non_native) { | 201 | if (build_options.skip_non_native) { |
| 202 | @panic("Attempted to compile for architecture that was disabled by build configuration"); | 202 | @panic("Attempted to compile for architecture that was disabled by build configuration"); |
| 203 | } | 203 | } |
| ... | @@ -205,8 +205,7 @@ pub fn flushModule(self: *SpirV, arena: Allocator, prog_node: *std.Progress.Node | ... | @@ -205,8 +205,7 @@ pub fn flushModule(self: *SpirV, arena: Allocator, prog_node: *std.Progress.Node |
| 205 | const tracy = trace(@src()); | 205 | const tracy = trace(@src()); |
| 206 | defer tracy.end(); | 206 | defer tracy.end(); |
| 207 | 207 | ||
| 208 | var sub_prog_node = prog_node.start("Flush Module", 0); | 208 | const sub_prog_node = prog_node.start("Flush Module", 0); |
| 209 | sub_prog_node.activate(); | ||
| 210 | defer sub_prog_node.end(); | 209 | defer sub_prog_node.end(); |
| 211 | 210 | ||
| 212 | const spv = &self.object.spv; | 211 | const spv = &self.object.spv; |
| ... | @@ -253,7 +252,7 @@ pub fn flushModule(self: *SpirV, arena: Allocator, prog_node: *std.Progress.Node | ... | @@ -253,7 +252,7 @@ pub fn flushModule(self: *SpirV, arena: Allocator, prog_node: *std.Progress.Node |
| 253 | const module = try spv.finalize(arena, target); | 252 | const module = try spv.finalize(arena, target); |
| 254 | errdefer arena.free(module); | 253 | errdefer arena.free(module); |
| 255 | 254 | ||
| 256 | const linked_module = self.linkModule(arena, module, &sub_prog_node) catch |err| switch (err) { | 255 | const linked_module = self.linkModule(arena, module, sub_prog_node) catch |err| switch (err) { |
| 257 | error.OutOfMemory => return error.OutOfMemory, | 256 | error.OutOfMemory => return error.OutOfMemory, |
| 258 | else => |other| { | 257 | else => |other| { |
| 259 | log.err("error while linking: {s}\n", .{@errorName(other)}); | 258 | log.err("error while linking: {s}\n", .{@errorName(other)}); |
| ... | @@ -264,7 +263,7 @@ pub fn flushModule(self: *SpirV, arena: Allocator, prog_node: *std.Progress.Node | ... | @@ -264,7 +263,7 @@ pub fn flushModule(self: *SpirV, arena: Allocator, prog_node: *std.Progress.Node |
| 264 | try self.base.file.?.writeAll(std.mem.sliceAsBytes(linked_module)); | 263 | try self.base.file.?.writeAll(std.mem.sliceAsBytes(linked_module)); |
| 265 | } | 264 | } |
| 266 | 265 | ||
| 267 | fn linkModule(self: *SpirV, a: Allocator, module: []Word, progress: *std.Progress.Node) ![]Word { | 266 | fn linkModule(self: *SpirV, a: Allocator, module: []Word, progress: std.Progress.Node) ![]Word { |
| 268 | _ = self; | 267 | _ = self; |
| 269 | 268 | ||
| 270 | const lower_invocation_globals = @import("SpirV/lower_invocation_globals.zig"); | 269 | const lower_invocation_globals = @import("SpirV/lower_invocation_globals.zig"); |
src/link/SpirV/deduplicate.zig+2-3| ... | @@ -418,9 +418,8 @@ const EntityHashContext = struct { | ... | @@ -418,9 +418,8 @@ const EntityHashContext = struct { |
| 418 | } | 418 | } |
| 419 | }; | 419 | }; |
| 420 | 420 | ||
| 421 | pub fn run(parser: *BinaryModule.Parser, binary: *BinaryModule, progress: *std.Progress.Node) !void { | 421 | pub fn run(parser: *BinaryModule.Parser, binary: *BinaryModule, progress: std.Progress.Node) !void { |
| 422 | var sub_node = progress.start("deduplicate", 0); | 422 | const sub_node = progress.start("deduplicate", 0); |
| 423 | sub_node.activate(); | ||
| 424 | defer sub_node.end(); | 423 | defer sub_node.end(); |
| 425 | 424 | ||
| 426 | var arena = std.heap.ArenaAllocator.init(parser.a); | 425 | var arena = std.heap.ArenaAllocator.init(parser.a); |
src/link/SpirV/lower_invocation_globals.zig+2-3| ... | @@ -682,9 +682,8 @@ const ModuleBuilder = struct { | ... | @@ -682,9 +682,8 @@ const ModuleBuilder = struct { |
| 682 | } | 682 | } |
| 683 | }; | 683 | }; |
| 684 | 684 | ||
| 685 | pub fn run(parser: *BinaryModule.Parser, binary: *BinaryModule, progress: *std.Progress.Node) !void { | 685 | pub fn run(parser: *BinaryModule.Parser, binary: *BinaryModule, progress: std.Progress.Node) !void { |
| 686 | var sub_node = progress.start("Lower invocation globals", 6); | 686 | const sub_node = progress.start("Lower invocation globals", 6); |
| 687 | sub_node.activate(); | ||
| 688 | defer sub_node.end(); | 687 | defer sub_node.end(); |
| 689 | 688 | ||
| 690 | var arena = std.heap.ArenaAllocator.init(parser.a); | 689 | var arena = std.heap.ArenaAllocator.init(parser.a); |
src/link/SpirV/prune_unused.zig+2-3| ... | @@ -255,9 +255,8 @@ fn removeIdsFromMap(a: Allocator, map: anytype, info: ModuleInfo, alive_marker: | ... | @@ -255,9 +255,8 @@ fn removeIdsFromMap(a: Allocator, map: anytype, info: ModuleInfo, alive_marker: |
| 255 | } | 255 | } |
| 256 | } | 256 | } |
| 257 | 257 | ||
| 258 | pub fn run(parser: *BinaryModule.Parser, binary: *BinaryModule, progress: *std.Progress.Node) !void { | 258 | pub fn run(parser: *BinaryModule.Parser, binary: *BinaryModule, progress: std.Progress.Node) !void { |
| 259 | var sub_node = progress.start("Prune unused IDs", 0); | 259 | const sub_node = progress.start("Prune unused IDs", 0); |
| 260 | sub_node.activate(); | ||
| 261 | defer sub_node.end(); | 260 | defer sub_node.end(); |
| 262 | 261 | ||
| 263 | var arena = std.heap.ArenaAllocator.init(parser.a); | 262 | var arena = std.heap.ArenaAllocator.init(parser.a); |
src/link/Wasm.zig+5-8| ... | @@ -2464,7 +2464,7 @@ fn appendDummySegment(wasm: *Wasm) !void { | ... | @@ -2464,7 +2464,7 @@ fn appendDummySegment(wasm: *Wasm) !void { |
| 2464 | }); | 2464 | }); |
| 2465 | } | 2465 | } |
| 2466 | 2466 | ||
| 2467 | pub fn flush(wasm: *Wasm, arena: Allocator, prog_node: *std.Progress.Node) link.File.FlushError!void { | 2467 | pub fn flush(wasm: *Wasm, arena: Allocator, prog_node: std.Progress.Node) link.File.FlushError!void { |
| 2468 | const comp = wasm.base.comp; | 2468 | const comp = wasm.base.comp; |
| 2469 | const use_lld = build_options.have_llvm and comp.config.use_lld; | 2469 | const use_lld = build_options.have_llvm and comp.config.use_lld; |
| 2470 | 2470 | ||
| ... | @@ -2475,7 +2475,7 @@ pub fn flush(wasm: *Wasm, arena: Allocator, prog_node: *std.Progress.Node) link. | ... | @@ -2475,7 +2475,7 @@ pub fn flush(wasm: *Wasm, arena: Allocator, prog_node: *std.Progress.Node) link. |
| 2475 | } | 2475 | } |
| 2476 | 2476 | ||
| 2477 | /// Uses the in-house linker to link one or multiple object -and archive files into a WebAssembly binary. | 2477 | /// Uses the in-house linker to link one or multiple object -and archive files into a WebAssembly binary. |
| 2478 | pub fn flushModule(wasm: *Wasm, arena: Allocator, prog_node: *std.Progress.Node) link.File.FlushError!void { | 2478 | pub fn flushModule(wasm: *Wasm, arena: Allocator, prog_node: std.Progress.Node) link.File.FlushError!void { |
| 2479 | const tracy = trace(@src()); | 2479 | const tracy = trace(@src()); |
| 2480 | defer tracy.end(); | 2480 | defer tracy.end(); |
| 2481 | 2481 | ||
| ... | @@ -2486,8 +2486,7 @@ pub fn flushModule(wasm: *Wasm, arena: Allocator, prog_node: *std.Progress.Node) | ... | @@ -2486,8 +2486,7 @@ pub fn flushModule(wasm: *Wasm, arena: Allocator, prog_node: *std.Progress.Node) |
| 2486 | if (use_lld) return; | 2486 | if (use_lld) return; |
| 2487 | } | 2487 | } |
| 2488 | 2488 | ||
| 2489 | var sub_prog_node = prog_node.start("Wasm Flush", 0); | 2489 | const sub_prog_node = prog_node.start("Wasm Flush", 0); |
| 2490 | sub_prog_node.activate(); | ||
| 2491 | defer sub_prog_node.end(); | 2490 | defer sub_prog_node.end(); |
| 2492 | 2491 | ||
| 2493 | const directory = wasm.base.emit.directory; // Just an alias to make it shorter to type. | 2492 | const directory = wasm.base.emit.directory; // Just an alias to make it shorter to type. |
| ... | @@ -3323,7 +3322,7 @@ fn emitImport(wasm: *Wasm, writer: anytype, import: types.Import) !void { | ... | @@ -3323,7 +3322,7 @@ fn emitImport(wasm: *Wasm, writer: anytype, import: types.Import) !void { |
| 3323 | } | 3322 | } |
| 3324 | } | 3323 | } |
| 3325 | 3324 | ||
| 3326 | fn linkWithLLD(wasm: *Wasm, arena: Allocator, prog_node: *std.Progress.Node) !void { | 3325 | fn linkWithLLD(wasm: *Wasm, arena: Allocator, prog_node: std.Progress.Node) !void { |
| 3327 | const tracy = trace(@src()); | 3326 | const tracy = trace(@src()); |
| 3328 | defer tracy.end(); | 3327 | defer tracy.end(); |
| 3329 | 3328 | ||
| ... | @@ -3350,9 +3349,7 @@ fn linkWithLLD(wasm: *Wasm, arena: Allocator, prog_node: *std.Progress.Node) !vo | ... | @@ -3350,9 +3349,7 @@ fn linkWithLLD(wasm: *Wasm, arena: Allocator, prog_node: *std.Progress.Node) !vo |
| 3350 | } | 3349 | } |
| 3351 | } else null; | 3350 | } else null; |
| 3352 | 3351 | ||
| 3353 | var sub_prog_node = prog_node.start("LLD Link", 0); | 3352 | const sub_prog_node = prog_node.start("LLD Link", 0); |
| 3354 | sub_prog_node.activate(); | ||
| 3355 | sub_prog_node.context.refresh(); | ||
| 3356 | defer sub_prog_node.end(); | 3353 | defer sub_prog_node.end(); |
| 3357 | 3354 | ||
| 3358 | const is_obj = comp.config.output_mode == .Obj; | 3355 | const is_obj = comp.config.output_mode == .Obj; |
src/main.zig+15-135| ... | @@ -4028,22 +4028,7 @@ fn serve( | ... | @@ -4028,22 +4028,7 @@ fn serve( |
| 4028 | 4028 | ||
| 4029 | var child_pid: ?std.process.Child.Id = null; | 4029 | var child_pid: ?std.process.Child.Id = null; |
| 4030 | 4030 | ||
| 4031 | var progress: std.Progress = .{ | 4031 | const main_progress_node = std.Progress.start(.{}); |
| 4032 | .terminal = null, | ||
| 4033 | .root = .{ | ||
| 4034 | .context = undefined, | ||
| 4035 | .parent = null, | ||
| 4036 | .name = "", | ||
| 4037 | .unprotected_estimated_total_items = 0, | ||
| 4038 | .unprotected_completed_items = 0, | ||
| 4039 | }, | ||
| 4040 | .columns_written = 0, | ||
| 4041 | .prev_refresh_timestamp = 0, | ||
| 4042 | .timer = null, | ||
| 4043 | .done = false, | ||
| 4044 | }; | ||
| 4045 | const main_progress_node = &progress.root; | ||
| 4046 | main_progress_node.context = &progress; | ||
| 4047 | 4032 | ||
| 4048 | while (true) { | 4033 | while (true) { |
| 4049 | const hdr = try server.receiveMessage(); | 4034 | const hdr = try server.receiveMessage(); |
| ... | @@ -4051,7 +4036,6 @@ fn serve( | ... | @@ -4051,7 +4036,6 @@ fn serve( |
| 4051 | switch (hdr.tag) { | 4036 | switch (hdr.tag) { |
| 4052 | .exit => return cleanExit(), | 4037 | .exit => return cleanExit(), |
| 4053 | .update => { | 4038 | .update => { |
| 4054 | assert(main_progress_node.recently_updated_child == null); | ||
| 4055 | tracy.frameMark(); | 4039 | tracy.frameMark(); |
| 4056 | 4040 | ||
| 4057 | if (arg_mode == .translate_c) { | 4041 | if (arg_mode == .translate_c) { |
| ... | @@ -4075,21 +4059,7 @@ fn serve( | ... | @@ -4075,21 +4059,7 @@ fn serve( |
| 4075 | try comp.makeBinFileWritable(); | 4059 | try comp.makeBinFileWritable(); |
| 4076 | } | 4060 | } |
| 4077 | 4061 | ||
| 4078 | if (builtin.single_threaded) { | 4062 | try comp.update(main_progress_node); |
| 4079 | try comp.update(main_progress_node); | ||
| 4080 | } else { | ||
| 4081 | var reset: std.Thread.ResetEvent = .{}; | ||
| 4082 | |||
| 4083 | var progress_thread = try std.Thread.spawn(.{}, progressThread, .{ | ||
| 4084 | &progress, &server, &reset, | ||
| 4085 | }); | ||
| 4086 | defer { | ||
| 4087 | reset.set(); | ||
| 4088 | progress_thread.join(); | ||
| 4089 | } | ||
| 4090 | |||
| 4091 | try comp.update(main_progress_node); | ||
| 4092 | } | ||
| 4093 | 4063 | ||
| 4094 | try comp.makeBinFileExecutable(); | 4064 | try comp.makeBinFileExecutable(); |
| 4095 | try serveUpdateResults(&server, comp); | 4065 | try serveUpdateResults(&server, comp); |
| ... | @@ -4116,7 +4086,6 @@ fn serve( | ... | @@ -4116,7 +4086,6 @@ fn serve( |
| 4116 | }, | 4086 | }, |
| 4117 | .hot_update => { | 4087 | .hot_update => { |
| 4118 | tracy.frameMark(); | 4088 | tracy.frameMark(); |
| 4119 | assert(main_progress_node.recently_updated_child == null); | ||
| 4120 | if (child_pid) |pid| { | 4089 | if (child_pid) |pid| { |
| 4121 | try comp.hotCodeSwap(main_progress_node, pid); | 4090 | try comp.hotCodeSwap(main_progress_node, pid); |
| 4122 | try serveUpdateResults(&server, comp); | 4091 | try serveUpdateResults(&server, comp); |
| ... | @@ -4146,63 +4115,6 @@ fn serve( | ... | @@ -4146,63 +4115,6 @@ fn serve( |
| 4146 | } | 4115 | } |
| 4147 | } | 4116 | } |
| 4148 | 4117 | ||
| 4149 | fn progressThread(progress: *std.Progress, server: *const Server, reset: *std.Thread.ResetEvent) void { | ||
| 4150 | while (true) { | ||
| 4151 | if (reset.timedWait(500 * std.time.ns_per_ms)) |_| { | ||
| 4152 | // The Compilation update has completed. | ||
| 4153 | return; | ||
| 4154 | } else |err| switch (err) { | ||
| 4155 | error.Timeout => {}, | ||
| 4156 | } | ||
| 4157 | |||
| 4158 | var buf: std.BoundedArray(u8, 160) = .{}; | ||
| 4159 | |||
| 4160 | { | ||
| 4161 | progress.update_mutex.lock(); | ||
| 4162 | defer progress.update_mutex.unlock(); | ||
| 4163 | |||
| 4164 | var need_ellipse = false; | ||
| 4165 | var maybe_node: ?*std.Progress.Node = &progress.root; | ||
| 4166 | while (maybe_node) |node| { | ||
| 4167 | if (need_ellipse) { | ||
| 4168 | buf.appendSlice("... ") catch {}; | ||
| 4169 | } | ||
| 4170 | need_ellipse = false; | ||
| 4171 | const eti = @atomicLoad(usize, &node.unprotected_estimated_total_items, .monotonic); | ||
| 4172 | const completed_items = @atomicLoad(usize, &node.unprotected_completed_items, .monotonic); | ||
| 4173 | const current_item = completed_items + 1; | ||
| 4174 | if (node.name.len != 0 or eti > 0) { | ||
| 4175 | if (node.name.len != 0) { | ||
| 4176 | buf.appendSlice(node.name) catch {}; | ||
| 4177 | need_ellipse = true; | ||
| 4178 | } | ||
| 4179 | if (eti > 0) { | ||
| 4180 | if (need_ellipse) buf.appendSlice(" ") catch {}; | ||
| 4181 | buf.writer().print("[{d}/{d}] ", .{ current_item, eti }) catch {}; | ||
| 4182 | need_ellipse = false; | ||
| 4183 | } else if (completed_items != 0) { | ||
| 4184 | if (need_ellipse) buf.appendSlice(" ") catch {}; | ||
| 4185 | buf.writer().print("[{d}] ", .{current_item}) catch {}; | ||
| 4186 | need_ellipse = false; | ||
| 4187 | } | ||
| 4188 | } | ||
| 4189 | maybe_node = @atomicLoad(?*std.Progress.Node, &node.recently_updated_child, .acquire); | ||
| 4190 | } | ||
| 4191 | } | ||
| 4192 | |||
| 4193 | const progress_string = buf.slice(); | ||
| 4194 | |||
| 4195 | server.serveMessage(.{ | ||
| 4196 | .tag = .progress, | ||
| 4197 | .bytes_len = @as(u32, @intCast(progress_string.len)), | ||
| 4198 | }, &.{ | ||
| 4199 | progress_string, | ||
| 4200 | }) catch |err| { | ||
| 4201 | fatal("unable to write to client: {s}", .{@errorName(err)}); | ||
| 4202 | }; | ||
| 4203 | } | ||
| 4204 | } | ||
| 4205 | |||
| 4206 | fn serveUpdateResults(s: *Server, comp: *Compilation) !void { | 4118 | fn serveUpdateResults(s: *Server, comp: *Compilation) !void { |
| 4207 | const gpa = comp.gpa; | 4119 | const gpa = comp.gpa; |
| 4208 | var error_bundle = try comp.getAllErrorsAlloc(); | 4120 | var error_bundle = try comp.getAllErrorsAlloc(); |
| ... | @@ -4472,19 +4384,10 @@ fn runOrTestHotSwap( | ... | @@ -4472,19 +4384,10 @@ fn runOrTestHotSwap( |
| 4472 | fn updateModule(comp: *Compilation, color: Color) !void { | 4384 | fn updateModule(comp: *Compilation, color: Color) !void { |
| 4473 | { | 4385 | { |
| 4474 | // If the terminal is dumb, we dont want to show the user all the output. | 4386 | // If the terminal is dumb, we dont want to show the user all the output. |
| 4475 | var progress: std.Progress = .{ .dont_print_on_dumb = true }; | 4387 | const main_progress_node = std.Progress.start(.{ |
| 4476 | const main_progress_node = progress.start("", 0); | 4388 | .disable_printing = color == .off, |
| 4389 | }); | ||
| 4477 | defer main_progress_node.end(); | 4390 | defer main_progress_node.end(); |
| 4478 | switch (color) { | ||
| 4479 | .off => { | ||
| 4480 | progress.terminal = null; | ||
| 4481 | }, | ||
| 4482 | .on => { | ||
| 4483 | progress.terminal = std.io.getStdErr(); | ||
| 4484 | progress.supports_ansi_escape_codes = true; | ||
| 4485 | }, | ||
| 4486 | .auto => {}, | ||
| 4487 | } | ||
| 4488 | 4391 | ||
| 4489 | try comp.update(main_progress_node); | 4392 | try comp.update(main_progress_node); |
| 4490 | } | 4393 | } |
| ... | @@ -4736,8 +4639,6 @@ const usage_build = | ... | @@ -4736,8 +4639,6 @@ const usage_build = |
| 4736 | ; | 4639 | ; |
| 4737 | 4640 | ||
| 4738 | fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !void { | 4641 | fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !void { |
| 4739 | var progress: std.Progress = .{ .dont_print_on_dumb = true }; | ||
| 4740 | |||
| 4741 | var build_file: ?[]const u8 = null; | 4642 | var build_file: ?[]const u8 = null; |
| 4742 | var override_lib_dir: ?[]const u8 = try EnvVar.ZIG_LIB_DIR.get(arena); | 4643 | var override_lib_dir: ?[]const u8 = try EnvVar.ZIG_LIB_DIR.get(arena); |
| 4743 | var override_global_cache_dir: ?[]const u8 = try EnvVar.ZIG_GLOBAL_CACHE_DIR.get(arena); | 4644 | var override_global_cache_dir: ?[]const u8 = try EnvVar.ZIG_GLOBAL_CACHE_DIR.get(arena); |
| ... | @@ -5051,7 +4952,9 @@ fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !void { | ... | @@ -5051,7 +4952,9 @@ fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !void { |
| 5051 | config, | 4952 | config, |
| 5052 | ); | 4953 | ); |
| 5053 | } else { | 4954 | } else { |
| 5054 | const root_prog_node = progress.start("Fetch Packages", 0); | 4955 | const root_prog_node = std.Progress.start(.{ |
| 4956 | .root_name = "Fetch Packages", | ||
| 4957 | }); | ||
| 5055 | defer root_prog_node.end(); | 4958 | defer root_prog_node.end(); |
| 5056 | 4959 | ||
| 5057 | var job_queue: Package.Fetch.JobQueue = .{ | 4960 | var job_queue: Package.Fetch.JobQueue = .{ |
| ... | @@ -5473,38 +5376,14 @@ fn jitCmd( | ... | @@ -5473,38 +5376,14 @@ fn jitCmd( |
| 5473 | }; | 5376 | }; |
| 5474 | defer comp.destroy(); | 5377 | defer comp.destroy(); |
| 5475 | 5378 | ||
| 5476 | if (options.server and !builtin.single_threaded) { | 5379 | if (options.server) { |
| 5477 | var reset: std.Thread.ResetEvent = .{}; | 5380 | const main_progress_node = std.Progress.start(.{}); |
| 5478 | var progress: std.Progress = .{ | ||
| 5479 | .terminal = null, | ||
| 5480 | .root = .{ | ||
| 5481 | .context = undefined, | ||
| 5482 | .parent = null, | ||
| 5483 | .name = "", | ||
| 5484 | .unprotected_estimated_total_items = 0, | ||
| 5485 | .unprotected_completed_items = 0, | ||
| 5486 | }, | ||
| 5487 | .columns_written = 0, | ||
| 5488 | .prev_refresh_timestamp = 0, | ||
| 5489 | .timer = null, | ||
| 5490 | .done = false, | ||
| 5491 | }; | ||
| 5492 | const main_progress_node = &progress.root; | ||
| 5493 | main_progress_node.context = &progress; | ||
| 5494 | var server = std.zig.Server{ | 5381 | var server = std.zig.Server{ |
| 5495 | .out = std.io.getStdOut(), | 5382 | .out = std.io.getStdOut(), |
| 5496 | .in = undefined, // won't be receiving messages | 5383 | .in = undefined, // won't be receiving messages |
| 5497 | .receive_fifo = undefined, // won't be receiving messages | 5384 | .receive_fifo = undefined, // won't be receiving messages |
| 5498 | }; | 5385 | }; |
| 5499 | 5386 | ||
| 5500 | var progress_thread = try std.Thread.spawn(.{}, progressThread, .{ | ||
| 5501 | &progress, &server, &reset, | ||
| 5502 | }); | ||
| 5503 | defer { | ||
| 5504 | reset.set(); | ||
| 5505 | progress_thread.join(); | ||
| 5506 | } | ||
| 5507 | |||
| 5508 | try comp.update(main_progress_node); | 5387 | try comp.update(main_progress_node); |
| 5509 | 5388 | ||
| 5510 | var error_bundle = try comp.getAllErrorsAlloc(); | 5389 | var error_bundle = try comp.getAllErrorsAlloc(); |
| ... | @@ -6963,8 +6842,9 @@ fn cmdFetch( | ... | @@ -6963,8 +6842,9 @@ fn cmdFetch( |
| 6963 | 6842 | ||
| 6964 | try http_client.initDefaultProxies(arena); | 6843 | try http_client.initDefaultProxies(arena); |
| 6965 | 6844 | ||
| 6966 | var progress: std.Progress = .{ .dont_print_on_dumb = true }; | 6845 | var root_prog_node = std.Progress.start(.{ |
| 6967 | const root_prog_node = progress.start("Fetch", 0); | 6846 | .root_name = "Fetch", |
| 6847 | }); | ||
| 6968 | defer root_prog_node.end(); | 6848 | defer root_prog_node.end(); |
| 6969 | 6849 | ||
| 6970 | var global_cache_directory: Compilation.Directory = l: { | 6850 | var global_cache_directory: Compilation.Directory = l: { |
| ... | @@ -7028,8 +6908,8 @@ fn cmdFetch( | ... | @@ -7028,8 +6908,8 @@ fn cmdFetch( |
| 7028 | 6908 | ||
| 7029 | const hex_digest = Package.Manifest.hexDigest(fetch.actual_hash); | 6909 | const hex_digest = Package.Manifest.hexDigest(fetch.actual_hash); |
| 7030 | 6910 | ||
| 7031 | progress.done = true; | 6911 | root_prog_node.end(); |
| 7032 | progress.refresh(); | 6912 | root_prog_node = .{ .index = .none }; |
| 7033 | 6913 | ||
| 7034 | const name = switch (save) { | 6914 | const name = switch (save) { |
| 7035 | .no => { | 6915 | .no => { |
src/mingw.zig+3-3| ... | @@ -16,7 +16,7 @@ pub const CRTFile = enum { | ... | @@ -16,7 +16,7 @@ pub const CRTFile = enum { |
| 16 | mingw32_lib, | 16 | mingw32_lib, |
| 17 | }; | 17 | }; |
| 18 | 18 | ||
| 19 | pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progress.Node) !void { | 19 | pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: std.Progress.Node) !void { |
| 20 | if (!build_options.have_llvm) { | 20 | if (!build_options.have_llvm) { |
| 21 | return error.ZigCompilerNotBuiltWithLLVMExtensions; | 21 | return error.ZigCompilerNotBuiltWithLLVMExtensions; |
| 22 | } | 22 | } |
| ... | @@ -234,8 +234,8 @@ pub fn buildImportLib(comp: *Compilation, lib_name: []const u8) !void { | ... | @@ -234,8 +234,8 @@ pub fn buildImportLib(comp: *Compilation, lib_name: []const u8) !void { |
| 234 | const include_dir = try comp.zig_lib_directory.join(arena, &[_][]const u8{ "libc", "mingw", "def-include" }); | 234 | const include_dir = try comp.zig_lib_directory.join(arena, &[_][]const u8{ "libc", "mingw", "def-include" }); |
| 235 | 235 | ||
| 236 | if (comp.verbose_cc) print: { | 236 | if (comp.verbose_cc) print: { |
| 237 | std.debug.getStderrMutex().lock(); | 237 | std.debug.lockStdErr(); |
| 238 | defer std.debug.getStderrMutex().unlock(); | 238 | defer std.debug.unlockStdErr(); |
| 239 | const stderr = std.io.getStdErr().writer(); | 239 | const stderr = std.io.getStdErr().writer(); |
| 240 | nosuspend stderr.print("def file: {s}\n", .{def_file_path}) catch break :print; | 240 | nosuspend stderr.print("def file: {s}\n", .{def_file_path}) catch break :print; |
| 241 | nosuspend stderr.print("include dir: {s}\n", .{include_dir}) catch break :print; | 241 | nosuspend stderr.print("include dir: {s}\n", .{include_dir}) catch break :print; |
src/musl.zig+1-1| ... | @@ -19,7 +19,7 @@ pub const CRTFile = enum { | ... | @@ -19,7 +19,7 @@ pub const CRTFile = enum { |
| 19 | libc_so, | 19 | libc_so, |
| 20 | }; | 20 | }; |
| 21 | 21 | ||
| 22 | pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progress.Node) !void { | 22 | pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: std.Progress.Node) !void { |
| 23 | if (!build_options.have_llvm) { | 23 | if (!build_options.have_llvm) { |
| 24 | return error.ZigCompilerNotBuiltWithLLVMExtensions; | 24 | return error.ZigCompilerNotBuiltWithLLVMExtensions; |
| 25 | } | 25 | } |
src/wasi_libc.zig+1-1| ... | @@ -57,7 +57,7 @@ pub fn execModelCrtFileFullName(wasi_exec_model: std.builtin.WasiExecModel) []co | ... | @@ -57,7 +57,7 @@ pub fn execModelCrtFileFullName(wasi_exec_model: std.builtin.WasiExecModel) []co |
| 57 | }; | 57 | }; |
| 58 | } | 58 | } |
| 59 | 59 | ||
| 60 | pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progress.Node) !void { | 60 | pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: std.Progress.Node) !void { |
| 61 | if (!build_options.have_llvm) { | 61 | if (!build_options.have_llvm) { |
| 62 | return error.ZigCompilerNotBuiltWithLLVMExtensions; | 62 | return error.ZigCompilerNotBuiltWithLLVMExtensions; |
| 63 | } | 63 | } |
test/standalone/cmakedefine/build.zig+1-1| ... | @@ -80,7 +80,7 @@ pub fn build(b: *std.Build) void { | ... | @@ -80,7 +80,7 @@ pub fn build(b: *std.Build) void { |
| 80 | test_step.dependOn(&wrapper_header.step); | 80 | test_step.dependOn(&wrapper_header.step); |
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | fn compare_headers(step: *std.Build.Step, prog_node: *std.Progress.Node) !void { | 83 | fn compare_headers(step: *std.Build.Step, prog_node: std.Progress.Node) !void { |
| 84 | _ = prog_node; | 84 | _ = prog_node; |
| 85 | const allocator = step.owner.allocator; | 85 | const allocator = step.owner.allocator; |
| 86 | const expected_fmt = "expected_{s}"; | 86 | const expected_fmt = "expected_{s}"; |