Temporary variables that are stored in memory during compilation will start at an offset of 2^31. This is to avoid conflicts in memory addresses between mload/mstore and variables stored in memory during intermediate operations. Practically, this means that only memory space below 2^31 can be used for non-variable purposes (like a hash). However, variables stored in memory to avoid the EVM's stack too deep will be stored beyond 2^31.
The following opcodes will not be allowed to reach Memory locations beyond 2^31 or reference beyond that address. EXTCODECOPY, RETURNDATACOPY, CALLDATACOPY, SHA3, and CODECOPY.
Lets run this one by the Miden team and see if they have any thoughts on this. With the recent changes to the VM there might be a preferred way to implement this.
MLOAD/MSTORE Separation
Temporary variables that are stored in memory during compilation will start at an offset of 2^31. This is to avoid conflicts in memory addresses between
mload
/mstore
and variables stored in memory during intermediate operations. Practically, this means that only memory space below 2^31 can be used for non-variable purposes (like a hash). However, variables stored in memory to avoid the EVM's stack too deep will be stored beyond 2^31.The following opcodes will not be allowed to reach Memory locations beyond 2^31 or reference beyond that address. EXTCODECOPY, RETURNDATACOPY, CALLDATACOPY, SHA3, and CODECOPY.