ReviewOS

zig-utils/zig-js

WebAssembly tail calls: bounded execution frames and precise GC roots

#289
Closed chris opened this 9 days ago ·
9 days ago

Parent: #266\nDepends on: #288\nRoadmap: #142, #134\n\nExecute validated tail calls without growing the native or Wasm call stack.\n\nAcceptance:\n- [x] Reuse/replace interpreter frames for direct and indirect return calls instead of recursive host calls.\n- [x] Preserve argument/result conversion, traps, host imports, funcref identity, and indirect-table checks.\n- [x] Keep deep/mutual tail recursion stack bounded with explicit stress limits and watchdogs.\n- [x] Preserve precise GC visibility for parameters, locals, externref/funcref slots, host imports, and frame replacement at safepoints.\n- [x] Pass normal, leak, lifecycle, and focused sanitizer/TSan witnesses.

9 days ago

Completed in 512fe06 with documentation in 2d101ef. Direct and indirect return calls replace the active frame; imported tail calls retire it after exact signature checks. Evidence with exact CI Zig 0.17.0-dev.1417: 200,000 mutual tail calls remain within <=64 capacity for frames/labels/locals/operands; nested callers, all indirect trap arms, cross-instance defined/imported funcrefs, successful/trapping externref imports, and live externref/funcref root identities pass. Focused normal and TSan runs are 5/5 for wasm.exec tail plus 3/3 for the repeated public-API lifecycle witness, with zero failures, leaks, or reported races. Proposal-script scoring intentionally remains #292.

Sign in to comment on this issue.