[CLEANUP] Remove dead opcodes#21510
Conversation
Removes opcodes that are vestigial on both sides of the pipeline: * `VM_POP_ARGS_OP` (84): never emitted by the opcode compiler and has no runtime handler registered — a program containing it would crash. * `VM_JUMP_IF_OP` (65): a runtime handler was registered, but the compiler never emits it; all conditionals compile through `JumpUnless`/`JumpEq`. Removing it drops a live (non-tree-shakeable) handler from the append-opcodes table. * Wire format `StrictModifier` (5), `StrictBlock` (7), `DynamicArg` (20), `StaticArg` (21): never produced by the wire format encoder and never consumed by the opcode compiler; modifiers and blocks encode as plain `Modifier`/`Block` in both modes, and component args are encoded inline as hashes. Their only references were the opcode table itself, the interface types, and the wire-format debug printer. The wire format is version-locked (templates must be compiled by the matching compiler), so removing never-emitted opcodes is safe. Opcode numbers are not reused; the freed numbers just become gaps like the existing ones (93-94, 101-102, 104). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Some archaeology on how these six opcodes became dead, from glimmer-vm history (where these packages lived before vendoring):
|
Removes six opcodes that are vestigial on both sides of the compile → execute pipeline. Audit method: for every VM syscall op and wire format op, check (a) does the opcode compiler ever emit it, (b) does the runtime ever handle it, (c) is it referenced anywhere beyond its own definition.
VM opcodes
VM_POP_ARGS_OP(84) — never emitted by the opcode compiler and no runtime handler is registered for it; a program containing it would crash. Existed only as the constant, theVmPopArgstype, and a DEBUG metadata entry.VM_JUMP_IF_OP(65) — a runtime handler was registered, but the compiler never emits it: all conditionals compile throughJumpUnless/JumpEq(withToBoolean). Removing it drops a live, non-tree-shakeable handler from the append-opcodes table.Wire format opcodes
StrictModifier(5),StrictBlock(7),DynamicArg(20),StaticArg(21) — never produced by the wire format encoder (modifiers/blocks encode as plainModifier/Blockin both strict and loose mode; component args encode inline as hashes) and never consumed by the opcode compiler (noSTATEMENTS/EXPRESSIONShandler exists — if one ever appeared in a program, compilation would fail). Their only references were the opcode table, the interface types (Statements.Argument,isArgument), and the wire-format debug printer. Since the wire format is version-locked — templates must be compiled by the matching compiler — removing never-emitted opcodes cannot affect anything in the wild.Opcode numbers are not reused; the freed numbers become gaps alongside the existing ones (93–94, 101–102, 104), so no renumbering churn.
Not touched here:
WithDynamicVars/GetDynamicVarand their VM counterparts are live code whose removal is already proposed separately in #21485.Net −71 lines. Verified with
tsc --noEmit, eslint on all touched packages, and browser test sweeps (jit1690 tests,component1689 tests — all passing).🤖 Generated with Claude Code