FAILURE MAP
← Case archive

FA-89857 / Bytecode virtual machines / Member archive

Relative-jump VM: SWAP duplicates instead of exchanging · case 02

After SWAP both top slots hold the same value and the original top is lost.

Member previewVariant 2 · 3 implementations · 9 checks per implementation

Case contract

Flat int bytecode, byte addressed: 0 HALT, 1 PUSH imm, 2 ADD, 3 SUB (second-from-top minus top), 4 JMP rel, 5 JZ rel (pops condition, branches when it is 0), 6 DUP, 7 SWAP, 8 PRINT (pop to out). Relative displacements are measured from the address after the one-byte operand. Every executed instruction including HALT costs one unit of fuel; with fuel exhausted report status fuel. Return status, pc, printed values and stack; stack underflow, bad pc and bad opcode are statuses.

Why this case matters

Branch displacement bases, operand order and fuel accounting are classic interpreter-loop defects.

One recorded failure

Sample boundary fixture

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

Boundary fixtureActualExpectedOutcome
swap then subtract uses swapped order{"out": [0], "pc": 7, "stack": [], "status": "halt"}{"out": [-4], "pc": 7, "stack": [], "status": "halt"}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 ↗