Skip to content

Commit 731ad9f

Browse files
authored
[spec] Add note about control stack invariant to algorithm (#1498)
1 parent 044d0d2 commit 731ad9f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

document/core/appendix/algorithm.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,8 @@ The type of the :ref:`label <syntax-label>` associated with a control frame is e
140140

141141
Finally, the current frame can be marked as unreachable.
142142
In that case, all existing operand types are purged from the value stack, in order to allow for the :ref:`stack-polymorphism <polymorphism>` logic in :code:`pop_val` to take effect.
143+
Because every function has an implicit outermost label that corresponds to an implicit block frame,
144+
it is an invariant of the validation algorithm that there always is at least one frame on the control stack when validating an instruction, and hence, `ctrls[0]` is always defined.
143145

144146
.. note::
145147
Even with the unreachable flag set, consecutive operands are still pushed to and popped from the operand stack.

0 commit comments

Comments
 (0)