mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
gh-131586: Avoid refcount contention in some "special" calls (#131588)
In the free threaded build, the `_PyObject_LookupSpecial()` call can lead to reference count contention on the returned function object becuase it doesn't use stackrefs. Refactor some of the callers to use `_PyObject_MaybeCallSpecialNoArgs`, which uses stackrefs internally. This fixes the scaling bottleneck in the "lookup_special" microbenchmark in `ftscalingbench.py`. However, the are still some uses of `_PyObject_LookupSpecial()` that need to be addressed in future PRs.
This commit is contained in:
parent
3d4ac1a2c2
commit
67fbfb42bd
16 changed files with 450 additions and 374 deletions
|
|
@ -89,6 +89,7 @@ struct _Py_global_strings {
|
|||
STRUCT_FOR_ID(__bytes__)
|
||||
STRUCT_FOR_ID(__call__)
|
||||
STRUCT_FOR_ID(__cantrace__)
|
||||
STRUCT_FOR_ID(__ceil__)
|
||||
STRUCT_FOR_ID(__class__)
|
||||
STRUCT_FOR_ID(__class_getitem__)
|
||||
STRUCT_FOR_ID(__classcell__)
|
||||
|
|
@ -113,6 +114,7 @@ struct _Py_global_strings {
|
|||
STRUCT_FOR_ID(__file__)
|
||||
STRUCT_FOR_ID(__firstlineno__)
|
||||
STRUCT_FOR_ID(__float__)
|
||||
STRUCT_FOR_ID(__floor__)
|
||||
STRUCT_FOR_ID(__floordiv__)
|
||||
STRUCT_FOR_ID(__format__)
|
||||
STRUCT_FOR_ID(__fspath__)
|
||||
|
|
@ -218,6 +220,7 @@ struct _Py_global_strings {
|
|||
STRUCT_FOR_ID(__subclasscheck__)
|
||||
STRUCT_FOR_ID(__subclasshook__)
|
||||
STRUCT_FOR_ID(__truediv__)
|
||||
STRUCT_FOR_ID(__trunc__)
|
||||
STRUCT_FOR_ID(__type_params__)
|
||||
STRUCT_FOR_ID(__typing_is_unpacked_typevartuple__)
|
||||
STRUCT_FOR_ID(__typing_prepare_subst__)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue