Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cdf578e

Browse files
committed
New lay-out of frame object, for fewer mallocs.
See frameobject.c checkin message.
1 parent 7eb883a commit cdf578e

1 file changed

Lines changed: 8 additions & 9 deletions

File tree

Include/frameobject.h

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,17 @@ typedef struct _frame {
5050
PyObject *f_builtins; /* builtin symbol table (PyDictObject) */
5151
PyObject *f_globals; /* global symbol table (PyDictObject) */
5252
PyObject *f_locals; /* local symbol table (PyDictObject) */
53-
PyObject *f_owner; /* owner (e.g. class or module) or NULL */
54-
PyObject *f_fastlocals; /* fast local variables (PyListObject) */
55-
PyObject **f_valuestack; /* malloc'ed array */
56-
PyTryBlock *f_blockstack; /* malloc'ed array */
57-
int f_nvalues; /* size of f_valuestack */
58-
int f_nblocks; /* size of f_blockstack */
59-
int f_iblock; /* index in f_blockstack */
53+
PyObject **f_valuestack; /* points after the last local */
54+
PyObject *f_trace; /* Trace function */
6055
int f_lasti; /* Last instruction if called */
6156
int f_lineno; /* Current line number */
6257
int f_restricted; /* Flag set if restricted operations
6358
in this scope */
64-
PyObject *f_trace; /* Trace function */
59+
int f_iblock; /* index in f_blockstack */
60+
PyTryBlock f_blockstack[CO_MAXBLOCKS]; /* for try and loop blocks */
61+
int f_nlocals; /* number of locals */
62+
int f_stacksize; /* size of value stack */
63+
PyObject *f_localsplus[1]; /* locals+stack, dynamically sized */
6564
} PyFrameObject;
6665

6766

@@ -73,7 +72,7 @@ extern DL_IMPORT(PyTypeObject) PyFrame_Type;
7372

7473
PyFrameObject * PyFrame_New
7574
Py_PROTO((PyFrameObject *, PyCodeObject *,
76-
PyObject *, PyObject *, PyObject *, int, int));
75+
PyObject *, PyObject *));
7776

7877

7978
/* The rest of the interface is specific for frame objects */

0 commit comments

Comments
 (0)