ControlCplusControlV / Scribe

Minimal Yul Transpilation to the Miden VM
GNU General Public License v3.0
51 stars 4 forks source link

MLOAD/MSTORE Separation #53

Open ControlCplusControlV opened 1 year ago

ControlCplusControlV commented 1 year ago

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.

0xKitsune commented 1 year ago

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.