Skip to content
Monpediaby Unity Nodes
OpenPull Request

[vm] Clamp SIGNEXTEND and shift indices next to their reads

by brett-monadCreated Dec 4, 2026category-labs/monad

SIGNEXTEND of a stack slot or literal by a non-literal byte index, and SHL, SHR and SAR of a literal by a non-literal amount, read memory at an offset taken from that operand. The JIT now clamps the offset to its largest in-range value just before each read. This keeps every read inside the stack slot or constant it indexes and gives the correct result for any larger value, independently of the flag-based bounds check that runs earlier. Results are unchanged.

馃 Generated with Claude Code