FA-90287 / Bytecode virtual machines / Member archive
Wordcode prefixes: prefix leaks into following instructions · case 02
Every instruction after a prefixed one gets an inflated argument.
Case contract
Two-byte wordcode (opcode, arg). EXTENDED_ARG (144) prefixes build wider arguments: each prefix ORs its byte into an accumulator that is then shifted left 8; the real instruction ORs its own byte in and resets the accumulator. Each decoded instruction reports [start of its first prefix, own offset, name, full arg, jump target in bytes]: JUMP_FORWARD (110) targets the next instruction plus 2*arg, JUMP_ABSOLUTE (113) targets 2*arg. A prefix at the end reports ["dangling-extended-arg", start]. A trailing odd byte is ignored.
Why this case matters
Instruction prefixes change argument width and jump targets in wordcode interpreters.
One recorded failure
Sample boundary fixtureThis sample comes from the broken implementation of a controlled reproducer.
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: prefixed absolute jump | [[0, 0, "LOAD_CONST", 2, null], [2, 4, "JUMP_ABSOLUTE", 260, 520], [6, 6, "RETURN_VALUE", 256, null]] | [[0, 0, "LOAD_CONST", 2, null], [2, 4, "JUMP_ABSOLUTE", 260, 520], [6, 6, "RETURN_VALUE", 0, null]] | 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 ↗