-
-
Notifications
You must be signed in to change notification settings - Fork 30.8k
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-115999: Specialize LOAD_ATTR
for instance and class receivers in free-threaded builds
#128164
Open
mpage
wants to merge
57
commits into
python:main
Choose a base branch
from
mpage:gh-115999-load-attr-instance-merged
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.
+577
−211
Open
Changes from 54 commits
Commits
Show all changes
57 commits
Select commit
Hold shift + click to select a range
8eeb4fe
Add _PyDictKeys_StringLookupAndVersion
mpage fcd05a0
Pass shared keys version to specialization
mpage 5c03db0
Add support for enabling each of the instance attribute kinds
mpage a576748
Only cache deferred descriptors
mpage 8475fd6
Make analyze_descriptor thread-safe
mpage 29c3356
Use an atomic load for GUARD_TYPE_VERSION
mpage 4f9eeb3
Use atomics to load valid bit for inline values in _GUARD_DORV_VALUES…
mpage e9050fc
Use atomic to load keys version in _GUARD_KEYS_VERSION
mpage ade57f2
Use an atomic load for managed dict in `_CHECK_ATTR_METHOD_LAZY_DICT`
mpage 0a87264
Enable specialization of method loads
mpage 816e22f
Use atomics for fetching type flags
mpage ca1e232
Get a strong reference to dict in instance_has_key
mpage 945b61c
Split specialize_dict_access
mpage feb7d34
Pass type version to specialize_dict_access
mpage ecfd199
Take a critical section around dict specialization
mpage 9fda5db
Use thread-safe version of _PyDictKeys_StringLookup
mpage 3b2c220
Use atomic load in _CHECK_MANAGED_OBJECT_HAS_VALUES
mpage 408e44b
Make _LOAD_ATTR_INSTANCE_VALUE thread-safe
mpage 16aab70
Make _LOAD_ATTR_WITH_HINT thread-safe
mpage d0920ea
Specialize instance accesses
mpage e7cea82
Specialize LOAD_ATTR_SLOT
mpage 8dac8c4
Enable LOAD_ATTR_PROPERTY
mpage d29b3aa
Checkpoint LOAD_ATTR_GETATTRIBUTE_OVERRIDEN
mpage b0b8102
Lock dict in instance_has_key
mpage 85dab0d
Lock dict instead of owner when specializing for dict access
mpage 581869e
Use atomic load for valid bit
mpage 96be738
Use _PyDictKeys_StringLookup and lock around it, rather than wasting …
mpage 9afe052
Fix cases_generator bug
mpage e190a0d
Fix load
mpage 8c78369
Remove FT_UNIMPLEMENTED
mpage cdf8eb5
Specialize class attribute loads
mpage 1398699
Fix test_type_lookup_mro_reference
mpage 3fbe18b
Remove TYPE_CHANGED
mpage 5aa68cc
Misc clean ups
mpage e1bf1f4
Check that inline values still valid after taking CS
mpage 396edb1
Enable test_opcache tests
mpage e5e2508
Skip test that triggers gh-127773 in refleak tests
mpage fa02260
Merge branch 'main' into gh-115999-load-attr
mpage 47c794f
Add test for LOAD_ATTR_CLASS_WITH_METACLASS_CHECK
mpage 3876bc7
Undo workaround for cases generator bug
mpage 08d14d0
Fix whitespace after merge
mpage 56e9a8a
Double check that dict hasn't changed after locking it
mpage 8ca405b
Use correct type for loading type version
mpage 4c7a4b9
Remove unnecessary comma
mpage 1b787b3
Use atomics when loading oparg
mpage b868363
Fix formatting
mpage d6d4c73
Always return type version from analyze_descriptor_load
mpage 9755562
Merge branch 'main' into gh-115999-load-attr-instance-merged
mpage 9673f78
Combine incref/steal into new stackref
mpage 6c3041f
Fix formatting
mpage a20a4a4
Remove unnecessary error check for PyUnicode_Type.tp_hash
mpage 35b31c6
Check keys kind explicitly
mpage e5a7ae9
Pass dict from `_CHECK_ATTR_WITH_HINT` to `_LOAD_ATTR_WITH_HINT`
mpage bb00f5a
Fix unused variable warning
mpage b6ae487
Update number of specialization failure kinds
mpage 11a351d
Clarify construction of deferred object
mpage 6f8aebf
Add suppression for _PyUnicode_CheckConsistency
mpage 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
This file contains 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.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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 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 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 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 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
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.
This looks a bit mysterious to me. Does this do something different than what
class a: [...]
does? Calling it an instance (which techically true) is a bit confusing too. I would just say a "set to an object that uses ...". It's a class object. If you need it written like this, I think a little helper function with a docstring explaining why it must be done that way would help: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.
Ah, I see later there is
item.a = type("Foo", (object,), {})
so you want an expression not a statement.