Scribe icon indicating copy to clipboard operation
Scribe copied to clipboard

MLOAD/MSTORE Separation

Open ControlCplusControlV opened this issue 3 years ago • 2 comments

ControlCplusControlV avatar Dec 17 '22 22:12 ControlCplusControlV

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.

ControlCplusControlV avatar Dec 17 '22 22:12 ControlCplusControlV

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.

0xKitsune avatar Jan 21 '23 04:01 0xKitsune