From ea7e751750c7387b300613a15df25748058bbaf8 Mon Sep 17 00:00:00 2001 From: chriseth Date: Mon, 4 May 2020 15:05:14 +0200 Subject: [PATCH] Documentation. --- docs/yul.rst | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/docs/yul.rst b/docs/yul.rst index 2fcae1175..6e8654ff5 100644 --- a/docs/yul.rst +++ b/docs/yul.rst @@ -885,13 +885,6 @@ the ``dup`` and ``swap`` instructions as well as ``jump`` instructions, labels a | gaslimit() | | F | block gas limit of the current block | +-------------------------+-----+---+-----------------------------------------------------------------+ -There are three additional functions, ``datasize(x)``, ``dataoffset(x)`` and ``datacopy(t, f, l)``, -which are used to access other parts of a Yul object. - -``datasize`` and ``dataoffset`` can only take string literals (the names of other objects) -as arguments and return the size and offset in the data area, respectively. -For the EVM, the ``datacopy`` function is equivalent to ``codecopy``. - .. _yul-call-return-area: .. note:: @@ -903,6 +896,32 @@ For the EVM, the ``datacopy`` function is equivalent to ``codecopy``. The remaining bytes will retain their values as of before the call. If the call fails (it returns ``0``), nothing is written to that area, but you can still retrieve the failure data using ``returndatacopy``. + +In some internal dialects, there are additional functions: + +datasize, dataoffset, datacopy +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The functions ``datasize(x)``, ``dataoffset(x)`` and ``datacopy(t, f, l)``, +are used to access other parts of a Yul object. + +``datasize`` and ``dataoffset`` can only take string literals (the names of other objects) +as arguments and return the size and offset in the data area, respectively. +For the EVM, the ``datacopy`` function is equivalent to ``codecopy``. + + +setimmutable, loadimmutable +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The functions ``setimmutable("name", value)`` and ``loadimmutable("name")`` are +used for the immutable mechanism in Solidity and do not nicely map to pur Yul. +The function ``setimmutable`` assumes that the runtime code of a contract +is currently copied to memory at offsot zero. The call to ``setimmutable("name", value)`` +will store ``value`` at all points in memory that contain a call to +``loadimmutable("name")``. + + + .. _yul-object: Specification of Yul Object