mirror of
https://github.com/python/cpython.git
synced 2025-11-02 03:01:58 +00:00
gh-111968: Use per-thread freelists for float in free-threading (gh-113886)
This commit is contained in:
parent
a0c9cf9456
commit
f728f7242c
9 changed files with 43 additions and 59 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue