Fieldbooks / WebAssembly / Lesson 03
Lesson 03 of 08 · Course index 00 Start Here: What & WhyStack & control 01 Jump or trap?02 Stack types03 Branch targets→ 04 Unreachable codeMemory & calls 05 Page bounds06 Indirect callsVerification 07 Two verifier designs08 Transfer exam Lesson 03 / Stack & control
Which label receives the jump? Trace a jump inside three nested regions. A block groups instructions, a loop gives them a place to repeat, and an if chooses a path. A zero chooses else. Each region supplies a label, a destination you can count outward from the current instruction. br 0 chooses the closest label.
+ Figure 03
From inside the else arm
i
1 · The big idea WebAssembly has no arbitrary goto to random byte offsets—every jump targets a structured surrounding container (block, loop, or if) counted outward from the inside starting at depth 0. When if pops its condition off the stack, 0 chooses else; any non-zero value chooses then.
Each container pushes a control label onto a label stack. Here is the key difference between block and loop:
Jumping to a block or if exits forward past its end, so the jump must carry that block’s promised result types. Jumping to a loop jumps backward to the loop’s start, so it must carry the loop’s input parameter types.
→
2 · Worked step-by-step example Step-by-step worked trace for lesson 3 Counting Labels Outward From Inside else: 0=if, 1=loop, 2=block Depth 0: if exits to end of if Depth 1: loop repeats start (0 params) Depth 2: block exits needing [i32] Push i32.const 23 before br 2 to satisfy outer block exit [i32]. Worked Example: Counting Depths Inside block → loop → if/else
Program: block (→ i32) { loop { i32.const 0; if { i32.const 12; br 2 } else { br 2 } } i32.const 99 }. Inside the else arm, count enclosing labels outward: 0 = if, 1 = loop, 2 = block (results: i32). br 1 would jump back to the start of loop (takes 0 inputs, loops forever).br 2 jumps past the outer block’s end, which promises [i32].With an empty stack at br 2, the verifier rejects! Pushing i32.const 23 before br 2 satisfies the outer block and skips i32.const 99. Result: Depth 0 = innermost container; blocks/ifs check results on exit, while loops check params on repeat.
Read the case Depth 0 · if → after its end
Depth 1 · loop → back to its start, carrying no inputs
Depth 2 · block → after its end, carrying one i32 result
≡
3 · Bytecode stepper (explore before quizzing) A branch to a block or if carries its result values to the exit. A branch to a loop carries its input values back to the beginning. This loop takes zero inputs. Its enclosing block returns one i32.
Bytecode is the list of machine instructions below. Step through Check types and Run values before answering the prediction below.
Check types Instruction step Step 0Ready 0 / 8
Start with an empty stack. Read the instructions in order.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 br 208 end09 end10 i32.const 9911 endOperand stack top at right [ ] Empty
Control label stack innermost at right function h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 – 65528
– 65529
– 65530
– 65531
– 65532
– 65533
– 65534
– 65535
× 65536+
Type checking does not read or write bytes.
Step forward →
Step 1block 1 / 8
Open block at stack height 0.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 br 208 end09 end10 i32.const 9911 endOperand stack top at right [ ] Empty
Control label stack innermost at right function h=0 block h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 – 65528
– 65529
– 65530
– 65531
– 65532
– 65533
– 65534
– 65535
× 65536+
Type checking does not read or write bytes.
← Back Step forward →
Step 2loop 2 / 8
Open loop at stack height 0.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 br 208 end09 end10 i32.const 9911 endOperand stack top at right [ ] Empty
Control label stack innermost at right function h=0 block h=0 loop h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 – 65528
– 65529
– 65530
– 65531
– 65532
– 65533
– 65534
– 65535
× 65536+
Type checking does not read or write bytes.
← Back Step forward →
Step 3i32.const 3 / 8
Push the type i32.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 br 208 end09 end10 i32.const 9911 endOperand stack top at right i32
Control label stack innermost at right function h=0 block h=0 loop h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 – 65528
– 65529
– 65530
– 65531
– 65532
– 65533
– 65534
– 65535
× 65536+
Type checking does not read or write bytes.
← Back Step forward →
Step 4if 4 / 8
Open if at stack height 0.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 br 208 end09 end10 i32.const 9911 endOperand stack top at right [ ] Empty
Control label stack innermost at right function h=0 block h=0 loop h=0 if h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 – 65528
– 65529
– 65530
– 65531
– 65532
– 65533
– 65534
– 65535
× 65536+
Type checking does not read or write bytes.
← Back Step forward →
Step 5i32.const 5 / 8
Push the type i32.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 br 208 end09 end10 i32.const 9911 endOperand stack top at right i32
Control label stack innermost at right function h=0 block h=0 loop h=0 if h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 – 65528
– 65529
– 65530
– 65531
– 65532
– 65533
– 65534
– 65535
× 65536+
Type checking does not read or write bytes.
← Back Step forward →
Step 6br 6 / 8
Check the block target. Reset to entry height 0. This path cannot reach the next instruction.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 br 208 end09 end10 i32.const 9911 endOperand stack top at right [ ] Empty
Control label stack innermost at right function h=0 block h=0 loop h=0 if h=0 · unreachable
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 – 65528
– 65529
– 65530
– 65531
– 65532
– 65533
– 65534
– 65535
× 65536+
Type checking does not read or write bytes.
← Back Step forward →
Step 7else 7 / 8
Check the first arm. Start the other arm with the same input types.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 br 208 end09 end10 i32.const 9911 endOperand stack top at right [ ] Empty
Control label stack innermost at right function h=0 block h=0 loop h=0 else h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 – 65528
– 65529
– 65530
– 65531
– 65532
– 65533
– 65534
– 65535
× 65536+
Type checking does not read or write bytes.
← Back Step forward →
Step 8br 8 / 8
Stack underflow: i32 is missing at height 0.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 br 208 end09 end10 i32.const 9911 endOperand stack before rejection · top at right [ ] Empty
Control label stack innermost at right function h=0 block h=0 loop h=0 else h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 – 65528
– 65529
– 65530
– 65531
– 65532
– 65533
– 65534
– 65535
× 65536+
Type checking does not read or write bytes.
← Back Types rejected
Run values Execution is blocked. Stack underflow: i32 is missing at height 0.
?
4 · Make a prediction The else arm executes br 2 with an empty stack. What does its destination require? ↗
5 · Repair the program Make the zero condition leave the outer block with 23. Choose the replacement for the else arm. Push i32 23, then br 1 Inspect this edit. The jump targets the loop start, which takes zero inputs. It discards 23 and repeats. The runner stops at its lab step limit.
Types accepted Run paused Calls 0 Writes 0
Step through this edit Check types Instruction step Step 0Ready 0 / 13
Start with an empty stack. Read the instructions in order.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i32.const 2308 br 109 end10 end11 i32.const 9912 endOperand stack top at right [ ] Empty
Control label stack innermost at right function h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 – 65528
– 65529
– 65530
– 65531
– 65532
– 65533
– 65534
– 65535
× 65536+
Type checking does not read or write bytes.
Step forward →
Step 1block 1 / 13
Open block at stack height 0.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i32.const 2308 br 109 end10 end11 i32.const 9912 endOperand stack top at right [ ] Empty
Control label stack innermost at right function h=0 block h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 – 65528
– 65529
– 65530
– 65531
– 65532
– 65533
– 65534
– 65535
× 65536+
Type checking does not read or write bytes.
← Back Step forward →
Step 2loop 2 / 13
Open loop at stack height 0.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i32.const 2308 br 109 end10 end11 i32.const 9912 endOperand stack top at right [ ] Empty
Control label stack innermost at right function h=0 block h=0 loop h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 – 65528
– 65529
– 65530
– 65531
– 65532
– 65533
– 65534
– 65535
× 65536+
Type checking does not read or write bytes.
← Back Step forward →
Step 3i32.const 3 / 13
Push the type i32.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i32.const 2308 br 109 end10 end11 i32.const 9912 endOperand stack top at right i32
Control label stack innermost at right function h=0 block h=0 loop h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 – 65528
– 65529
– 65530
– 65531
– 65532
– 65533
– 65534
– 65535
× 65536+
Type checking does not read or write bytes.
← Back Step forward →
Step 4if 4 / 13
Open if at stack height 0.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i32.const 2308 br 109 end10 end11 i32.const 9912 endOperand stack top at right [ ] Empty
Control label stack innermost at right function h=0 block h=0 loop h=0 if h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 – 65528
– 65529
– 65530
– 65531
– 65532
– 65533
– 65534
– 65535
× 65536+
Type checking does not read or write bytes.
← Back Step forward →
Step 5i32.const 5 / 13
Push the type i32.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i32.const 2308 br 109 end10 end11 i32.const 9912 endOperand stack top at right i32
Control label stack innermost at right function h=0 block h=0 loop h=0 if h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 – 65528
– 65529
– 65530
– 65531
– 65532
– 65533
– 65534
– 65535
× 65536+
Type checking does not read or write bytes.
← Back Step forward →
Step 6br 6 / 13
Check the block target. Reset to entry height 0. This path cannot reach the next instruction.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i32.const 2308 br 109 end10 end11 i32.const 9912 endOperand stack top at right [ ] Empty
Control label stack innermost at right function h=0 block h=0 loop h=0 if h=0 · unreachable
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 – 65528
– 65529
– 65530
– 65531
– 65532
– 65533
– 65534
– 65535
× 65536+
Type checking does not read or write bytes.
← Back Step forward →
Step 7else 7 / 13
Check the first arm. Start the other arm with the same input types.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i32.const 2308 br 109 end10 end11 i32.const 9912 endOperand stack top at right [ ] Empty
Control label stack innermost at right function h=0 block h=0 loop h=0 else h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 – 65528
– 65529
– 65530
– 65531
– 65532
– 65533
– 65534
– 65535
× 65536+
Type checking does not read or write bytes.
← Back Step forward →
Step 8i32.const 8 / 13
Push the type i32.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i32.const 2308 br 109 end10 end11 i32.const 9912 endOperand stack top at right i32
Control label stack innermost at right function h=0 block h=0 loop h=0 else h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 – 65528
– 65529
– 65530
– 65531
– 65532
– 65533
– 65534
– 65535
× 65536+
Type checking does not read or write bytes.
← Back Step forward →
Step 9br 9 / 13
Check the loop target. Reset to entry height 0. This path cannot reach the next instruction.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i32.const 2308 br 109 end10 end11 i32.const 9912 endOperand stack top at right [ ] Empty
Control label stack innermost at right function h=0 block h=0 loop h=0 else h=0 · unreachable
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 – 65528
– 65529
– 65530
– 65531
– 65532
– 65533
– 65534
– 65535
× 65536+
Type checking does not read or write bytes.
← Back Step forward →
Step 10end 10 / 13
Close this label. Restore its declared result types.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i32.const 2308 br 109 end10 end11 i32.const 9912 endOperand stack top at right [ ] Empty
Control label stack innermost at right function h=0 block h=0 loop h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 – 65528
– 65529
– 65530
– 65531
– 65532
– 65533
– 65534
– 65535
× 65536+
Type checking does not read or write bytes.
← Back Step forward →
Step 11end 11 / 13
Close this label. Restore its declared result types.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i32.const 2308 br 109 end10 end11 i32.const 9912 endOperand stack top at right [ ] Empty
Control label stack innermost at right function h=0 block h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 – 65528
– 65529
– 65530
– 65531
– 65532
– 65533
– 65534
– 65535
× 65536+
Type checking does not read or write bytes.
← Back Step forward →
Step 12i32.const 12 / 13
Push the type i32.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i32.const 2308 br 109 end10 end11 i32.const 9912 endOperand stack top at right i32
Control label stack innermost at right function h=0 block h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 – 65528
– 65529
– 65530
– 65531
– 65532
– 65533
– 65534
– 65535
× 65536+
Type checking does not read or write bytes.
← Back Step forward →
Step 13end 13 / 13
Close this label. Restore its declared result types.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i32.const 2308 br 109 end10 end11 i32.const 9912 endOperand stack top at right i32
Control label stack innermost at right function h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 – 65528
– 65529
– 65530
– 65531
– 65532
– 65533
– 65534
– 65535
× 65536+
Type checking does not read or write bytes.
← Back Types accepted
Run values Instruction step Step 0Ready 0 / 24
Start with an empty stack and one page of zero bytes.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i32.const 2308 br 109 end10 end11 i32.const 9912 endOperand stack top at right [ ] Empty
Control label stack innermost at right function h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 00 65528
00 65529
00 65530
00 65531
00 65532
00 65533
00 65534
00 65535
× 65536+
Each pair is one byte in base sixteen. The striped guard region marks addresses outside the page.
Step forward →
Step 1block 1 / 24
Enter the block body.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i32.const 2308 br 109 end10 end11 i32.const 9912 endOperand stack top at right [ ] Empty
Control label stack innermost at right function h=0 block h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 00 65528
00 65529
00 65530
00 65531
00 65532
00 65533
00 65534
00 65535
× 65536+
Each pair is one byte in base sixteen. The striped guard region marks addresses outside the page.
← Back Step forward →
Step 2loop 2 / 24
Enter the loop body.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i32.const 2308 br 109 end10 end11 i32.const 9912 endOperand stack top at right [ ] Empty
Control label stack innermost at right function h=0 block h=0 loop h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 00 65528
00 65529
00 65530
00 65531
00 65532
00 65533
00 65534
00 65535
× 65536+
Each pair is one byte in base sixteen. The striped guard region marks addresses outside the page.
← Back Step forward →
Step 3i32.const 3 / 24
Push the value 0.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i32.const 2308 br 109 end10 end11 i32.const 9912 endOperand stack top at right i32 0
Control label stack innermost at right function h=0 block h=0 loop h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 00 65528
00 65529
00 65530
00 65531
00 65532
00 65533
00 65534
00 65535
× 65536+
Each pair is one byte in base sixteen. The striped guard region marks addresses outside the page.
← Back Step forward →
Step 4if 4 / 24
The condition is zero. Skip the first arm.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i32.const 2308 br 109 end10 end11 i32.const 9912 endOperand stack top at right [ ] Empty
Control label stack innermost at right function h=0 block h=0 loop h=0 else h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 00 65528
00 65529
00 65530
00 65531
00 65532
00 65533
00 65534
00 65535
× 65536+
Each pair is one byte in base sixteen. The striped guard region marks addresses outside the page.
← Back Step forward →
Step 5i32.const 5 / 24
Push the value 23.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i32.const 2308 br 109 end10 end11 i32.const 9912 endOperand stack top at right i32 23
Control label stack innermost at right function h=0 block h=0 loop h=0 else h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 00 65528
00 65529
00 65530
00 65531
00 65532
00 65533
00 65534
00 65535
× 65536+
Each pair is one byte in base sixteen. The striped guard region marks addresses outside the page.
← Back Step forward →
Step 6br 6 / 24
Carry the loop inputs back to its first instruction.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i32.const 2308 br 109 end10 end11 i32.const 9912 endOperand stack top at right [ ] Empty
Control label stack innermost at right function h=0 block h=0 loop h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 00 65528
00 65529
00 65530
00 65531
00 65532
00 65533
00 65534
00 65535
× 65536+
Each pair is one byte in base sixteen. The striped guard region marks addresses outside the page.
← Back Step forward →
Step 7i32.const 7 / 24
Push the value 0.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i32.const 2308 br 109 end10 end11 i32.const 9912 endOperand stack top at right i32 0
Control label stack innermost at right function h=0 block h=0 loop h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 00 65528
00 65529
00 65530
00 65531
00 65532
00 65533
00 65534
00 65535
× 65536+
Each pair is one byte in base sixteen. The striped guard region marks addresses outside the page.
← Back Step forward →
Step 8if 8 / 24
The condition is zero. Skip the first arm.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i32.const 2308 br 109 end10 end11 i32.const 9912 endOperand stack top at right [ ] Empty
Control label stack innermost at right function h=0 block h=0 loop h=0 else h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 00 65528
00 65529
00 65530
00 65531
00 65532
00 65533
00 65534
00 65535
× 65536+
Each pair is one byte in base sixteen. The striped guard region marks addresses outside the page.
← Back Step forward →
Step 9i32.const 9 / 24
Push the value 23.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i32.const 2308 br 109 end10 end11 i32.const 9912 endOperand stack top at right i32 23
Control label stack innermost at right function h=0 block h=0 loop h=0 else h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 00 65528
00 65529
00 65530
00 65531
00 65532
00 65533
00 65534
00 65535
× 65536+
Each pair is one byte in base sixteen. The striped guard region marks addresses outside the page.
← Back Step forward →
Step 10br 10 / 24
Carry the loop inputs back to its first instruction.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i32.const 2308 br 109 end10 end11 i32.const 9912 endOperand stack top at right [ ] Empty
Control label stack innermost at right function h=0 block h=0 loop h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 00 65528
00 65529
00 65530
00 65531
00 65532
00 65533
00 65534
00 65535
× 65536+
Each pair is one byte in base sixteen. The striped guard region marks addresses outside the page.
← Back Step forward →
Step 11i32.const 11 / 24
Push the value 0.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i32.const 2308 br 109 end10 end11 i32.const 9912 endOperand stack top at right i32 0
Control label stack innermost at right function h=0 block h=0 loop h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 00 65528
00 65529
00 65530
00 65531
00 65532
00 65533
00 65534
00 65535
× 65536+
Each pair is one byte in base sixteen. The striped guard region marks addresses outside the page.
← Back Step forward →
Step 12if 12 / 24
The condition is zero. Skip the first arm.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i32.const 2308 br 109 end10 end11 i32.const 9912 endOperand stack top at right [ ] Empty
Control label stack innermost at right function h=0 block h=0 loop h=0 else h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 00 65528
00 65529
00 65530
00 65531
00 65532
00 65533
00 65534
00 65535
× 65536+
Each pair is one byte in base sixteen. The striped guard region marks addresses outside the page.
← Back Step forward →
Step 13i32.const 13 / 24
Push the value 23.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i32.const 2308 br 109 end10 end11 i32.const 9912 endOperand stack top at right i32 23
Control label stack innermost at right function h=0 block h=0 loop h=0 else h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 00 65528
00 65529
00 65530
00 65531
00 65532
00 65533
00 65534
00 65535
× 65536+
Each pair is one byte in base sixteen. The striped guard region marks addresses outside the page.
← Back Step forward →
Step 14br 14 / 24
Carry the loop inputs back to its first instruction.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i32.const 2308 br 109 end10 end11 i32.const 9912 endOperand stack top at right [ ] Empty
Control label stack innermost at right function h=0 block h=0 loop h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 00 65528
00 65529
00 65530
00 65531
00 65532
00 65533
00 65534
00 65535
× 65536+
Each pair is one byte in base sixteen. The striped guard region marks addresses outside the page.
← Back Step forward →
Step 15i32.const 15 / 24
Push the value 0.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i32.const 2308 br 109 end10 end11 i32.const 9912 endOperand stack top at right i32 0
Control label stack innermost at right function h=0 block h=0 loop h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 00 65528
00 65529
00 65530
00 65531
00 65532
00 65533
00 65534
00 65535
× 65536+
Each pair is one byte in base sixteen. The striped guard region marks addresses outside the page.
← Back Step forward →
Step 16if 16 / 24
The condition is zero. Skip the first arm.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i32.const 2308 br 109 end10 end11 i32.const 9912 endOperand stack top at right [ ] Empty
Control label stack innermost at right function h=0 block h=0 loop h=0 else h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 00 65528
00 65529
00 65530
00 65531
00 65532
00 65533
00 65534
00 65535
× 65536+
Each pair is one byte in base sixteen. The striped guard region marks addresses outside the page.
← Back Step forward →
Step 17i32.const 17 / 24
Push the value 23.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i32.const 2308 br 109 end10 end11 i32.const 9912 endOperand stack top at right i32 23
Control label stack innermost at right function h=0 block h=0 loop h=0 else h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 00 65528
00 65529
00 65530
00 65531
00 65532
00 65533
00 65534
00 65535
× 65536+
Each pair is one byte in base sixteen. The striped guard region marks addresses outside the page.
← Back Step forward →
Step 18br 18 / 24
Carry the loop inputs back to its first instruction.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i32.const 2308 br 109 end10 end11 i32.const 9912 endOperand stack top at right [ ] Empty
Control label stack innermost at right function h=0 block h=0 loop h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 00 65528
00 65529
00 65530
00 65531
00 65532
00 65533
00 65534
00 65535
× 65536+
Each pair is one byte in base sixteen. The striped guard region marks addresses outside the page.
← Back Step forward →
Step 19i32.const 19 / 24
Push the value 0.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i32.const 2308 br 109 end10 end11 i32.const 9912 endOperand stack top at right i32 0
Control label stack innermost at right function h=0 block h=0 loop h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 00 65528
00 65529
00 65530
00 65531
00 65532
00 65533
00 65534
00 65535
× 65536+
Each pair is one byte in base sixteen. The striped guard region marks addresses outside the page.
← Back Step forward →
Step 20if 20 / 24
The condition is zero. Skip the first arm.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i32.const 2308 br 109 end10 end11 i32.const 9912 endOperand stack top at right [ ] Empty
Control label stack innermost at right function h=0 block h=0 loop h=0 else h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 00 65528
00 65529
00 65530
00 65531
00 65532
00 65533
00 65534
00 65535
× 65536+
Each pair is one byte in base sixteen. The striped guard region marks addresses outside the page.
← Back Step forward →
Step 21i32.const 21 / 24
Push the value 23.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i32.const 2308 br 109 end10 end11 i32.const 9912 endOperand stack top at right i32 23
Control label stack innermost at right function h=0 block h=0 loop h=0 else h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 00 65528
00 65529
00 65530
00 65531
00 65532
00 65533
00 65534
00 65535
× 65536+
Each pair is one byte in base sixteen. The striped guard region marks addresses outside the page.
← Back Step forward →
Step 22br 22 / 24
Carry the loop inputs back to its first instruction.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i32.const 2308 br 109 end10 end11 i32.const 9912 endOperand stack top at right [ ] Empty
Control label stack innermost at right function h=0 block h=0 loop h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 00 65528
00 65529
00 65530
00 65531
00 65532
00 65533
00 65534
00 65535
× 65536+
Each pair is one byte in base sixteen. The striped guard region marks addresses outside the page.
← Back Step forward →
Step 23i32.const 23 / 24
Push the value 0.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i32.const 2308 br 109 end10 end11 i32.const 9912 endOperand stack top at right i32 0
Control label stack innermost at right function h=0 block h=0 loop h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 00 65528
00 65529
00 65530
00 65531
00 65532
00 65533
00 65534
00 65535
× 65536+
Each pair is one byte in base sixteen. The striped guard region marks addresses outside the page.
← Back Step forward →
Step 24if 24 / 24
The condition is zero. Skip the first arm.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i32.const 2308 br 109 end10 end11 i32.const 9912 endOperand stack top at right [ ] Empty
Control label stack innermost at right function h=0 block h=0 loop h=0 else h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 00 65528
00 65529
00 65530
00 65531
00 65532
00 65533
00 65534
00 65535
× 65536+
Each pair is one byte in base sixteen. The striped guard region marks addresses outside the page.
← Back End of displayed steps
The loop repeated. Showing the first 24 of 512 executed steps. The lab paused the run at its step limit.
Push i32 23, then br 2 Repair confirmed. The branch carries 23 out of the block. The runner skips the later 99 and finishes with 23.
Types accepted Run finished Calls 0 Writes 0
Step through this edit Check types Instruction step Step 0Ready 0 / 13
Start with an empty stack. Read the instructions in order.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i32.const 2308 br 209 end10 end11 i32.const 9912 endOperand stack top at right [ ] Empty
Control label stack innermost at right function h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 – 65528
– 65529
– 65530
– 65531
– 65532
– 65533
– 65534
– 65535
× 65536+
Type checking does not read or write bytes.
Step forward →
Step 1block 1 / 13
Open block at stack height 0.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i32.const 2308 br 209 end10 end11 i32.const 9912 endOperand stack top at right [ ] Empty
Control label stack innermost at right function h=0 block h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 – 65528
– 65529
– 65530
– 65531
– 65532
– 65533
– 65534
– 65535
× 65536+
Type checking does not read or write bytes.
← Back Step forward →
Step 2loop 2 / 13
Open loop at stack height 0.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i32.const 2308 br 209 end10 end11 i32.const 9912 endOperand stack top at right [ ] Empty
Control label stack innermost at right function h=0 block h=0 loop h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 – 65528
– 65529
– 65530
– 65531
– 65532
– 65533
– 65534
– 65535
× 65536+
Type checking does not read or write bytes.
← Back Step forward →
Step 3i32.const 3 / 13
Push the type i32.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i32.const 2308 br 209 end10 end11 i32.const 9912 endOperand stack top at right i32
Control label stack innermost at right function h=0 block h=0 loop h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 – 65528
– 65529
– 65530
– 65531
– 65532
– 65533
– 65534
– 65535
× 65536+
Type checking does not read or write bytes.
← Back Step forward →
Step 4if 4 / 13
Open if at stack height 0.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i32.const 2308 br 209 end10 end11 i32.const 9912 endOperand stack top at right [ ] Empty
Control label stack innermost at right function h=0 block h=0 loop h=0 if h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 – 65528
– 65529
– 65530
– 65531
– 65532
– 65533
– 65534
– 65535
× 65536+
Type checking does not read or write bytes.
← Back Step forward →
Step 5i32.const 5 / 13
Push the type i32.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i32.const 2308 br 209 end10 end11 i32.const 9912 endOperand stack top at right i32
Control label stack innermost at right function h=0 block h=0 loop h=0 if h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 – 65528
– 65529
– 65530
– 65531
– 65532
– 65533
– 65534
– 65535
× 65536+
Type checking does not read or write bytes.
← Back Step forward →
Step 6br 6 / 13
Check the block target. Reset to entry height 0. This path cannot reach the next instruction.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i32.const 2308 br 209 end10 end11 i32.const 9912 endOperand stack top at right [ ] Empty
Control label stack innermost at right function h=0 block h=0 loop h=0 if h=0 · unreachable
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 – 65528
– 65529
– 65530
– 65531
– 65532
– 65533
– 65534
– 65535
× 65536+
Type checking does not read or write bytes.
← Back Step forward →
Step 7else 7 / 13
Check the first arm. Start the other arm with the same input types.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i32.const 2308 br 209 end10 end11 i32.const 9912 endOperand stack top at right [ ] Empty
Control label stack innermost at right function h=0 block h=0 loop h=0 else h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 – 65528
– 65529
– 65530
– 65531
– 65532
– 65533
– 65534
– 65535
× 65536+
Type checking does not read or write bytes.
← Back Step forward →
Step 8i32.const 8 / 13
Push the type i32.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i32.const 2308 br 209 end10 end11 i32.const 9912 endOperand stack top at right i32
Control label stack innermost at right function h=0 block h=0 loop h=0 else h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 – 65528
– 65529
– 65530
– 65531
– 65532
– 65533
– 65534
– 65535
× 65536+
Type checking does not read or write bytes.
← Back Step forward →
Step 9br 9 / 13
Check the block target. Reset to entry height 0. This path cannot reach the next instruction.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i32.const 2308 br 209 end10 end11 i32.const 9912 endOperand stack top at right [ ] Empty
Control label stack innermost at right function h=0 block h=0 loop h=0 else h=0 · unreachable
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 – 65528
– 65529
– 65530
– 65531
– 65532
– 65533
– 65534
– 65535
× 65536+
Type checking does not read or write bytes.
← Back Step forward →
Step 10end 10 / 13
Close this label. Restore its declared result types.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i32.const 2308 br 209 end10 end11 i32.const 9912 endOperand stack top at right [ ] Empty
Control label stack innermost at right function h=0 block h=0 loop h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 – 65528
– 65529
– 65530
– 65531
– 65532
– 65533
– 65534
– 65535
× 65536+
Type checking does not read or write bytes.
← Back Step forward →
Step 11end 11 / 13
Close this label. Restore its declared result types.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i32.const 2308 br 209 end10 end11 i32.const 9912 endOperand stack top at right [ ] Empty
Control label stack innermost at right function h=0 block h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 – 65528
– 65529
– 65530
– 65531
– 65532
– 65533
– 65534
– 65535
× 65536+
Type checking does not read or write bytes.
← Back Step forward →
Step 12i32.const 12 / 13
Push the type i32.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i32.const 2308 br 209 end10 end11 i32.const 9912 endOperand stack top at right i32
Control label stack innermost at right function h=0 block h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 – 65528
– 65529
– 65530
– 65531
– 65532
– 65533
– 65534
– 65535
× 65536+
Type checking does not read or write bytes.
← Back Step forward →
Step 13end 13 / 13
Close this label. Restore its declared result types.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i32.const 2308 br 209 end10 end11 i32.const 9912 endOperand stack top at right i32
Control label stack innermost at right function h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 – 65528
– 65529
– 65530
– 65531
– 65532
– 65533
– 65534
– 65535
× 65536+
Type checking does not read or write bytes.
← Back Types accepted
Run values Instruction step Step 0Ready 0 / 6
Start with an empty stack and one page of zero bytes.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i32.const 2308 br 209 end10 end11 i32.const 9912 endOperand stack top at right [ ] Empty
Control label stack innermost at right function h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 00 65528
00 65529
00 65530
00 65531
00 65532
00 65533
00 65534
00 65535
× 65536+
Each pair is one byte in base sixteen. The striped guard region marks addresses outside the page.
Step forward →
Step 1block 1 / 6
Enter the block body.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i32.const 2308 br 209 end10 end11 i32.const 9912 endOperand stack top at right [ ] Empty
Control label stack innermost at right function h=0 block h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 00 65528
00 65529
00 65530
00 65531
00 65532
00 65533
00 65534
00 65535
× 65536+
Each pair is one byte in base sixteen. The striped guard region marks addresses outside the page.
← Back Step forward →
Step 2loop 2 / 6
Enter the loop body.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i32.const 2308 br 209 end10 end11 i32.const 9912 endOperand stack top at right [ ] Empty
Control label stack innermost at right function h=0 block h=0 loop h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 00 65528
00 65529
00 65530
00 65531
00 65532
00 65533
00 65534
00 65535
× 65536+
Each pair is one byte in base sixteen. The striped guard region marks addresses outside the page.
← Back Step forward →
Step 3i32.const 3 / 6
Push the value 0.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i32.const 2308 br 209 end10 end11 i32.const 9912 endOperand stack top at right i32 0
Control label stack innermost at right function h=0 block h=0 loop h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 00 65528
00 65529
00 65530
00 65531
00 65532
00 65533
00 65534
00 65535
× 65536+
Each pair is one byte in base sixteen. The striped guard region marks addresses outside the page.
← Back Step forward →
Step 4if 4 / 6
The condition is zero. Skip the first arm.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i32.const 2308 br 209 end10 end11 i32.const 9912 endOperand stack top at right [ ] Empty
Control label stack innermost at right function h=0 block h=0 loop h=0 else h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 00 65528
00 65529
00 65530
00 65531
00 65532
00 65533
00 65534
00 65535
× 65536+
Each pair is one byte in base sixteen. The striped guard region marks addresses outside the page.
← Back Step forward →
Step 5i32.const 5 / 6
Push the value 23.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i32.const 2308 br 209 end10 end11 i32.const 9912 endOperand stack top at right i32 23
Control label stack innermost at right function h=0 block h=0 loop h=0 else h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 00 65528
00 65529
00 65530
00 65531
00 65532
00 65533
00 65534
00 65535
× 65536+
Each pair is one byte in base sixteen. The striped guard region marks addresses outside the page.
← Back Step forward →
Step 6br 6 / 6
Carry the result values to the exit of this block.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i32.const 2308 br 209 end10 end11 i32.const 9912 endOperand stack top at right i32 23
Control label stack innermost at right function h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 00 65528
00 65529
00 65530
00 65531
00 65532
00 65533
00 65534
00 65535
× 65536+
Each pair is one byte in base sixteen. The striped guard region marks addresses outside the page.
← Back Run finished
Push i64 23, then br 2 Inspect this edit. The destination is correct. Its exit requires an i32, but the branch supplies an i64.
Types rejected Run blocked Calls 0 Writes 0
Step through this edit Check types Instruction step Step 0Ready 0 / 9
Start with an empty stack. Read the instructions in order.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i64.const 2308 br 209 end10 end11 i32.const 9912 endOperand stack top at right [ ] Empty
Control label stack innermost at right function h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 – 65528
– 65529
– 65530
– 65531
– 65532
– 65533
– 65534
– 65535
× 65536+
Type checking does not read or write bytes.
Step forward →
Step 1block 1 / 9
Open block at stack height 0.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i64.const 2308 br 209 end10 end11 i32.const 9912 endOperand stack top at right [ ] Empty
Control label stack innermost at right function h=0 block h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 – 65528
– 65529
– 65530
– 65531
– 65532
– 65533
– 65534
– 65535
× 65536+
Type checking does not read or write bytes.
← Back Step forward →
Step 2loop 2 / 9
Open loop at stack height 0.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i64.const 2308 br 209 end10 end11 i32.const 9912 endOperand stack top at right [ ] Empty
Control label stack innermost at right function h=0 block h=0 loop h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 – 65528
– 65529
– 65530
– 65531
– 65532
– 65533
– 65534
– 65535
× 65536+
Type checking does not read or write bytes.
← Back Step forward →
Step 3i32.const 3 / 9
Push the type i32.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i64.const 2308 br 209 end10 end11 i32.const 9912 endOperand stack top at right i32
Control label stack innermost at right function h=0 block h=0 loop h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 – 65528
– 65529
– 65530
– 65531
– 65532
– 65533
– 65534
– 65535
× 65536+
Type checking does not read or write bytes.
← Back Step forward →
Step 4if 4 / 9
Open if at stack height 0.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i64.const 2308 br 209 end10 end11 i32.const 9912 endOperand stack top at right [ ] Empty
Control label stack innermost at right function h=0 block h=0 loop h=0 if h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 – 65528
– 65529
– 65530
– 65531
– 65532
– 65533
– 65534
– 65535
× 65536+
Type checking does not read or write bytes.
← Back Step forward →
Step 5i32.const 5 / 9
Push the type i32.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i64.const 2308 br 209 end10 end11 i32.const 9912 endOperand stack top at right i32
Control label stack innermost at right function h=0 block h=0 loop h=0 if h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 – 65528
– 65529
– 65530
– 65531
– 65532
– 65533
– 65534
– 65535
× 65536+
Type checking does not read or write bytes.
← Back Step forward →
Step 6br 6 / 9
Check the block target. Reset to entry height 0. This path cannot reach the next instruction.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i64.const 2308 br 209 end10 end11 i32.const 9912 endOperand stack top at right [ ] Empty
Control label stack innermost at right function h=0 block h=0 loop h=0 if h=0 · unreachable
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 – 65528
– 65529
– 65530
– 65531
– 65532
– 65533
– 65534
– 65535
× 65536+
Type checking does not read or write bytes.
← Back Step forward →
Step 7else 7 / 9
Check the first arm. Start the other arm with the same input types.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i64.const 2308 br 209 end10 end11 i32.const 9912 endOperand stack top at right [ ] Empty
Control label stack innermost at right function h=0 block h=0 loop h=0 else h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 – 65528
– 65529
– 65530
– 65531
– 65532
– 65533
– 65534
– 65535
× 65536+
Type checking does not read or write bytes.
← Back Step forward →
Step 8i64.const 8 / 9
Push the type i64.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i64.const 2308 br 209 end10 end11 i32.const 9912 endOperand stack top at right i64
Control label stack innermost at right function h=0 block h=0 loop h=0 else h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 – 65528
– 65529
– 65530
– 65531
– 65532
– 65533
– 65534
– 65535
× 65536+
Type checking does not read or write bytes.
← Back Step forward →
Step 9br 9 / 9
Type mismatch: expected i32, found i64.
Bytecode instruction address 00 block → i3201 loop02 i32.const 003 if04 i32.const 1205 br 206 else07 i64.const 2308 br 209 end10 end11 i32.const 9912 endOperand stack before rejection · top at right i64
Control label stack innermost at right function h=0 block h=0 loop h=0 else h=0
Each label keeps its entry height (h = stack height when the block opened).
Linear memory Tail of page 0 – 65528
– 65529
– 65530
– 65531
– 65532
– 65533
– 65534
– 65535
× 65536+
Type checking does not read or write bytes.
← Back Types rejected
Run values Execution is blocked. Type mismatch: expected i32, found i64.
{ }
Code workshop Implement labelArgs in my-rules.mjs. Find the branch destination and return its required types. A loop uses its inputs. An exit uses its results. The first command makes your own copy of the starter if needed. Edit the named function, then run the second command.
cp -n workshop/starter.mjs my-rules.mjs
node workshop/check.mjs 3 ./my-rules.mjsOptional worked example in a separate file Add a label selector. Store labels from outermost to innermost. Try depths 2 and 1 with the three labels from the sketch.
function target(labels, depth) {
if (!Number.isInteger(depth) || depth < 0 || depth >= labels.length)
throw Error("unknown label")
return labels[labels.length - 1 - depth]
}
console.log(target(["block", "loop", "if"], 2))Depth 2 returns block. Give each label its input and result lists. When you check a branch, use the loop’s inputs for a loop and the results for an exit.
Key Takeaway & Next Up Structured branch depths count outward from 0; forward jumps carry exit results while backward loop jumps carry entry parameters.
Next: Next, we explore the exact boundary of unreachable stack checking when a block starts with data already on the stack.
Edit the bytecode Change the numbered inputs or instructions and run the checker again. Each run starts with a fresh page. This editor accepts a JSON object containing the decoded instructions.
Program Check and run
Free to Learn: Build a WebAssembly Stack-Machine Verifier & Linear-Memory Sandbox Lab