mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-11-07 08:33:50 +08:00
A number-key write that follows a get or has of the same collection and key, inside its own arguments (m.set(k, (m.get(k) ?? 0) + 1)) or in the statement just before it, now looks the key up through the read-only sc_map_entry_f64 helper. A found entry takes the new scalar value in its slot (a Set entry already holds its unit value); a new key appends through the runtime set. LLVM merges that lookup with the read's when no store intervenes, so the write does not hash and probe the key again. Other writes, including those guarded by an absent key, keep the single runtime call, which finds the insertion bucket in the same probe. Reference values keep the runtime call, which releases the old value.