Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make bytecode generation more typesafe #2561

Open
nekevss opened this issue Jan 24, 2023 · 1 comment
Open

Make bytecode generation more typesafe #2561

nekevss opened this issue Jan 24, 2023 · 1 comment
Labels
enhancement New feature or request vm Issues and PRs related to the Boa Virtual Machine.

Comments

@nekevss
Copy link
Member

nekevss commented Jan 24, 2023

As mentioned in #2553, we currently use emit functions in the ByteCompiler to generate opcode and their arguments, which could lead to a bug if the emits are incorrectly ordered or removed. We could maybe generate emit functions for every opcode via a macro and/or trait e.g. Opcode::GetFunction::emit to stabilize the emitting of an opcode and it's required arguments.

@nekevss nekevss added enhancement New feature or request vm Issues and PRs related to the Boa Virtual Machine. labels Jan 24, 2023
@jedel1043
Copy link
Member

jedel1043 commented Jan 24, 2023

Could be ideal to have a RawOp with the raw instruction set, then have an Instruction enum as our API to push instructions to the codeblock. This enum would then have a function like emit(&mut CodeBlock) that automatically pushes its RawOp representation and its operands to the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request vm Issues and PRs related to the Boa Virtual Machine.
Projects
None yet
Development

No branches or pull requests

2 participants