-
-
Notifications
You must be signed in to change notification settings - Fork 34.7k
gh-143732: Add tier2 specialization for TO_BOOL #148271
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
Open
eendebakpt
wants to merge
29
commits into
python:main
Choose a base branch
from
eendebakpt:to_bool_specialization
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 10 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
d35071a
Add specializations for TO_BOOL
eendebakpt 44f5c49
type information for kwargs
eendebakpt b80a79b
add tests
eendebakpt ba88f27
Merge branch 'main' into to_bool_specialization
eendebakpt 29311d8
review comments
eendebakpt e9c1e24
Merge branch 'main' into to_bool_specialization
eendebakpt 9de1c2c
fix merge conflict
eendebakpt 91334af
Merge branch 'main' into to_bool_specialization
eendebakpt 08a4535
Merge branch 'main' into to_bool_specialization
eendebakpt 62fae72
add regression test for set
eendebakpt 52f7cc6
review comments
eendebakpt 05c6089
handle set case
eendebakpt d655709
remove dead code
eendebakpt 3984a31
Merge branch 'main' into to_bool_specialization
eendebakpt 0606e89
regenerate
eendebakpt 578a6e0
Merge branch 'to_bool_specialization_v2' into to_bool_specialization
eendebakpt 1e01851
Merge remote-tracking branch 'origin/main' into to_bool_specialization
eendebakpt bb35e19
fix merge conflicts and add recording uop
eendebakpt f9a8bc5
cleanup
eendebakpt ee0325c
Merge remote-tracking branch 'origin/main' into to_bool_specializatio…
eendebakpt c7daa03
Restore test_opt.py from origin/main, re-applying TO_BOOL tests
eendebakpt e9a1e9a
add more tests, remove defensive code
eendebakpt 09c07a3
news entry
eendebakpt c64d69d
Merge remote-tracking branch 'origin/main' into to_bool_specialization
eendebakpt 06247eb
Merge branch 'main' into to_bool_specialization
eendebakpt a30ca62
Merge branch 'main' into to_bool_specialization
eendebakpt fa17d1d
Merge branch 'main' into to_bool_specialization
eendebakpt cd540b8
Merge branch 'main' into pr-148271
eendebakpt 729ecc9
add frozendict
eendebakpt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
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.
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 merge this with
_TO_BOOL_SIZEDby using the fact that both do a fixed offset lookup.In tier2 optimizer you can set the offset for where the size is stored and do
size = (Py_ssize_t)((char *)obj + offset)and check that directly.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.
I see what you mean. It goes into the internals of
PyDict(e.g. not usingPyDict_GET_SIZE, but doing manual offset calculations) and we also need to store the offset somewhere. So I think this is too much of a complication to get rid of a tier2 opcode.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 store it in the instruction operand0.