Skip to content

Commit

Permalink
[spec] Add note about control stack invariant to algorithm (WebAssemb…
Browse files Browse the repository at this point in the history
  • Loading branch information
rossberg committed Aug 2, 2022
1 parent 88c4b34 commit c502b7a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions document/core/appendix/algorithm.rst
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,8 @@ The type of the :ref:`label <syntax-label>` associated with a control frame is e

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

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

0 comments on commit c502b7a

Please sign in to comment.