| ... | @@ -51,17 +51,6 @@ pub const std_options: std.Options = .{ | ... | @@ -51,17 +51,6 @@ pub const std_options: std.Options = .{ |
| 51 | }, | 51 | }, |
| 52 | }; | 52 | }; |
| 53 | pub const std_options_cwd = if (native_os == .wasi) wasi_cwd else null; | 53 | pub const std_options_cwd = if (native_os == .wasi) wasi_cwd else null; |
| 54 | pub 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 | }; | | |
| 61 | pub const std_options_debug_io: Io = switch (build_options.io_mode) { | | |
| 62 | .threaded => io_impl.ioBasic(), | | |
| 63 | .evented => io_impl.io(), | | |
| 64 | }; | | |
| 65 | | 54 | |
| 66 | pub const debug = struct { | 55 | pub const debug = struct { |
| 67 | pub fn printCrashContext(terminal: Io.Terminal) void { | 56 | pub fn printCrashContext(terminal: Io.Terminal) void { |
| ... | @@ -200,6 +189,7 @@ pub fn main(init: std.process.Init.Minimal) anyerror!void { | ... | @@ -200,6 +189,7 @@ pub fn main(init: std.process.Init.Minimal) anyerror!void { |
| 200 | var root_allocator: RootAllocator = .init; | 189 | var root_allocator: RootAllocator = .init; |
| 201 | defer _ = root_allocator.deinit(); | 190 | defer _ = root_allocator.deinit(); |
| 202 | const root_gpa = root_allocator.allocator(); | 191 | const root_gpa = root_allocator.allocator(); |
| | 192 | var io_impl: IoImpl = undefined; |
| 203 | switch (build_options.io_mode) { | 193 | switch (build_options.io_mode) { |
| 204 | .threaded => io_impl = .init(root_gpa, .{ | 194 | .threaded => io_impl = .init(root_gpa, .{ |
| 205 | .stack_size = thread_stack_size, | 195 | .stack_size = thread_stack_size, |
| ... | @@ -215,6 +205,7 @@ pub fn main(init: std.process.Init.Minimal) anyerror!void { | ... | @@ -215,6 +205,7 @@ pub fn main(init: std.process.Init.Minimal) anyerror!void { |
| 215 | }), | 205 | }), |
| 216 | } | 206 | } |
| 217 | defer io_impl.deinit(); | 207 | defer io_impl.deinit(); |
| | 208 | io_impl_ptr = &io_impl; |
| 218 | const io = io_impl.io(); | 209 | const io = io_impl.io(); |
| 219 | const gpa = switch (build_options.io_mode) { | 210 | const gpa = switch (build_options.io_mode) { |
| 220 | .threaded => root_gpa, | 211 | .threaded => root_gpa, |
| ... | @@ -7824,7 +7815,7 @@ const IoImpl = switch (build_options.io_mode) { | ... | @@ -7824,7 +7815,7 @@ const IoImpl = switch (build_options.io_mode) { |
| 7824 | .threaded => Io.Threaded, | 7815 | .threaded => Io.Threaded, |
| 7825 | .evented => Io.Evented, | 7816 | .evented => Io.Evented, |
| 7826 | }; | 7817 | }; |
| 7827 | var io_impl: IoImpl = undefined; | 7818 | var io_impl_ptr: *IoImpl = undefined; |
| 7828 | fn setThreadLimit(arena: std.mem.Allocator, n: usize) Allocator.Error!void { | 7819 | fn setThreadLimit(arena: std.mem.Allocator, n: usize) Allocator.Error!void { |
| 7829 | switch (build_options.io_mode) { | 7820 | switch (build_options.io_mode) { |
| 7830 | .threaded => { | 7821 | .threaded => { |
| ... | @@ -7833,8 +7824,8 @@ fn setThreadLimit(arena: std.mem.Allocator, n: usize) Allocator.Error!void { | ... | @@ -7833,8 +7824,8 @@ fn setThreadLimit(arena: std.mem.Allocator, n: usize) Allocator.Error!void { |
| 7833 | // linker can run concurrently, so we need to set both the async *and* the | 7824 | // linker can run concurrently, so we need to set both the async *and* the |
| 7834 | // concurrency limit. | 7825 | // concurrency limit. |
| 7835 | const limit: Io.Limit = .limited(n - 1); | 7826 | const limit: Io.Limit = .limited(n - 1); |
| 7836 | io_impl.setAsyncLimit(limit); | 7827 | io_impl_ptr.setAsyncLimit(limit); |
| 7837 | io_impl.concurrent_limit = limit; | 7828 | io_impl_ptr.concurrent_limit = limit; |
| 7838 | }, | 7829 | }, |
| 7839 | .evented => {}, | 7830 | .evented => {}, |
| 7840 | } | 7831 | } |