FA-89865 / Bytecode virtual machines / Member archive
Relative-jump VM: fuel limit allows one extra instruction · case 05
A program given exactly one unit too little fuel still halts normally.
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 fixtureThis sample comes from the broken implementation of a controlled reproducer.
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| fuel one short reports exhaustion | {"out": [5], "pc": 3, "stack": [], "status": "halt"} | {"out": [5], "pc": 3, "stack": [], "status": "fuel"} | 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 ↗