aboutsummaryrefslogtreecommitdiffstats
path: root/docs/miscellaneous.rst
diff options
context:
space:
mode:
authorDenton Liu <liu.denton+github@gmail.com>2016-08-12 04:50:53 +0800
committerDenton Liu <liu.denton+github@gmail.com>2016-08-24 23:43:55 +0800
commit02a72871d2200dd415fbb8c7488235495ff012c2 (patch)
treebd86cf6df89fd1fb9c7f66aebb9514cf96bf143b /docs/miscellaneous.rst
parentac799aff0e237fe0e6c4246e36c39cc1fe3c116d (diff)
downloaddexon-solidity-02a72871d2200dd415fbb8c7488235495ff012c2.tar
dexon-solidity-02a72871d2200dd415fbb8c7488235495ff012c2.tar.gz
dexon-solidity-02a72871d2200dd415fbb8c7488235495ff012c2.tar.bz2
dexon-solidity-02a72871d2200dd415fbb8c7488235495ff012c2.tar.lz
dexon-solidity-02a72871d2200dd415fbb8c7488235495ff012c2.tar.xz
dexon-solidity-02a72871d2200dd415fbb8c7488235495ff012c2.tar.zst
dexon-solidity-02a72871d2200dd415fbb8c7488235495ff012c2.zip
Change capitalisation
Diffstat (limited to 'docs/miscellaneous.rst')
-rw-r--r--docs/miscellaneous.rst2
1 files changed, 1 insertions, 1 deletions
diff --git a/docs/miscellaneous.rst b/docs/miscellaneous.rst
index 804d69ef..882a6002 100644
--- a/docs/miscellaneous.rst
+++ b/docs/miscellaneous.rst
@@ -66,7 +66,7 @@ Calling ``select(false, x)`` will compute ``x * x`` and ``select(true, x)`` will
.. index:: optimizer, common subexpression elimination, constant propagation
*************************
-Internals - the Optimizer
+Internals - The Optimizer
*************************
The Solidity optimizer operates on assembly, so it can be and also is used by other languages. It splits the sequence of instructions into basic blocks at JUMPs and JUMPDESTs. Inside these blocks, the instructions are analysed and every modification to the stack, to memory or storage is recorded as an expression which consists of an instruction and a list of arguments which are essentially pointers to other expressions. The main idea is now to find expressions that are always equal (on every input) and combine them into an expression class. The optimizer first tries to find each new expression in a list of already known expressions. If this does not work, the expression is simplified according to rules like ``constant + constant = sum_of_constants`` or ``X * 1 = X``. Since this is done recursively, we can also apply the latter rule if the second factor is a more complex expression where we know that it will always evaluate to one. Modifications to storage and memory locations have to erase knowledge about storage and memory locations which are not known to be different: If we first write to location x and then to location y and both are input variables, the second could overwrite the first, so we actually do not know what is stored at x after we wrote to y. On the other hand, if a simplification of the expression x - y evaluates to a non-zero constant, we know that we can keep our knowledge about what is stored at x.