Skip to content

Commit c502b7a

Browse files
committed
[spec] Add note about control stack invariant to algorithm (WebAssembly#1498)
1 parent 88c4b34 commit c502b7a

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
@@ -240,6 +240,8 @@ The type of the :ref:`label <syntax-label>` associated with a control frame is e
240240

241241
Finally, the current frame can be marked as unreachable.
242242
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.
243+
Because every function has an implicit outermost label that corresponds to an implicit block frame,
244+
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.
243245

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

0 commit comments

Comments
 (0)