global: take minimal instead of juicy main

The early-stage main Zig wrapper recognizes if main only needs the
minimal state (args and lower-level environment) and skips a bunch of
unneeded initialization (allocator, arena, threaded I/O, and the
higher-level environment map). Particularly, the fact that it does not
set up an I/O instance means that we won't have any unneeded signal
handlers set up for the unused threaded I/O implementation, which is
similar in spirit to the fixes we applied for the C VT implementation,
with the notable difference that we do actually set a threaded I/O up in
global state - hence, again, we don't want the duplicate unused one.
This commit is contained in:
Chris Marchesi
2026-07-21 21:42:25 -07:00
parent da04b65d4c
commit 048619a6bf
3 changed files with 10 additions and 10 deletions

View File

@@ -45,12 +45,12 @@ pub const Action = enum {
};
/// An entrypoint for the benchmark CLI.
pub fn main(init: std.process.Init) !void {
try global.init(.{ .tool = init });
pub fn main(minimal: std.process.Init.Minimal) !void {
try global.init(.{ .tool = minimal });
const alloc = std.heap.c_allocator;
const action_ = try cli.action.detectArgs(Action, alloc, init.minimal.args);
const action_ = try cli.action.detectArgs(Action, alloc, minimal.args);
const action = action_ orelse return error.NoAction;
try mainAction(alloc, action, .{ .cli = init.minimal.args });
try mainAction(alloc, action, .{ .cli = minimal.args });
}
/// Arguments that can be passed to the benchmark.