FAILURE MAP
← Case archive

FA-90142 / Bytecode virtual machines / Member archive

Branch relaxation: wide branches encoded with the short-form base · case 02

Every widened branch lands one or two bytes past its label.

Member previewVariant 2 · 3 implementations · 7 checks per implementation

Case contract

Assemble ["label", name], ["data", nbytes], ["jmp", label], ["jz", label]. Branches start in the short form (2 bytes, signed 8-bit displacement from the end of the instruction, valid -128..127). A short branch whose displacement does not fit is widened (jmp.w 3 bytes, jz.w 4 bytes) and addresses are recomputed until no branch changes (branches never shrink). Report duplicate or undefined labels; otherwise return each branch as [address, mnemonic, displacement from its own end] and the total size.

Why this case matters

Variable-length branch encodings need fixpoint relaxation to produce correct displacements.

One recorded failure

Sample boundary fixture

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

Boundary fixtureActualExpectedOutcome
regression: three-step widening cascade{"branches": [[2, "jmp.w", 130], [15, "jz.w", 130], [134, "jmp.w", 129]], "size": 266}{"branches": [[2, "jmp.w", 129], [15, "jz.w", 128], [134, "jmp.w", 128]], "size": 266}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 ↗