summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-06-04 23:39:24 (GMT)
committerGitHub <noreply@github.com>2020-06-04 23:39:24 (GMT)
commit3744ed2c9c0b3905947602fc375de49533790cb9 (patch)
treef2086f04a9edd9875c6f0ec2eb1f2f0d6e85aa41 /Include
parent7daba6f221e713f7f60c613b246459b07d179f91 (diff)
downloadcpython-3744ed2c9c0b3905947602fc375de49533790cb9.zip
cpython-3744ed2c9c0b3905947602fc375de49533790cb9.tar.gz
cpython-3744ed2c9c0b3905947602fc375de49533790cb9.tar.bz2
bpo-40521: Make frame free list per-interpreter (GH-20638)
Each interpreter now has its own frame free list: * Move frame free list into PyInterpreterState. * Add _Py_frame_state structure. * Add tstate parameter to _PyFrame_ClearFreeList() and _PyFrame_Fini(). * Remove "#if PyFrame_MAXFREELIST > 0". * Remove "#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS".
Diffstat (limited to 'Include')
-rw-r--r--Include/internal/pycore_gc.h2
-rw-r--r--Include/internal/pycore_interp.h7
-rw-r--r--Include/internal/pycore_pylifecycle.h2
3 files changed, 9 insertions, 2 deletions
diff --git a/Include/internal/pycore_gc.h b/Include/internal/pycore_gc.h
index f90d80b..01265d3 100644
--- a/Include/internal/pycore_gc.h
+++ b/Include/internal/pycore_gc.h
@@ -165,7 +165,7 @@ PyAPI_FUNC(void) _PyGC_InitState(struct _gc_runtime_state *);
// Functions to clear types free lists
-extern void _PyFrame_ClearFreeList(void);
+extern void _PyFrame_ClearFreeList(PyThreadState *tstate);
extern void _PyTuple_ClearFreeList(PyThreadState *tstate);
extern void _PyFloat_ClearFreeList(PyThreadState *tstate);
extern void _PyList_ClearFreeList(void);
diff --git a/Include/internal/pycore_interp.h b/Include/internal/pycore_interp.h
index 70054ef..9b805f0 100644
--- a/Include/internal/pycore_interp.h
+++ b/Include/internal/pycore_interp.h
@@ -92,6 +92,12 @@ struct _Py_float_state {
PyFloatObject *free_list;
};
+struct _Py_frame_state {
+ PyFrameObject *free_list;
+ /* number of frames currently in free_list */
+ int numfree;
+};
+
/* interpreter state */
@@ -187,6 +193,7 @@ struct _is {
#endif
struct _Py_tuple_state tuple;
struct _Py_float_state float_state;
+ struct _Py_frame_state frame;
/* Using a cache is very effective since typically only a single slice is
created and then deleted again. */
diff --git a/Include/internal/pycore_pylifecycle.h b/Include/internal/pycore_pylifecycle.h
index bba9bd9..06d2ac1 100644
--- a/Include/internal/pycore_pylifecycle.h
+++ b/Include/internal/pycore_pylifecycle.h
@@ -58,7 +58,7 @@ extern PyStatus _PyGC_Init(PyThreadState *tstate);
/* Various internal finalizers */
-extern void _PyFrame_Fini(void);
+extern void _PyFrame_Fini(PyThreadState *tstate);
extern void _PyDict_Fini(void);
extern void _PyTuple_Fini(PyThreadState *tstate);
extern void _PyList_Fini(void);