Mercurial > cpython-lru_cache-weakref
diff Python/ceval.c @ 31462:d5c047807c69 legacy-trunk
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.
| author | Raymond Hettinger <python@rcn.com> |
|---|---|
| date | Fri, 06 Feb 2004 18:32:33 +0000 |
| parents | 86fdf8fe7f17 |
| children | f57f5ce22c8d |
line wrap: on
line diff
--- a/Python/ceval.c Fri Feb 06 18:30:31 2004 +0000 +++ b/Python/ceval.c Fri Feb 06 18:32:33 2004 +0000 @@ -1578,12 +1578,12 @@ #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 @@ 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 @@ /* 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 @@ 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)) {
