aboutsummaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2016-05-18 05:59:13 +0800
committerchriseth <c@ethdev.com>2016-05-18 05:59:13 +0800
commit775b757d0e2681901036fa34a67a3b5ceec24816 (patch)
tree47f4927e0a991492ea709a4e2523289082d950a4 /docs
parent5bf059dc2a1f82a0bf2e8fb9ab06439d01bf29f7 (diff)
parente28604f0b021105b8e0863e485895f1009a77d37 (diff)
downloaddexon-solidity-775b757d0e2681901036fa34a67a3b5ceec24816.tar.gz
dexon-solidity-775b757d0e2681901036fa34a67a3b5ceec24816.tar.zst
dexon-solidity-775b757d0e2681901036fa34a67a3b5ceec24816.zip
Merge pull request #545 from chriseth/accessFunLabels
Allow access to functions in inline assembly.
Diffstat (limited to 'docs')
-rw-r--r--docs/control-structures.rst15
1 files changed, 13 insertions, 2 deletions
diff --git a/docs/control-structures.rst b/docs/control-structures.rst
index 249b00b0..1bb0f71a 100644
--- a/docs/control-structures.rst
+++ b/docs/control-structures.rst
@@ -509,8 +509,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
@@ -518,6 +518,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 assembly 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 {