mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
gh-124218: Refactor per-thread reference counting (#124844)
Currently, we only use per-thread reference counting for heap type objects and the naming reflects that. We will extend it to a few additional types in an upcoming change to avoid scaling bottlenecks when creating nested functions. Rename some of the files and functions in preparation for this change.
This commit is contained in:
parent
5aa91c56bf
commit
b482538523
15 changed files with 168 additions and 167 deletions
|
@ -3932,7 +3932,7 @@ type_new_alloc(type_new_ctx *ctx)
|
|||
et->ht_token = NULL;
|
||||
|
||||
#ifdef Py_GIL_DISABLED
|
||||
_PyType_AssignId(et);
|
||||
et->unique_id = _PyObject_AssignUniqueId((PyObject *)et);
|
||||
#endif
|
||||
|
||||
return type;
|
||||
|
@ -5026,7 +5026,7 @@ PyType_FromMetaclass(
|
|||
|
||||
#ifdef Py_GIL_DISABLED
|
||||
// Assign a type id to enable thread-local refcounting
|
||||
_PyType_AssignId(res);
|
||||
res->unique_id = _PyObject_AssignUniqueId((PyObject *)res);
|
||||
#endif
|
||||
|
||||
/* Ready the type (which includes inheritance).
|
||||
|
@ -6080,7 +6080,7 @@ type_dealloc(PyObject *self)
|
|||
Py_XDECREF(et->ht_module);
|
||||
PyMem_Free(et->_ht_tpname);
|
||||
#ifdef Py_GIL_DISABLED
|
||||
_PyType_ReleaseId(et);
|
||||
_PyObject_ReleaseUniqueId(et->unique_id);
|
||||
#endif
|
||||
et->ht_token = NULL;
|
||||
Py_TYPE(type)->tp_free((PyObject *)type);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue