You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: io.zig trace state not thread-local; deterministic ghost trace events from std bootstrap; wire engine-api-test into CI
Three follow-ups to the engine C-API race fix:
1. io.zig's write/read overrides and trace state (write_override,
werr_override, read_override, g_trace_fn, g_trace_userdata,
g_trace_handle, g_trace_prev_line) had the same non-thread-local pattern
as engine.zig/host_abi.zig's already-fixed fields. Made all threadlocal.
2. The pre-existing "engine_set_trace_fn fires per source line" failure
was assumed to be order-dependent test pollution, but a debug print
showed the exact same {1, 7, 1, 2, 3} line sequence on every run --
fully deterministic, since engine.zig's native test runner
(tools/standalone_runner.zig) runs tests in fixed file order with no
shuffling. Root cause: vm.zig's dispatchTick fired a trace event for
every instruction while active, including the embedded std-library
bootstrap bytecode every program executes at startup (defining
std.array.count and friends as globals) regardless of whether the
script references std. The ghost 1 and 7 were two instructions from
that bootstrap's own function definition, using array.gengo's own line
numbers colliding with the user script's. Fixed by skipping trace
firing for ip < chunk_state.std_script_code_end.
3. engine-api-test (144 tests) was never wired into `zig build test`, so
it never ran in CI or the pre-push hook -- including the previous
commit's new concurrency regression test. Wired it into the main test
step. This surfaced two more tests with heap/object/stack/frame/defer
sizes hardcoded to the default preset, exceeding -Dpreset=stress's
tighter ceilings; both now scale to whatever ceiling
engine_init_with_config actually enforces.
Verified under standard, -Dpreset=stress, and -Dgc_stress=true builds,
each now including engine-api-test.
0 commit comments