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

GH-128563: (Re)move some labels, to simplify implementing tailcalling interpeter. #129525

Merged
merged 2 commits into from
Jan 31, 2025

Conversation

markshannon
Copy link
Member

@markshannon markshannon commented Jan 31, 2025

Following on from an earlier discussion: It complicates the code a lot if we need to be able to jump from generated code back into manually written labels and vice-versa.

This PR refactors the code so that there are only two transfers from the the code in ceval.c to bytecodes.c and none the other way,
for tier 1 (we can do much the same for tier 2 later).

The two transfers from PyEval_EvalDefault into the interpreter "loop" are:

  • goto error; on line 847
  • goto start_frame; on line 856

Copy link
Member

@Fidget-Spinner Fidget-Spinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be fine. Can you please run benchmarks to make sure the added jumps don't affect perf? I don't think they should (they are jumps that should be always predicted), but I just want to be safe.

@markshannon
Copy link
Member Author

Any change in performance will just be noise or error.
If anything, there are fewer jumps as all the old jumps to resume_with_error were followed by a jump to error.

@markshannon markshannon merged commit 54f74b8 into python:main Jan 31, 2025
73 checks passed
@markshannon markshannon deleted the move-troublesome-labels branch January 31, 2025 17:13
srinivasreddy pushed a commit to srinivasreddy/cpython that referenced this pull request Feb 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants