You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 25, 2025. It is now read-only.
\wedge & F = \{ \MODULE~f.\MODULE, ~\LOCALS~\val^n~(t.\CONST~0)^k \})
1021
1017
\end{array} \\
1022
1018
\end{array}
@@ -1051,24 +1047,75 @@ When the end of a funtion is reached without a jump (|RETURN|) or trap aborting
1051
1047
\end{array}
1052
1048
1053
1049
1050
+
.. _exec-invoke-host:
1051
+
1052
+
Host Functions
1053
+
..............
1054
+
1055
+
Invoking a :ref:`host function <syntax-hostfunc>` has non-deterministic behavior.
1056
+
It may either terminate with a :ref:`trap <trap>` or return regularly.
1057
+
However, the latter case, it is assumed that it consumes and produces the right number and types of WebAssembly :ref:`values <syntax-val>` on the stack,
1058
+
according to its type.
1059
+
A host function may also modify the :ref:`store <syntax-store>` when invoked.
Here, :math:`S' \succ S` expresses that the new store :math:`S'` is *reachable* from :math:`S`.
1084
+
Such a store must not contain fewer addresses than the original store,
1085
+
it must not differ in elements that are not mutable,
1086
+
and it must still be well-typed.
1087
+
1088
+
.. todo:: Define more precisely?
1089
+
1090
+
.. note::
1091
+
A host function can call back into WebAssembly by :ref:`invoking <invocation>` a function :ref:`exported <syntax-export>` from a :ref:`module <syntax-module>`.
1092
+
However, the effects of any such call are subsumed by the non-deterministic behavior allowed for a host function.
1093
+
1094
+
1095
+
1054
1096
.. _exec-expr:
1055
1097
.. index:: expression
1056
1098
pair: execution; expression
1057
1099
single: abstract syntax; expression
1058
-
single: expression; constant
1059
1100
1060
1101
Expressions
1061
1102
~~~~~~~~~~~
1062
1103
1063
-
:math:`\instr^\ast~\END`
1064
-
........................
1104
+
An :ref:`expression <syntax-expr>` is *evaluated* relative to a :ref:`current <exec-notation-textual>` :ref:`frame <syntax-frame>` pointing to its containing :ref:`module instance <syntax-modinst>` :math:`\moduleinst`.
1105
+
1106
+
1. :ref:`Jump <exec-jump>` to the start of the instruction sequence :math:`\instr^\ast` of the expression.
1107
+
1108
+
2. Execute of the instruction sequence.
1109
+
1110
+
3. Assert: due to :ref:`validation <valid-expr>`, the top of the stack contains a :ref:`value <syntax-val>`.
1111
+
1112
+
4. Pop the the :ref:`value <syntax-val>` :math:`\val` from the stack.
1065
1113
1066
-
.. todo::
1067
-
Define
1114
+
The value :math:`\val` is the result of the evaluation.
0 commit comments