summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2021-11-29 12:34:59 (GMT)
committerGitHub <noreply@github.com>2021-11-29 12:34:59 (GMT)
commit60929576e40038ec71d896230f69e4411c82be4b (patch)
tree34dc24d0a73ef0205514202820d66c152260dc22 /Include
parent7431448b817d3bf87f71661cf8f3d537807ab2e2 (diff)
downloadcpython-60929576e40038ec71d896230f69e4411c82be4b.zip
cpython-60929576e40038ec71d896230f69e4411c82be4b.tar.gz
cpython-60929576e40038ec71d896230f69e4411c82be4b.tar.bz2
bpo-45786: Allocate space for frame in frame object. (GH-29729)
Diffstat (limited to 'Include')
-rw-r--r--Include/cpython/frameobject.h6
-rw-r--r--Include/internal/pycore_frame.h7
-rw-r--r--Include/internal/pycore_gc.h1
-rw-r--r--Include/internal/pycore_interp.h14
4 files changed, 7 insertions, 21 deletions
diff --git a/Include/cpython/frameobject.h b/Include/cpython/frameobject.h
index e4cfac5..67f98a7 100644
--- a/Include/cpython/frameobject.h
+++ b/Include/cpython/frameobject.h
@@ -12,7 +12,9 @@ struct _frame {
int f_lineno; /* Current line number. Only valid if non-zero */
char f_trace_lines; /* Emit per-line trace events? */
char f_trace_opcodes; /* Emit per-opcode trace events? */
- char f_own_locals_memory; /* This frame owns the memory for the locals */
+ char f_owns_frame; /* This frame owns the frame */
+ /* The frame data, if this frame object owns the frame */
+ PyObject *_f_frame_data[1];
};
/* Standard object interface */
@@ -26,7 +28,7 @@ PyAPI_FUNC(PyFrameObject *) PyFrame_New(PyThreadState *, PyCodeObject *,
/* only internal use */
PyFrameObject*
-_PyFrame_New_NoTrack(struct _interpreter_frame *, int);
+_PyFrame_New_NoTrack(PyCodeObject *code);
/* The rest of the interface is specific for frame objects */
diff --git a/Include/internal/pycore_frame.h b/Include/internal/pycore_frame.h
index e36241f..0015de8 100644
--- a/Include/internal/pycore_frame.h
+++ b/Include/internal/pycore_frame.h
@@ -69,8 +69,7 @@ static inline void _PyFrame_StackPush(InterpreterFrame *f, PyObject *value) {
#define FRAME_SPECIALS_SIZE ((sizeof(InterpreterFrame)-1)/sizeof(PyObject *))
-InterpreterFrame *
-_PyInterpreterFrame_HeapAlloc(PyFunctionObject *func, PyObject *locals);
+InterpreterFrame *_PyFrame_Copy(InterpreterFrame *frame);
static inline void
_PyFrame_InitializeSpecials(
@@ -139,8 +138,8 @@ _PyFrame_GetFrameObject(InterpreterFrame *frame)
* take should be set to 1 for heap allocated
* frames like the ones in generators and coroutines.
*/
-int
-_PyFrame_Clear(InterpreterFrame * frame, int take);
+void
+_PyFrame_Clear(InterpreterFrame * frame);
int
_PyFrame_Traverse(InterpreterFrame *frame, visitproc visit, void *arg);
diff --git a/Include/internal/pycore_gc.h b/Include/internal/pycore_gc.h
index 45e85b5..129d539 100644
--- a/Include/internal/pycore_gc.h
+++ b/Include/internal/pycore_gc.h
@@ -167,7 +167,6 @@ extern Py_ssize_t _PyGC_CollectNoFail(PyThreadState *tstate);
// Functions to clear types free lists
-extern void _PyFrame_ClearFreeList(PyInterpreterState *interp);
extern void _PyTuple_ClearFreeList(PyInterpreterState *interp);
extern void _PyFloat_ClearFreeList(PyInterpreterState *interp);
extern void _PyList_ClearFreeList(PyInterpreterState *interp);
diff --git a/Include/internal/pycore_interp.h b/Include/internal/pycore_interp.h
index 18f2143..f52ee59 100644
--- a/Include/internal/pycore_interp.h
+++ b/Include/internal/pycore_interp.h
@@ -93,7 +93,6 @@ struct _Py_unicode_state {
# define PyTuple_MAXFREELIST 1
# define PyList_MAXFREELIST 0
# define PyDict_MAXFREELIST 0
-# define PyFrame_MAXFREELIST 0
# define _PyAsyncGen_MAXFREELIST 0
# define PyContext_MAXFREELIST 0
#endif
@@ -158,18 +157,6 @@ struct _Py_dict_state {
#endif
};
-#ifndef PyFrame_MAXFREELIST
-# define PyFrame_MAXFREELIST 200
-#endif
-
-struct _Py_frame_state {
-#if PyFrame_MAXFREELIST > 0
- PyFrameObject *free_list;
- /* number of frames currently in free_list */
- int numfree;
-#endif
-};
-
#ifndef _PyAsyncGen_MAXFREELIST
# define _PyAsyncGen_MAXFREELIST 80
#endif
@@ -332,7 +319,6 @@ struct _is {
struct _Py_tuple_state tuple;
struct _Py_list_state list;
struct _Py_dict_state dict_state;
- struct _Py_frame_state frame;
struct _Py_async_gen_state async_gen;
struct _Py_context_state context;
struct _Py_exc_state exc_state;