mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-11-01 07:33:12 +08:00
The typed write slot, the drain probes and the run-time-typed chunk write all live in scr_events.c, a unit every program links. Unconditionally they changed the default object, so executables of programs that never touch the write slot changed byte for byte (three corpus programs differed runtime-only). Typed programs must stay byte-identical. Keep the default object exactly as it was and put the new code behind SCR_STDIO_WRITE_SLOT, the way SCR_STREAM_WRITE_ERRORS gates the stream unit: the shared write body, the run-time-typed chunk entry point and Node's anonymous write function exist only in that build, and scr_stdio_method keeps its own body everywhere else. The lowering sites that reach the slot (the write method as a value, its replacement, a patched program's typed writes) now emit a distinct marker lib call, process.stdioSlot, which is the same scr_process_stdio at run time. The feature scan turns it, together with process.stdioWriteDyn, into the stdioWriteSlot runtime feature, which selects the matching runtime pack variant and defines SCR_STDIO_WRITE_SLOT for the executable. The pack matrix enumerates the combinations with stdioExtended and nodeIsland explicitly, so each existing variant keeps its defines and its object. Both new lib fns join USES_TIMERS_LIB_FNS: the write callbacks they queue run from a nextTick, and a program whose only stdio use is the write slot would otherwise drop the callback. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>