mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #13374 from 0xpranay/patch-2
Update the default free memory pointer in Yul.rst
This commit is contained in:
commit
a78a2bcf34
@ -1162,6 +1162,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))
|
||||||
}
|
}
|
||||||
@ -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