Updated yul.rst with feedback.

Updated yul.rst with explanation of 0x60 pointer choice.
This commit is contained in:
Pranay 2022-08-13 18:39:46 +05:30 committed by GitHub
parent 6439955e83
commit 60d513c484
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1162,7 +1162,8 @@ An example Yul Object is shown below:
code {
function allocate(size) -> ptr {
ptr := mload(0x40)
if iszero(ptr) { ptr := 0x80 }
// Note that Solidity generated IR code reserves memory offset ``0x60`` as well, but a pure Yul object is free to use memory as it chooses.
if iszero(ptr) { ptr := 0x60 }
mstore(0x40, add(ptr, size))
}
@ -1191,6 +1192,7 @@ An example Yul Object is shown below:
code {
function allocate(size) -> ptr {
ptr := mload(0x40)
// Note that Solidity generated IR code reserves memory offset ``0x60`` as well, but a pure Yul object is free to use memory as it chooses.
if iszero(ptr) { ptr := 0x60 }
mstore(0x40, add(ptr, size))
}