mirror of
https://github.com/python/cpython.git
synced 2025-07-19 09:15:34 +00:00
gh-111968: Use per-thread freelists for generator in free-threading (gh-114189)
This commit is contained in:
parent
2d3f6b56c5
commit
7fa511ba57
9 changed files with 48 additions and 74 deletions
|
@ -15,7 +15,6 @@ void
|
|||
_PyGC_ClearAllFreeLists(PyInterpreterState *interp)
|
||||
{
|
||||
_PyDict_ClearFreeList(interp);
|
||||
_PyAsyncGen_ClearFreeLists(interp);
|
||||
|
||||
HEAD_LOCK(&_PyRuntime);
|
||||
_PyThreadStateImpl *tstate = (_PyThreadStateImpl *)interp->threads.head;
|
||||
|
|
|
@ -12,7 +12,6 @@ void
|
|||
_PyGC_ClearAllFreeLists(PyInterpreterState *interp)
|
||||
{
|
||||
_PyDict_ClearFreeList(interp);
|
||||
_PyAsyncGen_ClearFreeLists(interp);
|
||||
|
||||
_Py_ClearFreeLists(&interp->freelist_state, 0);
|
||||
}
|
||||
|
|
|
@ -1735,7 +1735,6 @@ finalize_interp_types(PyInterpreterState *interp)
|
|||
_PySys_FiniTypes(interp);
|
||||
_PyXI_FiniTypes(interp);
|
||||
_PyExc_Fini(interp);
|
||||
_PyAsyncGen_Fini(interp);
|
||||
_PyFloat_FiniType(interp);
|
||||
_PyLong_FiniTypes(interp);
|
||||
_PyThread_FiniType(interp);
|
||||
|
@ -1759,6 +1758,7 @@ finalize_interp_types(PyInterpreterState *interp)
|
|||
_PyFloat_Fini(state);
|
||||
_PySlice_Fini(state);
|
||||
_PyContext_Fini(state);
|
||||
_PyAsyncGen_Fini(state);
|
||||
|
||||
#ifdef Py_DEBUG
|
||||
_PyStaticObjects_CheckRefcnt(interp);
|
||||
|
|
|
@ -1462,6 +1462,7 @@ _Py_ClearFreeLists(_PyFreeListState *state, int is_finalization)
|
|||
_PyTuple_ClearFreeList(state, is_finalization);
|
||||
_PyList_ClearFreeList(state, is_finalization);
|
||||
_PyContext_ClearFreeList(state, is_finalization);
|
||||
_PyAsyncGen_ClearFreeLists(state, is_finalization);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1549,7 +1550,7 @@ PyThreadState_Clear(PyThreadState *tstate)
|
|||
#ifdef Py_GIL_DISABLED
|
||||
// Each thread should clear own freelists in free-threading builds.
|
||||
_PyFreeListState *freelist_state = &((_PyThreadStateImpl*)tstate)->freelist_state;
|
||||
_Py_ClearFreeLists(freelist_state, 0);
|
||||
_Py_ClearFreeLists(freelist_state, 1);
|
||||
_PySlice_ClearCache(freelist_state);
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue