Skip to content

Remove TIER_ONE and TIER_TWO from bytecodes.c #108614

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

Closed
markshannon opened this issue Aug 29, 2023 · 1 comment
Closed

Remove TIER_ONE and TIER_TWO from bytecodes.c #108614

markshannon opened this issue Aug 29, 2023 · 1 comment
Labels
3.13 bugs and security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs)

Comments

@markshannon
Copy link
Member

markshannon commented Aug 29, 2023

The TIER_ONE and TIER_TWO macros cause a few problems:

Their presence in the bytecode definitions means that anyone maintaining the interpreter or adding new instructions needs to understand the internals of the multiple execution layers and how they differ.
This makes the entry barrier for contribution, which is already high for these components, even higher.

It makes reasoning about the correctness of optimizations harder.

It prevents the addition of new execution tiers, or changing the design of the current tiers much harder.

We can remove the TIER_ONE and TIER_TWO macros by making modifications to internal execution engine state explicit, without describing how that state is implemented.
For example, rather than modifying next_instr in the tier 1 interpreter, we can use JUMP_BY or SAVE_IP macros.
See faster-cpython/ideas#618

Linked PRs

@markshannon markshannon added the 3.13 bugs and security fixes label Aug 29, 2023
@Eclips4 Eclips4 added the interpreter-core (Objects, Python, Grammar, and Parser dirs) label Aug 29, 2023
markshannon added a commit that referenced this issue Aug 31, 2023
@hugovk
Copy link
Member

hugovk commented Nov 9, 2023

Looks like everything is done for this one. Thanks!

@hugovk hugovk closed this as completed Nov 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.13 bugs and security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs)
Projects
None yet
Development

No branches or pull requests

3 participants