Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1b15c89

Browse files
authored
gh-115999: SpecializeSTORE_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`.
1 parentd2f1d91 commit1b15c89

File tree

13 files changed

+716
-297
lines changed

13 files changed

+716
-297
lines changed

‎Include/internal/pycore_dict.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ extern Py_ssize_t _Py_dict_lookup_threadsafe_stackref(PyDictObject *mp, PyObject
114114

115115
externPy_ssize_t_PyDict_LookupIndex(PyDictObject*,PyObject*);
116116
externPy_ssize_t_PyDictKeys_StringLookup(PyDictKeysObject*dictkeys,PyObject*key);
117+
externPy_ssize_t_PyDictKeys_StringLookupSplit(PyDictKeysObject*dictkeys,PyObject*key);
117118
PyAPI_FUNC(PyObject*)_PyDict_LoadGlobal(PyDictObject*,PyDictObject*,PyObject*);
118119
PyAPI_FUNC(void)_PyDict_LoadGlobalStackRef(PyDictObject*,PyDictObject*,PyObject*,_PyStackRef*);
119120

‎Include/internal/pycore_opcode_metadata.h

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎Include/internal/pycore_uop_ids.h

Lines changed: 101 additions & 100 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎Include/internal/pycore_uop_metadata.h

Lines changed: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp