summaryrefslogtreecommitdiffstats
path: root/Include/cpython/frameobject.h
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2021-05-07 14:19:19 (GMT)
committerGitHub <noreply@github.com>2021-05-07 14:19:19 (GMT)
commitadcd2205565f91c6719f4141ab4e1da6d7086126 (patch)
tree0953b285944eccde57b05b8f3c7e30fb501a3d64 /Include/cpython/frameobject.h
parentb32c8e97951db46484ba3b646b988bcdc4062199 (diff)
downloadcpython-adcd2205565f91c6719f4141ab4e1da6d7086126.zip
cpython-adcd2205565f91c6719f4141ab4e1da6d7086126.tar.gz
cpython-adcd2205565f91c6719f4141ab4e1da6d7086126.tar.bz2
bpo-40222: "Zero cost" exception handling (GH-25729)
"Zero cost" exception handling. * Uses a lookup table to determine how to handle exceptions. * Removes SETUP_FINALLY and POP_TOP block instructions, eliminating (most of) the runtime overhead of try statements. * Reduces the size of the frame object by about 60%.
Diffstat (limited to 'Include/cpython/frameobject.h')
-rw-r--r--Include/cpython/frameobject.h15
1 files changed, 3 insertions, 12 deletions
diff --git a/Include/cpython/frameobject.h b/Include/cpython/frameobject.h
index 5122ec4..0c2206c0 100644
--- a/Include/cpython/frameobject.h
+++ b/Include/cpython/frameobject.h
@@ -34,18 +34,14 @@ struct _frame {
PyObject *f_locals; /* local symbol table (any mapping) */
PyObject **f_valuestack; /* points after the last local */
PyObject *f_trace; /* Trace function */
- int f_stackdepth; /* Depth of value stack */
- char f_trace_lines; /* Emit per-line trace events? */
- char f_trace_opcodes; /* Emit per-opcode trace events? */
-
/* Borrowed reference to a generator, or NULL */
PyObject *f_gen;
-
+ int f_stackdepth; /* Depth of value stack */
int f_lasti; /* Last instruction if called */
int f_lineno; /* Current line number. Only valid if non-zero */
- int f_iblock; /* index in f_blockstack */
PyFrameState f_state; /* What state the frame is in */
- PyTryBlock f_blockstack[CO_MAXBLOCKS]; /* for try and loop blocks */
+ 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 */
};
@@ -77,11 +73,6 @@ _PyFrame_New_NoTrack(PyThreadState *, PyFrameConstructor *, PyObject *);
/* The rest of the interface is specific for frame objects */
-/* Block management functions */
-
-PyAPI_FUNC(void) PyFrame_BlockSetup(PyFrameObject *, int, int, int);
-PyAPI_FUNC(PyTryBlock *) PyFrame_BlockPop(PyFrameObject *);
-
/* Conversions between "fast locals" and locals in dictionary */
PyAPI_FUNC(void) PyFrame_LocalsToFast(PyFrameObject *, int);