aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docs/layout-of-source-files.rst2
-rw-r--r--docs/miscellaneous.rst2
2 files changed, 2 insertions, 2 deletions
diff --git a/docs/layout-of-source-files.rst b/docs/layout-of-source-files.rst
index ae1e0d26..b3436576 100644
--- a/docs/layout-of-source-files.rst
+++ b/docs/layout-of-source-files.rst
@@ -61,7 +61,7 @@ It depends on the compiler (see below) how to actually resolve the paths.
In general, the directory hierarchy does not need to strictly map onto your local
filesystem, it can also map to resources discovered via e.g. ipfs, http or git.
-Use in actual Compilers
+Use in Actual Compilers
-----------------------
When the compiler is invoked, it is not only possible to specify how to
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.