GH-132732: Use pure op machinery to optimize various instructions with _POP_TOP and _POP_TWO #137577
Merged
savannahostrowski merged 21 commits intopython:mainfrom Sep 15, 2025
Merged
Conversation
_POP_TOP and _POP_TWO relevant instructions_POP_TOP and _POP_TWO
brandtbucher
requested changes
Aug 9, 2025
Member
brandtbucher
left a comment
There was a problem hiding this comment.
This is super cool! Just a quick run-through for now:
Misc/NEWS.d/next/Core_and_Builtins/2025-08-09-04-07-05.gh-issue-132732.8BiIVJ.rst
Outdated
Show resolved
Hide resolved
|
When you're done making the requested changes, leave the comment: |
Member
Fidget-Spinner
left a comment
There was a problem hiding this comment.
Very cool, just one nit.
Fidget-Spinner
approved these changes
Aug 11, 2025
Member
Author
|
@brandtbucher Do you want to take another look at this? |
brandtbucher
approved these changes
Sep 15, 2025
Member
brandtbucher
left a comment
There was a problem hiding this comment.
Looks good! Just a few suggestions for comments and cleaning up the generated code.
Python/optimizer_cases.c.h
Outdated
Comment on lines
205
to
211
| if (sym_is_const(ctx, res)) { | ||
| PyObject *result = sym_get_const(ctx, res); | ||
| if (_Py_IsImmortal(result)) { | ||
| // Replace with _POP_TOP_LOAD_CONST_INLINE_BORROW since we have one input and an immortal result | ||
| REPLACE_OP(this_instr, _POP_TOP_LOAD_CONST_INLINE_BORROW, 0, (uintptr_t)result); | ||
| } | ||
| } |
Member
There was a problem hiding this comment.
Still seeing weird indent here, maybe dedent the string in the cases generator?
brandtbucher
approved these changes
Sep 15, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.