authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-02-11 10:44:04-08:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-02-11 10:44:04-08:00
logba293eb820e5c2f62ac7a8ef623d8bffde3dc4f1
treead5be979154419f763694d242b16ea9a44bc8a59
parentd4217e21191d66fd62fed980a2429a6eddd7ca7a

Revert "compiler: override debug_io in release + evented mode"

This reverts commit 68403267117bf5cf73e0f747887f2834336ae4a2. The commit bungled deinitialization in main.

2 files changed, 6 insertions(+), 19 deletions(-)

lib/std/debug/ElfFile.zig+1-5
......@@ -86,11 +86,7 @@ pub const DebugInfoSearchPaths = struct {
8686 },
8787 .exe_dir = std.fs.path.dirname(exe_path) orelse ".",
8888 };
89 return .{
90 .debuginfod_client = null,
91 .global_debug = &.{"/usr/lib/debug"},
92 .exe_dir = std.fs.path.dirname(exe_path) orelse ".",
93 };
89 @compileError("std.Options.elf_debug_info_search_paths must be provided");
9490 }
9591};
9692
src/main.zig+5-14
......@@ -51,17 +51,6 @@ pub const std_options: std.Options = .{
5151 },
5252};
5353pub const std_options_cwd = if (native_os == .wasi) wasi_cwd else null;
54pub const std_options_debug_threaded_io: ?*Io.Threaded = switch (build_options.io_mode) {
55 .threaded => &io_impl,
56 .evented => switch (builtin.mode) {
57 .Debug => Io.Threaded.global_single_threaded,
58 .ReleaseFast, .ReleaseSmall, .ReleaseSafe => null,
59 },
60};
61pub const std_options_debug_io: Io = switch (build_options.io_mode) {
62 .threaded => io_impl.ioBasic(),
63 .evented => io_impl.io(),
64};
6554
6655pub const debug = struct {
6756 pub fn printCrashContext(terminal: Io.Terminal) void {
......@@ -200,6 +189,7 @@ pub fn main(init: std.process.Init.Minimal) anyerror!void {
200189 var root_allocator: RootAllocator = .init;
201190 defer _ = root_allocator.deinit();
202191 const root_gpa = root_allocator.allocator();
192 var io_impl: IoImpl = undefined;
203193 switch (build_options.io_mode) {
204194 .threaded => io_impl = .init(root_gpa, .{
205195 .stack_size = thread_stack_size,
......@@ -215,6 +205,7 @@ pub fn main(init: std.process.Init.Minimal) anyerror!void {
215205 }),
216206 }
217207 defer io_impl.deinit();
208 io_impl_ptr = &io_impl;
218209 const io = io_impl.io();
219210 const gpa = switch (build_options.io_mode) {
220211 .threaded => root_gpa,
......@@ -7824,7 +7815,7 @@ const IoImpl = switch (build_options.io_mode) {
78247815 .threaded => Io.Threaded,
78257816 .evented => Io.Evented,
78267817};
7827var io_impl: IoImpl = undefined;
7818var io_impl_ptr: *IoImpl = undefined;
78287819fn setThreadLimit(arena: std.mem.Allocator, n: usize) Allocator.Error!void {
78297820 switch (build_options.io_mode) {
78307821 .threaded => {
......@@ -7833,8 +7824,8 @@ fn setThreadLimit(arena: std.mem.Allocator, n: usize) Allocator.Error!void {
78337824 // linker can run concurrently, so we need to set both the async *and* the
78347825 // concurrency limit.
78357826 const limit: Io.Limit = .limited(n - 1);
7836 io_impl.setAsyncLimit(limit);
7837 io_impl.concurrent_limit = limit;
7827 io_impl_ptr.setAsyncLimit(limit);
7828 io_impl_ptr.concurrent_limit = limit;
78387829 },
78397830 .evented => {},
78407831 }