mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-25 06:24:27 +08:00
main's emitPendingCheck (#785) already tests `scr_exc_active->kind` inline after every may-throw call in executables. The helper and adapter bodies the backend generates (dyn check helpers, async/generator trampolines, inline-async wrappers, FFI callback adapters, island and stream adapters, IPC message thunks, dynamic-key record stores) still called `scr_exc_pending()`, an opaque call into the prebuilt runtime, and so did every runtime C unit. On the tsc-ts self-check that function was about 4% of self time. Those sites now share pendingTestLines, which follows emitPendingCheck's policy: executables load the active cell and compare its i32 kind inline; libraries and worker programs keep the runtime call (workers also observe cross-thread termination there). Runtime units outside thread-instanced libraries and worker executables get the same inline test through a scr_runtime.h macro; the exported scr_exc_pending definition stays for those lanes and for emitted slow paths. A static assert pins the i32 kind at offset 0. This replays the work item's inline-check commit on top of #785: its own emitPendingCheck rewrite is dropped in favor of main's. Adds corpus 4431 pinning exception propagation across fiber switches, generators, sort/map callbacks, and runtime JSON failures.