summaryrefslogtreecommitdiffstats
path: root/Include/frameobject.h
diff options
context:
space:
mode:
authorJeremy Hylton <jeremy@alum.mit.edu>2001-01-29 22:51:52 (GMT)
committerJeremy Hylton <jeremy@alum.mit.edu>2001-01-29 22:51:52 (GMT)
commit2b724da8d9cd0c41a51e798eca75018ce155e997 (patch)
tree96a1648e0d50dbbd7ae56b3b55e7b44b107362dd /Include/frameobject.h
parent55087f0c351d6de453a5c95293792051d899f16b (diff)
downloadcpython-2b724da8d9cd0c41a51e798eca75018ce155e997.zip
cpython-2b724da8d9cd0c41a51e798eca75018ce155e997.tar.gz
cpython-2b724da8d9cd0c41a51e798eca75018ce155e997.tar.bz2
Remove f_closure slot of frameobject and use f_localsplus instead.
This change eliminates an extra malloc/free when a frame with free variables is created. Any cell vars or free vars are stored in f_localsplus after the locals and before the stack. eval_code2() fills in the appropriate values after handling initialization of locals. To track the size the frame has an f_size member that tracks the total size of f_localsplus. It used to be implicitly f_nlocals + f_stacksize.
Diffstat (limited to 'Include/frameobject.h')
-rw-r--r--Include/frameobject.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/Include/frameobject.h b/Include/frameobject.h
index c19f1d8..d1a310a 100644
--- a/Include/frameobject.h
+++ b/Include/frameobject.h
@@ -20,7 +20,6 @@ typedef struct _frame {
PyObject *f_builtins; /* builtin symbol table (PyDictObject) */
PyObject *f_globals; /* global symbol table (PyDictObject) */
PyObject *f_locals; /* local symbol table (PyDictObject) */
- PyObject *f_closure; /* environment for free variables */
PyObject **f_valuestack; /* points after the last local */
PyObject *f_trace; /* Trace function */
PyObject *f_exc_type, *f_exc_value, *f_exc_traceback;
@@ -31,7 +30,10 @@ typedef struct _frame {
in this scope */
int f_iblock; /* index in f_blockstack */
PyTryBlock f_blockstack[CO_MAXBLOCKS]; /* for try and loop blocks */
+ int f_size; /* size of localsplus */
int f_nlocals; /* number of locals */
+ int f_ncells;
+ int f_nfreevars;
int f_stacksize; /* size of value stack */
PyObject *f_localsplus[1]; /* locals+stack, dynamically sized */
} PyFrameObject;