FA-90109 / Bytecode virtual machines / Member archive
Structured control: branch depth counted from the outermost label · case 04
br_if 1 inside a loop jumps back to the loop instead of leaving the enclosing block, so loops never end.
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": [4, 5], "stack": [], "status": "done"} | {"locals": [0, 15], "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 ↗