Skip to content
This repository was archived by the owner on Apr 25, 2025. It is now read-only.

Commit c5a8a43

Browse files
authored
Add prose for exiting a CAUGHTadm block. (#227)
Also slightly changed notation to match the [formal overview document](https://github.com/WebAssembly/exception-handling/blob/main/proposals/exception-handling/Exceptions-formal-overview.md).
1 parent 132a64d commit c5a8a43

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

document/core/exec/instructions.rst

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3039,17 +3039,32 @@ Throwing an exception with :ref:`tag address <syntax-tagaddr>` :math:`a`
30393039

30403040
.. _exec-caughtadm:
30413041

3042-
Holding a caught exception with |CAUGHTadm|
3043-
...........................................
3042+
Exiting a |CAUGHTadm|
3043+
.....................
3044+
3045+
When the |END| of a |CAUGHTadm|, is reached without a jump, exception, or trap, then the following steps are performed.
3046+
3047+
1. Let :math:`\val^\ast` be the values on the top of the stack.
3048+
3049+
2. Pop the values :math:`\val^\ast` from the stack.
3050+
3051+
3. Assert: due to :ref:`validation <valid-instr-seq>`, an administrative instruction :math:`\CAUGHTadm\{a~\val_0^\ast\}` is now on the top of the stack.
3052+
3053+
4. Pop the |CAUGHTadm| from the stack.
3054+
3055+
5. Push :math:`\val^\ast` back to the stack.
3056+
3057+
6. Jump to the position after the |END| of the administrative instruction associated with the |CAUGHTadm| instruction.
30443058

3045-
.. todo::
3046-
Add prose describing the administrative |CAUGHTadm| execution step.
30473059

30483060
.. math::
30493061
\begin{array}{rcl}
3050-
\CAUGHTadm\{a~\val^n\}~\val^m~\END &\stepto& \val^m
3062+
\CAUGHTadm\{a~\val_0^\ast\}~\val^\ast~\END &\stepto& \val^\ast
30513063
\end{array}
30523064
3065+
.. note::
3066+
An exception can only be rethrown from the scope of the |CAUGHTadm| administrative instruction holding it, i.e., from the scope of the |CATCH| or |CATCHALL| block of a :ref:`try-catch <syntax-try-catch>` instruction that caught it. Upon exit from a |CAUGHTadm|, the exception it holds is discarded.
3067+
30533068

30543069
.. index:: ! call, function, function instance, label, frame
30553070

0 commit comments

Comments
 (0)