mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-11-07 08:33:50 +08:00
Every emitted free loaded the runtime's dispose hook and branched on it, and every runtime array, map and byte-store free made an out-of-line call to scr_weak_dispose to do the same. The hook has two clients, weak collections and the kept sources of checked records, and a program that has neither never installs it. The emitted frees now test two module constants the emitter defines after every helper is emitted: whether the program constructs a WeakMap or WeakSet, and whether some helper can keep a record source (a checked record builder that notes one, or a JSON schema of a closed record). Class instances test the first, closed record layouts both; LLVM folds the test away, so a program without either frees with no hook load at all. The runtime's hot frees test the hook inline instead of calling. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>