Debian Codegraph @

Include/internal/pycore_freelist_state.h

raw
1 #ifndef Py_INTERNAL_FREELIST_STATE_H
2 #define Py_INTERNAL_FREELIST_STATE_H
3 #ifdef __cplusplus
4 extern "C" {
5 #endif
6
7 #ifndef Py_BUILD_CORE
8 # error "this header requires Py_BUILD_CORE define"
9 #endif
10
11 # define PyTuple_MAXSAVESIZE 20 // Largest tuple to save on freelist
12 # define Py_tuple_MAXFREELIST 2000 // Maximum number of tuples of each size to save
13 # define Py_lists_MAXFREELIST 80
14 # define Py_list_iters_MAXFREELIST 10
15 # define Py_tuple_iters_MAXFREELIST 10
16 # define Py_dicts_MAXFREELIST 80
17 # define Py_dictkeys_MAXFREELIST 80
18 # define Py_floats_MAXFREELIST 100
19 # define Py_ints_MAXFREELIST 100
20 # define Py_slices_MAXFREELIST 1
21 # define Py_ranges_MAXFREELIST 6
22 # define Py_range_iters_MAXFREELIST 6
23 # define Py_contexts_MAXFREELIST 255
24 # define Py_async_gens_MAXFREELIST 80
25 # define Py_async_gen_asends_MAXFREELIST 80
26 # define Py_futureiters_MAXFREELIST 255
27 # define Py_object_stack_chunks_MAXFREELIST 4
28 # define Py_unicode_writers_MAXFREELIST 1
29 # define Py_pycfunctionobject_MAXFREELIST 16
30 # define Py_pycmethodobject_MAXFREELIST 16
31 # define Py_pymethodobjects_MAXFREELIST 20
32
33 // A generic freelist of either PyObjects or other data structures.
34 struct _Py_freelist {
35 // Entries are linked together using the first word of the object.
36 // For PyObjects, this overlaps with the `ob_refcnt` field or the `ob_tid`
37 // field.
38 void *freelist;
39
40 // The number of items in the free list or -1 if the free list is disabled
41 Py_ssize_t size;
42 };
43
44 struct _Py_freelists {
45 struct _Py_freelist floats;
46 struct _Py_freelist ints;
47 struct _Py_freelist tuples[PyTuple_MAXSAVESIZE];
48 struct _Py_freelist lists;
49 struct _Py_freelist list_iters;
50 struct _Py_freelist tuple_iters;
51 struct _Py_freelist dicts;
52 struct _Py_freelist dictkeys;
53 struct _Py_freelist slices;
54 struct _Py_freelist ranges;
55 struct _Py_freelist range_iters;
56 struct _Py_freelist contexts;
57 struct _Py_freelist async_gens;
58 struct _Py_freelist async_gen_asends;
59 struct _Py_freelist futureiters;
60 struct _Py_freelist object_stack_chunks;
61 struct _Py_freelist unicode_writers;
62 struct _Py_freelist pycfunctionobject;
63 struct _Py_freelist pycmethodobject;
64 struct _Py_freelist pymethodobjects;
65 };
66
67 #ifdef __cplusplus
68 }
69 #endif
70 #endif /* !Py_INTERNAL_FREELIST_STATE_H */