| #ifndef Py_INTERNAL_FREELIST_H |
| #define Py_INTERNAL_FREELIST_H |
| #ifdef __cplusplus |
| extern "C" { |
| #endif |
|
|
| #ifndef Py_BUILD_CORE |
| # error "this header requires Py_BUILD_CORE define" |
| #endif |
|
|
| |
| |
|
|
| #ifdef WITH_FREELISTS |
| |
| # define PyTuple_MAXSAVESIZE 20 |
| # define PyTuple_NFREELISTS PyTuple_MAXSAVESIZE |
| # define PyTuple_MAXFREELIST 2000 |
| # define PyList_MAXFREELIST 80 |
| # define PyDict_MAXFREELIST 80 |
| # define PyFloat_MAXFREELIST 100 |
| # define PyContext_MAXFREELIST 255 |
| # define _PyAsyncGen_MAXFREELIST 80 |
| # define _PyObjectStackChunk_MAXFREELIST 4 |
| #else |
| # define PyTuple_NFREELISTS 0 |
| # define PyTuple_MAXFREELIST 0 |
| # define PyList_MAXFREELIST 0 |
| # define PyDict_MAXFREELIST 0 |
| # define PyFloat_MAXFREELIST 0 |
| # define PyContext_MAXFREELIST 0 |
| # define _PyAsyncGen_MAXFREELIST 0 |
| # define _PyObjectStackChunk_MAXFREELIST 0 |
| #endif |
|
|
| struct _Py_list_freelist { |
| #ifdef WITH_FREELISTS |
| PyListObject *items[PyList_MAXFREELIST]; |
| int numfree; |
| #endif |
| }; |
|
|
| struct _Py_tuple_freelist { |
| #if WITH_FREELISTS |
| |
| |
| |
| |
| |
| |
| |
| |
| PyTupleObject *items[PyTuple_NFREELISTS]; |
| int numfree[PyTuple_NFREELISTS]; |
| #else |
| char _unused; |
| #endif |
| }; |
|
|
| struct _Py_float_freelist { |
| #ifdef WITH_FREELISTS |
| |
| |
| |
| int numfree; |
| PyFloatObject *items; |
| #endif |
| }; |
|
|
| struct _Py_dict_freelist { |
| #ifdef WITH_FREELISTS |
| |
| PyDictObject *items[PyDict_MAXFREELIST]; |
| int numfree; |
| #endif |
| }; |
|
|
| struct _Py_dictkeys_freelist { |
| #ifdef WITH_FREELISTS |
| |
| PyDictKeysObject *items[PyDict_MAXFREELIST]; |
| int numfree; |
| #endif |
| }; |
|
|
| struct _Py_slice_freelist { |
| #ifdef WITH_FREELISTS |
| |
| |
| PySliceObject *slice_cache; |
| #endif |
| }; |
|
|
| struct _Py_context_freelist { |
| #ifdef WITH_FREELISTS |
| |
| PyContext *items; |
| int numfree; |
| #endif |
| }; |
|
|
| struct _Py_async_gen_freelist { |
| #ifdef WITH_FREELISTS |
| |
| |
| |
| |
| struct _PyAsyncGenWrappedValue* items[_PyAsyncGen_MAXFREELIST]; |
| int numfree; |
| #endif |
| }; |
|
|
| struct _Py_async_gen_asend_freelist { |
| #ifdef WITH_FREELISTS |
| struct PyAsyncGenASend* items[_PyAsyncGen_MAXFREELIST]; |
| int numfree; |
| #endif |
| }; |
|
|
| struct _PyObjectStackChunk; |
|
|
| struct _Py_object_stack_freelist { |
| struct _PyObjectStackChunk *items; |
| Py_ssize_t numfree; |
| }; |
|
|
| struct _Py_object_freelists { |
| struct _Py_float_freelist floats; |
| struct _Py_tuple_freelist tuples; |
| struct _Py_list_freelist lists; |
| struct _Py_dict_freelist dicts; |
| struct _Py_dictkeys_freelist dictkeys; |
| struct _Py_slice_freelist slices; |
| struct _Py_context_freelist contexts; |
| struct _Py_async_gen_freelist async_gens; |
| struct _Py_async_gen_asend_freelist async_gen_asends; |
| struct _Py_object_stack_freelist object_stacks; |
| }; |
|
|
| extern void _PyObject_ClearFreeLists(struct _Py_object_freelists *freelists, int is_finalization); |
| extern void _PyTuple_ClearFreeList(struct _Py_object_freelists *freelists, int is_finalization); |
| extern void _PyFloat_ClearFreeList(struct _Py_object_freelists *freelists, int is_finalization); |
| extern void _PyList_ClearFreeList(struct _Py_object_freelists *freelists, int is_finalization); |
| extern void _PySlice_ClearFreeList(struct _Py_object_freelists *freelists, int is_finalization); |
| extern void _PyDict_ClearFreeList(struct _Py_object_freelists *freelists, int is_finalization); |
| extern void _PyAsyncGen_ClearFreeLists(struct _Py_object_freelists *freelists, int is_finalization); |
| extern void _PyContext_ClearFreeList(struct _Py_object_freelists *freelists, int is_finalization); |
| extern void _PyObjectStackChunk_ClearFreeList(struct _Py_object_freelists *freelists, int is_finalization); |
|
|
| #ifdef __cplusplus |
| } |
| #endif |
| #endif |
|
|