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

Add INSTRUCTION_SIZE macro to code generator. #118423

Open
markshannon opened this issue Apr 30, 2024 · 0 comments
Open

Add INSTRUCTION_SIZE macro to code generator. #118423

markshannon opened this issue Apr 30, 2024 · 0 comments
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) type-feature A feature request or enhancement

Comments

@markshannon
Copy link
Member

markshannon commented Apr 30, 2024

In bytecodes.c we use both next_instr - this_instr and 1 + INLINE_CACHE_ENTRIES_... to mean "instruction length".
We should add a macro for the purpose that is understood by the code generator.

Examples

The somewhat confusing LOAD_IP(1 + INLINE_CACHE_ENTRIES_SEND); would become LOAD_IP(INSTRUCTION_LENGTH)

frame->return_offset = (uint16_t)(next_instr - this_instr); would become frame->return_offset = INSTRUCTION_LENGTH; which is both easier to understand and wouldn't be rejected as tier 2 code.

Linked PRs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

3 participants