FA-90217 / Bytecode virtual machines / Member archive
Peephole optimizer: any jump followed by a label deleted · case 02
A jmp that skips a labelled block is removed, so the skipped code now executes.
Case contract
Rewrite stack bytecode until a pass makes no change (at most 50 passes). Rules, applied left to right in one scan per pass: push a, push b, add/sub/mul/div folds to push (a op b) when the result fits in int16 (div truncates toward zero and is never folded by zero); not, not is removed; jmp L immediately followed by label L is removed; after ret or jmp, instructions up to the next label are deleted. Return the optimized instruction list.
Why this case matters
Bytecode compilers rely on peephole passes that must preserve semantics and encoding limits.
One recorded failure
Sample boundary fixtureThis sample comes from the broken implementation of a controlled reproducer.
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| jump over code to a later label is kept | [["label", "L1"], ["push", 2], ["label", "L2"], ["ret"]] | [["jmp", "L2"], ["label", "L1"], ["push", 2], ["label", "L2"], ["ret"]] | 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 ↗