Skip to content

Replace ByteCodeEmitter::emit_xxx() with Opcode::emit() associated functions#4752

Open
hansl wants to merge 4 commits intoboa-dev:mainfrom
hansl:opcode-emit
Open

Replace ByteCodeEmitter::emit_xxx() with Opcode::emit() associated functions#4752
hansl wants to merge 4 commits intoboa-dev:mainfrom
hansl:opcode-emit

Conversation

@hansl
Copy link
Contributor

@hansl hansl commented Feb 27, 2026

Move opcode emission from methods on ByteCodeEmitter (e.g. self.bytecode.emit_push_undefined(dst)) to associated functions on each opcode struct (e.g. PushUndefined::emit(self, dst)). This makes it easier to search for all emission sites of a given opcode and aligns the API with the opcode type system.

The old emit_xxx methods generated by the generate_opcodes! macro are removed and replaced by a single Variant::emit(compiler, ...) pattern generated in the same macro.

…nctions

Move opcode emission from methods on ByteCodeEmitter (e.g.
`self.bytecode.emit_push_undefined(dst)`) to associated functions on
each opcode struct (e.g. `PushUndefined::emit(self, dst)`). This makes
it easier to search for all emission sites of a given opcode and aligns
the API with the opcode type system.

The old `emit_xxx` methods generated by the `generate_opcodes!` macro
are removed and replaced by a single `Variant::emit(compiler, ...)`
pattern generated in the same macro.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@hansl hansl requested a review from a team as a code owner February 27, 2026 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant