summaryrefslogtreecommitdiffstats
path: root/Python/ceval.c
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2004-02-06 18:32:33 (GMT)
committerRaymond Hettinger <python@rcn.com>2004-02-06 18:32:33 (GMT)
commit1dd8309246a1a1dfb1d28957d0a2a1aa64fbd4fe (patch)
tree9e7e555998f707b1d8f3f8fb0f040abbcb4fd0a1 /Python/ceval.c
parent7dcf9f89d331f5445d4972fa186778ed868945bc (diff)
downloadcpython-1dd8309246a1a1dfb1d28957d0a2a1aa64fbd4fe.zip
cpython-1dd8309246a1a1dfb1d28957d0a2a1aa64fbd4fe.tar.gz
cpython-1dd8309246a1a1dfb1d28957d0a2a1aa64fbd4fe.tar.bz2
SF patch #864059: optimize eval_frame
Simplified version of Neal Norwitz's patch which adds gotos for opcodes that set "why". This skips a number of tests where the outcome of the tests are known in advance.
Diffstat (limited to 'Python/ceval.c')
-rw-r--r--Python/ceval.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index f198da1..c6e0470 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -1578,12 +1578,12 @@ eval_frame(PyFrameObject *f)
#endif
case BREAK_LOOP:
why = WHY_BREAK;
- break;
+ goto fast_block_end;
case CONTINUE_LOOP:
retval = PyInt_FromLong(oparg);
why = WHY_CONTINUE;
- break;
+ goto fast_block_end;
case RAISE_VARARGS:
u = v = w = NULL;
@@ -1620,14 +1620,13 @@ eval_frame(PyFrameObject *f)
case RETURN_VALUE:
retval = POP();
why = WHY_RETURN;
- break;
+ goto fast_block_end;
case YIELD_VALUE:
retval = POP();
f->f_stacktop = stack_pointer;
why = WHY_YIELD;
- break;
-
+ goto fast_yield;
case EXEC_STMT:
w = TOP();
@@ -2327,6 +2326,7 @@ eval_frame(PyFrameObject *f)
/* Unwind stacks if a (pseudo) exception occurred */
+fast_block_end:
while (why != WHY_NOT && why != WHY_YIELD && f->f_iblock > 0) {
PyTryBlock *b = PyFrame_BlockPop(f);
@@ -2410,6 +2410,7 @@ eval_frame(PyFrameObject *f)
if (why != WHY_RETURN && why != WHY_YIELD)
retval = NULL;
+fast_yield:
if (tstate->use_tracing) {
if (tstate->c_tracefunc
&& (why == WHY_RETURN || why == WHY_YIELD)) {