-
-
Notifications
You must be signed in to change notification settings - Fork 31k
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: Move labels in ceval.c to bytecodes.c #129112
base: main
Are you sure you want to change the base?
Conversation
Fidget-Spinner
commented
Jan 21, 2025
•
edited by bedevere-app
bot
Loading
edited by bedevere-app
bot
- Issue: A new tail-calling interpreter for significantly better interpreter performance #128563
I don't think adding another code generator is the way to go. For code in labels we will, in the future, want to:
I'm not suggesting that we do any of the above in this PR. The simple code you generate is fine for now, but it needs to be a bit more closely integrated into the interpreter/JIT generators. Since labels exist outside the dispatch loop, we'll need to generate the dispatch loop as well. We can simply copy the few lines of code surrounding The tier 1 code generator would then generate:
|
Alright. I've moved the labels generator back into the tier 1 generator. We need to port over tier 2 in a separate PR as well. I've combined the switch-case generator into the cases generator as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly looks good. One thing doesn't look right
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding the markers to the generated code for testing looks good, but the parsing in the test is a bit cumbersome.
Lib/test/test_generated_cases.py
Outdated
@@ -253,6 +253,23 @@ def run_cases_test(self, input: str, expected: str): | |||
lines.pop(0) | |||
while lines and lines[-1].startswith(("#", "\n")): | |||
lines.pop(-1) | |||
while lines and tier1_generator.INSTRUCTION_START_MARKER not in lines[0]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can replace this line by line processing, including the start and end comment stripping, by splitting the whole file on INSTRUCTION_START_MARKER
and INSTRUCTION_START_MARKER
, discarding the first and last parts.
text = temp_output.read()
_, rest = text.split(INSTRUCTION_START_MARKER)
actual, _ = rest.split(LABEL_START_MARKER)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good observation. Thanks!
When you're done making the requested changes, leave the comment: |