mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Updated yul.rst with feedback.
Updated yul.rst with explanation of 0x60 pointer choice.
This commit is contained in:
parent
6439955e83
commit
60d513c484
@ -1162,7 +1162,8 @@ An example Yul Object is shown below:
|
|||||||
code {
|
code {
|
||||||
function allocate(size) -> ptr {
|
function allocate(size) -> ptr {
|
||||||
ptr := mload(0x40)
|
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))
|
mstore(0x40, add(ptr, size))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1191,6 +1192,7 @@ An example Yul Object is shown below:
|
|||||||
code {
|
code {
|
||||||
function allocate(size) -> ptr {
|
function allocate(size) -> ptr {
|
||||||
ptr := mload(0x40)
|
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 }
|
if iszero(ptr) { ptr := 0x60 }
|
||||||
mstore(0x40, add(ptr, size))
|
mstore(0x40, add(ptr, size))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user