mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-26 06:34:20 +08:00
In worker executables the small-object allocator state, the collector's live and old-freed counts and the weak dispose hook were four separate thread-locals, and every allocation or free touched them all. On Darwin each distinct thread-local costs a _tlv_get_addr call per function, so a runtime free made four such calls. They now share one ScrThreadHot block (macros keep the runtime sources unchanged; ordinary and library builds keep separate globals). The emitted inline paths address the fields at fixed offsets from a single llvm.threadlocal.address, which LLVM shares across a function. tsc-ts self-check, macOS, Worker build vs non-worker build: 1.12x -> 1.10x.