gh-111968: Use per-thread freelists for float in free-threading (gh-113886)

This commit is contained in:
Donghee Na 2024-01-11 00:47:13 +09:00 committed by GitHub
parent a0c9cf9456
commit f728f7242c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 43 additions and 59 deletions

View file

@ -8,14 +8,14 @@ extern "C" {
# error "this header requires Py_BUILD_CORE define"
#endif
#include "pycore_freelist.h" // _PyFreeListState
#include "pycore_unicodeobject.h" // _PyUnicodeWriter
/* runtime lifecycle */
extern void _PyFloat_InitState(PyInterpreterState *);
extern PyStatus _PyFloat_InitTypes(PyInterpreterState *);
extern void _PyFloat_Fini(PyInterpreterState *);
extern void _PyFloat_Fini(_PyFreeListState *);
extern void _PyFloat_FiniType(PyInterpreterState *);
@ -33,24 +33,7 @@ struct _Py_float_runtime_state {
};
#ifndef WITH_FREELISTS
// without freelists
# define PyFloat_MAXFREELIST 0
#endif
#ifndef PyFloat_MAXFREELIST
# define PyFloat_MAXFREELIST 100
#endif
struct _Py_float_state {
#if PyFloat_MAXFREELIST > 0
/* Special free list
free_list is a singly-linked list of available PyFloatObjects,
linked via abuse of their ob_type members. */
int numfree;
PyFloatObject *free_list;
#endif
};
void _PyFloat_ExactDealloc(PyObject *op);