gh-111968: Split _Py_dictkeys_freelist out of _Py_dict_freelist (gh-115505)

This commit is contained in:
Donghee Na 2024-02-16 10:01:36 +09:00 committed by GitHub
parent 454d7963e3
commit 321d13fd2b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 77 additions and 59 deletions

View file

@ -130,9 +130,9 @@ PyFloat_FromDouble(double fval)
PyFloatObject *op;
#ifdef WITH_FREELISTS
struct _Py_float_freelist *float_freelist = get_float_freelist();
op = float_freelist->free_list;
op = float_freelist->items;
if (op != NULL) {
float_freelist->free_list = (PyFloatObject *) Py_TYPE(op);
float_freelist->items = (PyFloatObject *) Py_TYPE(op);
float_freelist->numfree--;
OBJECT_STAT_INC(from_freelist);
}
@ -251,8 +251,8 @@ _PyFloat_ExactDealloc(PyObject *obj)
return;
}
float_freelist->numfree++;
Py_SET_TYPE(op, (PyTypeObject *)float_freelist->free_list);
float_freelist->free_list = op;
Py_SET_TYPE(op, (PyTypeObject *)float_freelist->items);
float_freelist->items = op;
OBJECT_STAT_INC(to_freelist);
#else
PyObject_Free(op);
@ -1994,13 +1994,13 @@ _PyFloat_ClearFreeList(struct _Py_object_freelists *freelists, int is_finalizati
{
#ifdef WITH_FREELISTS
struct _Py_float_freelist *state = &freelists->floats;
PyFloatObject *f = state->free_list;
PyFloatObject *f = state->items;
while (f != NULL) {
PyFloatObject *next = (PyFloatObject*) Py_TYPE(f);
PyObject_Free(f);
f = next;
}
state->free_list = NULL;
state->items = NULL;
if (is_finalization) {
state->numfree = -1;
}