[Python-checkins] CVS: python/dist/src/Python ceval.c,2.304,2.305
Neil Schemenauer
nascheme@users.sourceforge.net
Sun, 17 Feb 2002 11:10:16 -0800
Update of /cvsroot/python/python/dist/src/Python
In directory usw-pr-cvs1:/tmp/cvs-serv16826
Modified Files:
ceval.c
Log Message:
Move some opcodes to top of big eval_frame switch statement. Skip
things_to_do block for a few common opcodes that don't do any real
work. Closes SF patch #512256.
Index: ceval.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v
retrieving revision 2.304
retrieving revision 2.305
diff -C2 -d -r2.304 -r2.305
*** ceval.c 12 Feb 2002 04:31:21 -0000 2.304
--- ceval.c 17 Feb 2002 19:10:14 -0000 2.305
***************
*** 681,684 ****
--- 681,685 ----
}
+ fast_next_opcode:
/* Extract opcode and argument */
***************
*** 725,732 ****
/* case STOP_CODE: this is an error! */
case POP_TOP:
v = POP();
Py_DECREF(v);
! continue;
case ROT_TWO:
--- 726,776 ----
/* case STOP_CODE: this is an error! */
+ case SET_LINENO:
+ #ifdef LLTRACE
+ if (lltrace)
+ printf("--- %s:%d \n", filename, oparg);
+ #endif
+ f->f_lineno = oparg;
+ if (tstate->c_tracefunc == NULL || tstate->tracing)
+ goto fast_next_opcode;
+ /* Trace each line of code reached */
+ f->f_lasti = INSTR_OFFSET();
+ /* Inline call_trace() for performance: */
+ tstate->tracing++;
+ tstate->use_tracing = 0;
+ err = (tstate->c_tracefunc)(tstate->c_traceobj, f,
+ PyTrace_LINE, Py_None);
+ tstate->use_tracing = (tstate->c_tracefunc
+ || tstate->c_profilefunc);
+ tstate->tracing--;
+ break;
+
+ case LOAD_FAST:
+ x = GETLOCAL(oparg);
+ if (x != NULL) {
+ Py_INCREF(x);
+ PUSH(x);
+ goto fast_next_opcode;
+ }
+ format_exc_check_arg(PyExc_UnboundLocalError,
+ UNBOUNDLOCAL_ERROR_MSG,
+ PyTuple_GetItem(co->co_varnames, oparg));
+ break;
+
+ case LOAD_CONST:
+ x = GETCONST(oparg);
+ Py_INCREF(x);
+ PUSH(x);
+ goto fast_next_opcode;
+
+ case STORE_FAST:
+ v = POP();
+ SETLOCAL(oparg, v);
+ goto fast_next_opcode;
+
case POP_TOP:
v = POP();
Py_DECREF(v);
! goto fast_next_opcode;
case ROT_TWO:
***************
*** 1618,1627 ****
break;
- case LOAD_CONST:
- x = GETCONST(oparg);
- Py_INCREF(x);
- PUSH(x);
- break;
-
case LOAD_NAME:
w = GETNAMEV(oparg);
--- 1662,1665 ----
***************
*** 1665,1685 ****
break;
- case LOAD_FAST:
- x = GETLOCAL(oparg);
- if (x != NULL) {
- Py_INCREF(x);
- PUSH(x);
- continue;
- }
- format_exc_check_arg(PyExc_UnboundLocalError,
- UNBOUNDLOCAL_ERROR_MSG,
- PyTuple_GetItem(co->co_varnames, oparg));
- break;
-
- case STORE_FAST:
- v = POP();
- SETLOCAL(oparg, v);
- continue;
-
case DELETE_FAST:
x = GETLOCAL(oparg);
--- 1703,1706 ----
***************
*** 1949,1972 ****
STACK_LEVEL());
continue;
-
- case SET_LINENO:
- #ifdef LLTRACE
- if (lltrace)
- printf("--- %s:%d \n", filename, oparg);
- #endif
- f->f_lineno = oparg;
- if (tstate->c_tracefunc == NULL || tstate->tracing)
- continue;
- /* Trace each line of code reached */
- f->f_lasti = INSTR_OFFSET();
- /* Inline call_trace() for performance: */
- tstate->tracing++;
- tstate->use_tracing = 0;
- err = (tstate->c_tracefunc)(tstate->c_traceobj, f,
- PyTrace_LINE, Py_None);
- tstate->use_tracing = (tstate->c_tracefunc
- || tstate->c_profilefunc);
- tstate->tracing--;
- break;
case CALL_FUNCTION:
--- 1970,1973 ----