diff options
author | Mark Shannon <mark@hotpy.org> | 2021-05-21 10:57:35 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-21 10:57:35 +0100 |
commit | b11a951f16f0603d98de24fee5c023df83ea552c (patch) | |
tree | 82e7807515db0e284d9ebc3b8c3ba6ff08699ea5 /Include/cpython/frameobject.h | |
parent | be4dd7fcd93ed29d362c4bbcc48151bc619d6595 (diff) | |
download | cpython-git-b11a951f16f0603d98de24fee5c023df83ea552c.tar.gz |
bpo-44032: Move data stack to thread from FrameObject. (GH-26076)
* Remove 'zombie' frames. We won't need them once we are allocating fixed-size frames.
* Add co_nlocalplus field to code object to avoid recomputing size of locals + frees + cells.
* Move locals, cells and freevars out of frame object into separate memory buffer.
* Use per-threadstate allocated memory chunks for local variables.
* Move globals and builtins from frame object to per-thread stack.
* Move (slow) locals frame object to per-thread stack.
* Move internal frame functions to internal header.
Diffstat (limited to 'Include/cpython/frameobject.h')
-rw-r--r-- | Include/cpython/frameobject.h | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/Include/cpython/frameobject.h b/Include/cpython/frameobject.h index 581664775c..fc20bc2ff8 100644 --- a/Include/cpython/frameobject.h +++ b/Include/cpython/frameobject.h @@ -20,12 +20,9 @@ enum _framestate { typedef signed char PyFrameState; struct _frame { - PyObject_VAR_HEAD + PyObject_HEAD struct _frame *f_back; /* previous frame, or NULL */ PyCodeObject *f_code; /* code segment */ - PyObject *f_builtins; /* builtin symbol table (PyDictObject) */ - PyObject *f_globals; /* global symbol table (PyDictObject) */ - PyObject *f_locals; /* local symbol table (any mapping) */ PyObject **f_valuestack; /* points after the last local */ PyObject *f_trace; /* Trace function */ /* Borrowed reference to a generator, or NULL */ @@ -36,7 +33,8 @@ struct _frame { PyFrameState f_state; /* What state the frame is in */ char f_trace_lines; /* Emit per-line trace events? */ char f_trace_opcodes; /* Emit per-opcode trace events? */ - PyObject *f_localsplus[1]; /* locals+stack, dynamically sized */ + char f_own_locals_memory; /* This frame owns the memory for the locals */ + PyObject **f_localsptr; /* Pointer to locals, cells, free */ }; static inline int _PyFrame_IsRunnable(struct _frame *f) { @@ -62,7 +60,7 @@ PyAPI_FUNC(PyFrameObject *) PyFrame_New(PyThreadState *, PyCodeObject *, /* only internal use */ PyFrameObject* -_PyFrame_New_NoTrack(PyThreadState *, PyFrameConstructor *, PyObject *); +_PyFrame_New_NoTrack(PyThreadState *, PyFrameConstructor *, PyObject *, PyObject **); /* The rest of the interface is specific for frame objects */ |