aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Python/pystate.c
diff options
context:
space:
mode:
authorSam Gross <colesbury@gmail.com>2024-10-01 13:05:42 -0400
committerGitHub <noreply@github.com>2024-10-01 17:05:42 +0000
commitb48253852341c01309b0598852841cd89bc28afd (patch)
tree01282cac5ec10baf98a63b76b95041415f6e8048 /Python/pystate.c
parent5aa91c56bf14c38b4c7f5ccaaa3cd24fe3fb0f04 (diff)
downloadcpython-b48253852341c01309b0598852841cd89bc28afd.tar.gz
cpython-b48253852341c01309b0598852841cd89bc28afd.zip
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.
Diffstat (limited to 'Python/pystate.c')
-rw-r--r--Python/pystate.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Python/pystate.c b/Python/pystate.c
index 6b85e5a64fe..9d11e2d2549 100644
--- a/Python/pystate.c
+++ b/Python/pystate.c
@@ -20,7 +20,7 @@
#include "pycore_runtime_init.h" // _PyRuntimeState_INIT
#include "pycore_sysmodule.h" // _PySys_Audit()
#include "pycore_obmalloc.h" // _PyMem_obmalloc_state_on_heap()
-#include "pycore_typeid.h" // _PyType_FinalizeThreadLocalRefcounts()
+#include "pycore_uniqueid.h" // _PyType_FinalizeThreadLocalRefcounts()
/* --------------------------------------------------------------------------
CAUTION
@@ -1745,7 +1745,7 @@ PyThreadState_Clear(PyThreadState *tstate)
// Merge our thread-local refcounts into the type's own refcount and
// free our local refcount array.
- _PyType_FinalizeThreadLocalRefcounts((_PyThreadStateImpl *)tstate);
+ _PyObject_FinalizePerThreadRefcounts((_PyThreadStateImpl *)tstate);
// Remove ourself from the biased reference counting table of threads.
_Py_brc_remove_thread(tstate);
@@ -1805,7 +1805,7 @@ tstate_delete_common(PyThreadState *tstate, int release_gil)
_PyThreadStateImpl *tstate_impl = (_PyThreadStateImpl *)tstate;
tstate->interp->object_state.reftotal += tstate_impl->reftotal;
tstate_impl->reftotal = 0;
- assert(tstate_impl->types.refcounts == NULL);
+ assert(tstate_impl->refcounts.values == NULL);
#endif
HEAD_UNLOCK(runtime);