mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-11-10 01:56:15 +08:00
Typedarray element stores could alias every header and module-global load, so each access reloaded the length, data pointer and global receiver slot and kept its own bounds branch. Element accesses now share one TBAA category (views of any element type may share a buffer), header loads another, and whole-slot loads of bytes/number globals their own, so LICM keeps them in registers. The data pointer loads beside the length, ahead of the branch. ScrBytes lengths and data pointers are fixed at construction, so innermost synchronous for loops whose accesses use a statically ranged index or an affine counter index (k * counter + invariant + c) are versioned: one test before the loop proves every access in bounds (bounding the counter so every affine operand stays an exact safe integer), and the copy behind it runs without per-element checks. The checked loop keeps exact out-of-bounds, NaN, fractional and DataView-throw behavior.