diff options
author | Neil Schemenauer <nas-github@arctrix.com> | 2024-12-19 10:21:17 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-19 10:21:17 -0800 |
commit | 1b15c89a17ca3de6b05de5379b8717e9738c51ef (patch) | |
tree | 00a4ea63dec7879e81d2ea3d75f43cb8a03ee1b5 /Python/optimizer_cases.c.h | |
parent | d2f1d917e8b3d2dd8f35495c7632a32688883332 (diff) | |
download | cpython-1b15c89a17ca3de6b05de5379b8717e9738c51ef.tar.gz cpython-1b15c89a17ca3de6b05de5379b8717e9738c51ef.zip |
gh-115999: Specialize `STORE_ATTR` in free-threaded builds. (gh-127838)
* Add `_PyDictKeys_StringLookupSplit` which does locking on dict keys and
use in place of `_PyDictKeys_StringLookup`.
* Change `_PyObject_TryGetInstanceAttribute` to use that function
in the case of split keys.
* Add `unicodekeys_lookup_split` helper which allows code sharing
between `_Py_dict_lookup` and `_PyDictKeys_StringLookupSplit`.
* Fix locking for `STORE_ATTR_INSTANCE_VALUE`. Create
`_GUARD_TYPE_VERSION_AND_LOCK` uop so that object stays locked and
`tp_version_tag` cannot change.
* Pass `tp_version_tag` to `specialize_dict_access()`, ensuring
the version we store on the cache is the correct one (in case of
it changing during the specalize analysis).
* Split `analyze_descriptor` into `analyze_descriptor_load` and
`analyze_descriptor_store` since those don't share much logic.
Add `descriptor_is_class` helper function.
* In `specialize_dict_access`, double check `_PyObject_GetManagedDict()`
in case we race and dict was materialized before the lock.
* Avoid borrowed references in `_Py_Specialize_StoreAttr()`.
* Use `specialize()` and `unspecialize()` helpers.
* Add unit tests to ensure specializing happens as expected in FT builds.
* Add unit tests to attempt to trigger data races (useful for running under TSAN).
* Add `has_split_table` function to `_testinternalcapi`.
Diffstat (limited to 'Python/optimizer_cases.c.h')
-rw-r--r-- | Python/optimizer_cases.c.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Python/optimizer_cases.c.h b/Python/optimizer_cases.c.h index 2c3133d7107..b46079ec8a1 100644 --- a/Python/optimizer_cases.c.h +++ b/Python/optimizer_cases.c.h @@ -1121,6 +1121,10 @@ break; } + case _GUARD_TYPE_VERSION_AND_LOCK: { + break; + } + case _CHECK_MANAGED_OBJECT_HAS_VALUES: { break; } |