FA-90117 / Bytecode virtual machines / Member archive
Structured control: branching to a loop pops the loop label · case 02
After a continue-style branch the label stack is one level short, so later branches exit the wrong construct.
Case contract
WebAssembly-style structured control over a value stack. block k / loop / end nest; each block or loop pushes a label recording its operand height and arity (block: k result values, loop: 0). br d targets the d-th enclosing label counting outward from 0; the branch keeps the top arity values, discards operands down to the label height, then for a block pops that label and continues after its end, for a loop keeps the loop label and continues at the first instruction inside the loop. br_if pops a condition and branches when it is non-zero. Other ops: const v, add, sub, eqz, get k, set k, drop. Each instruction costs one fuel. Return status (done/fuel/trap), stack and locals.
Why this case matters
Label-depth branching is the core of structured bytecode interpreters.
One recorded failure
Sample boundary fixtureThis sample comes from the broken implementation of a controlled reproducer.
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: counted loop exits through outer block | {"locals": [1, 5], "stack": [], "status": "done"} | {"locals": [0, 6], "stack": [], "status": "done"} | Failed |
MEMBER ARCHIVE
The complete case is available to members.
This record includes three runnable implementations, regression fixtures, execution results, and source hashes.
Member access is invitation-based. Sign in with your invited account to inspect the sources.
Sign in to the archive ↗