FAILURE MAP
← Case archive

FA-90212 / Bytecode virtual machines / Member archive

Peephole optimizer: folds to -32768 refused · case 02

Constant expressions producing the int16 minimum are left unfolded.

Member previewVariant 2 · 3 implementations · 9 checks per implementation

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 fixture

This sample comes from the broken implementation of a controlled reproducer.

Boundary fixtureActualExpectedOutcome
fold reaching the int16 minimum[["push", -16384], ["push", 2], ["mul"], ["push", 2], ["ret"]][["push", -32768], ["push", 2], ["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 ↗