mirror of
https://github.com/python/cpython.git
synced 2025-08-27 12:16:04 +00:00
gh-111968: Use per-thread freelists for dict in free-threading (gh-114323)
This commit is contained in:
parent
587d480203
commit
13907968d7
13 changed files with 75 additions and 75 deletions
|
@ -1287,7 +1287,11 @@ _PyContext_ClearFreeList(_PyFreeListState *freelist_state, int is_finalization)
|
|||
void
|
||||
_PyContext_Fini(_PyFreeListState *state)
|
||||
{
|
||||
// With Py_GIL_DISABLED:
|
||||
// the freelists for the current thread state have already been cleared.
|
||||
#ifndef Py_GIL_DISABLED
|
||||
_PyContext_ClearFreeList(state, 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1676,8 +1676,6 @@ PyUnstable_GC_VisitObjects(gcvisitobjects_t callback, void *arg)
|
|||
void
|
||||
_PyGC_ClearAllFreeLists(PyInterpreterState *interp)
|
||||
{
|
||||
_PyDict_ClearFreeList(interp);
|
||||
|
||||
HEAD_LOCK(&_PyRuntime);
|
||||
_PyThreadStateImpl *tstate = (_PyThreadStateImpl *)interp->threads.head;
|
||||
while (tstate != NULL) {
|
||||
|
|
|
@ -11,8 +11,6 @@
|
|||
void
|
||||
_PyGC_ClearAllFreeLists(PyInterpreterState *interp)
|
||||
{
|
||||
_PyDict_ClearFreeList(interp);
|
||||
|
||||
_Py_ClearFreeLists(&interp->freelist_state, 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -1461,9 +1461,12 @@ clear_datastack(PyThreadState *tstate)
|
|||
void
|
||||
_Py_ClearFreeLists(_PyFreeListState *state, int is_finalization)
|
||||
{
|
||||
// In the free-threaded build, freelists are per-PyThreadState and cleared in PyThreadState_Clear()
|
||||
// In the default build, freelists are per-interpreter and cleared in finalize_interp_types()
|
||||
_PyFloat_ClearFreeList(state, is_finalization);
|
||||
_PyTuple_ClearFreeList(state, is_finalization);
|
||||
_PyList_ClearFreeList(state, is_finalization);
|
||||
_PyDict_ClearFreeList(state, is_finalization);
|
||||
_PyContext_ClearFreeList(state, is_finalization);
|
||||
_PyAsyncGen_ClearFreeLists(state, is_finalization);
|
||||
_PyObjectStackChunk_ClearFreeList(state, is_finalization);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue