mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-26 06:34:20 +08:00
Integer induction counters live in unsigned 64-bit slots, so every read as a number was a uitofp i64 (a 6-7 instruction sequence on x86-64) and every nested start an fptoui. The runtime's push path also round-tripped the array length through a double for its bound check. The values are at most 2^32 - 1: on 64-bit targets convert counters with sitofp and loop starts with fptosi, convert array lengths and validated indices through int64_t in scr_array.c, and test the push bound on the integer length. 32-bit targets keep the unsigned conversions. tsc-ts Excalidraw: uitofp i64 sequences 32.5 M -> 4.0 M, -0.66% instructions on top of the throw-path change.