diff options
Diffstat (limited to 'docs/assembly.rst')
-rw-r--r-- | docs/assembly.rst | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/docs/assembly.rst b/docs/assembly.rst index 90e70031..394fc9f5 100644 --- a/docs/assembly.rst +++ b/docs/assembly.rst @@ -234,9 +234,17 @@ In the grammar, opcodes are represented as pre-defined identifiers. +-------------------------+------+-----------------------------------------------------------------+ | extcodecopy(a, t, f, s) | `-` | like codecopy(t, f, s) but take code at address a | +-------------------------+------+-----------------------------------------------------------------+ +| returndatasize | | size of the last returndata | ++-------------------------+------+-----------------------------------------------------------------+ +| returndatacopy(t, f, s) | `-` | copy s bytes from returndata at position f to mem at position t | ++-------------------------+------+-----------------------------------------------------------------+ | create(v, p, s) | | create new contract with code mem[p..(p+s)) and send v wei | | | | and return the new address | +-------------------------+------+-----------------------------------------------------------------+ +| create2(v, n, p, s) | | create new contract with code mem[p..(p+s)) at address | +| | | keccak256(<address> . n . keccak256(mem[p..(p+s))) and send v | +| | | wei and return the new address | ++-------------------------+------+-----------------------------------------------------------------+ | call(g, a, v, in, | | call contract at address a with input mem[in..(in+insize)) | | insize, out, outsize) | | providing g gas and v wei and output area | | | | mem[out..(out+outsize)) returning 0 on error (eg. out of gas) | @@ -248,6 +256,9 @@ In the grammar, opcodes are represented as pre-defined identifiers. | delegatecall(g, a, in, | | identical to `callcode` but also keep ``caller`` | | insize, out, outsize) | | and ``callvalue`` | +-------------------------+------+-----------------------------------------------------------------+ +| staticcall(g, a, in, | | identical to `call(g, a, 0, in, insize, out, outsize)` but do | +| insize, out, outsize) | | not allow state modifications | ++-------------------------+------+-----------------------------------------------------------------+ | return(p, s) | `-` | end execution, return data mem[p..(p+s)) | +-------------------------+------+-----------------------------------------------------------------+ | revert(p, s) | `-` | end execution, revert state changes, return data mem[p..(p+s)) | @@ -314,8 +325,10 @@ would be written as follows mstore(0x80, add(mload(0x80), 3)) -Functional style and instructional style can be mixed, but any opcode inside a -functional style expression has to return exactly one stack slot (most of the opcodes do). +Functional style expressions cannot use instructional style internally, i.e. +``1 2 mstore(0x80, add)`` is not valid assembly, it has to be written as +``mstore(0x80, add(2, 1))``. For opcodes that do not take arguments, the +parentheses can be omitted. Note that the order of arguments is reversed in functional-style as opposed to the instruction-style way. If you use functional-style, the first argument will end up on the stack top. |