From 60d513c484c332dc816dad5ba17bf5c4da207e6f Mon Sep 17 00:00:00 2001 From: Pranay Date: Sat, 13 Aug 2022 18:39:46 +0530 Subject: [PATCH] Updated yul.rst with feedback. Updated yul.rst with explanation of 0x60 pointer choice. --- docs/yul.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/yul.rst b/docs/yul.rst index 6156d9ad6..7ce010169 100644 --- a/docs/yul.rst +++ b/docs/yul.rst @@ -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)) }