GH-128914: Remove conditional stack effects from bytecodes.c and the code generators#128918
Merged
markshannon merged 21 commits intopython:mainfrom Jan 20, 2025
Merged
Conversation
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.
This PR:
LOAD_ATTRintoLOAD_ATTRandLOAD_METHOD. The specializations split neatly between the two, so no new specializations are needed.LOAD_SUPER_ATTRintoLOAD_SUPER_ATTRandLOAD_SUPER_METHOD. This is a bit wasteful asLOAD_SUPER_ATTRis quite rare and it needs an additional instrumented instruction as well. It might be worth trying to merge them somehow in another PR later on but doing so now would complicate this PR unnecessarily.Performance is 0.4% slower which is, I think, acceptable given the potential speedups from top of stack caching.
The slowdown appears to be mostly a result of the large number of extra
PUSH_NULLinstructions required. There are ways to mitigate this, but not in this PR.