From 67ca3bb4b9b43faadb1d6a07f868c94bae146c1e Mon Sep 17 00:00:00 2001 From: chriseth Date: Sun, 8 May 2016 16:24:47 +0200 Subject: Allow access to functions in inline assembly. --- docs/control-structures.rst | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'docs') diff --git a/docs/control-structures.rst b/docs/control-structures.rst index 2d959d1d..08bcb6ca 100644 --- a/docs/control-structures.rst +++ b/docs/control-structures.rst @@ -452,8 +452,8 @@ Note that the order of arguments is reversed in functional-style as opposed to t way. If you use functional-style, the first argument will end up on the stack top. -Access to External Variables ----------------------------- +Access to External Variables and Functions +------------------------------------------ Solidity variables and other identifiers can be accessed by simply using their name. For storage and memory variables, this will push the address and not the value onto the @@ -461,6 +461,17 @@ stack. Also note that non-struct and non-array storage variable addresses occupy on the stack: One for the address and one for the byte offset inside the storage slot. In assignments (see below), we can even use local Solidity variables to assign to. +Functions external to inline assembly can also be accessed: The assemble will +push their entry label (with virtual function resolution applied). The calling semantics +in solidity are: + + - the caller pushes return label, arg1, arg2, ..., argn + - the call returns with ret1, ret2, ..., retn + +This feature is still a bit cumbersome to use, because the stack offset essentially +changes during the call, and thus references to local variables will be wrong. +It is planned that the stack height changes can be specified in inline assembly. + .. code:: contract c { -- cgit v1.2.3 From e28604f0b021105b8e0863e485895f1009a77d37 Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 17 May 2016 17:05:03 +0200 Subject: Typo --- docs/control-structures.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/control-structures.rst b/docs/control-structures.rst index 08bcb6ca..9ce746ef 100644 --- a/docs/control-structures.rst +++ b/docs/control-structures.rst @@ -461,7 +461,7 @@ stack. Also note that non-struct and non-array storage variable addresses occupy on the stack: One for the address and one for the byte offset inside the storage slot. In assignments (see below), we can even use local Solidity variables to assign to. -Functions external to inline assembly can also be accessed: The assemble will +Functions external to inline assembly can also be accessed: The assembly will push their entry label (with virtual function resolution applied). The calling semantics in solidity are: -- cgit v1.2.3