[Python-checkins] python/dist/src/Python ceval.c,2.356,2.357
rhettinger@users.sourceforge.net
rhettinger@users.sourceforge.net
Sun, 16 Mar 2003 12:14:47 -0800
Update of /cvsroot/python/python/dist/src/Python
In directory sc8-pr-cvs1:/tmp/cvs-serv27026
Modified Files:
ceval.c
Log Message:
Eliminate data dependency in predict macro.
Added two predictions:
GET_ITER --> FOR_ITER
FOR_ITER --> STORE_FAST or UNPACK_SEQUENCE
Improves timings on pybench and timeit.py. Pystone results are neutral.
Index: ceval.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v
retrieving revision 2.356
retrieving revision 2.357
diff -C2 -d -r2.356 -r2.357
*** ceval.c 16 Mar 2003 15:41:11 -0000 2.356
--- ceval.c 16 Mar 2003 20:14:44 -0000 2.357
***************
*** 621,626 ****
#define PREDICT(op) if (*next_instr == op) goto PRED_##op
#define PREDICTED(op) PRED_##op: next_instr++
! #define PREDICTED_WITH_ARG(op) PRED_##op: oparg = (next_instr += 3, \
! (next_instr[-1]<<8) + next_instr[-2])
/* Stack manipulation macros */
--- 621,626 ----
#define PREDICT(op) if (*next_instr == op) goto PRED_##op
#define PREDICTED(op) PRED_##op: next_instr++
! #define PREDICTED_WITH_ARG(op) PRED_##op: oparg = (next_instr[2]<<8) + \
! next_instr[1]; next_instr += 3
/* Stack manipulation macros */
***************
*** 890,893 ****
--- 890,894 ----
goto fast_next_opcode;
+ PREDICTED_WITH_ARG(STORE_FAST);
case STORE_FAST:
v = POP();
***************
*** 1676,1679 ****
--- 1677,1681 ----
break;
+ PREDICTED_WITH_ARG(UNPACK_SEQUENCE);
case UNPACK_SEQUENCE:
v = POP();
***************
*** 2052,2055 ****
--- 2054,2058 ----
if (x != NULL) {
SET_TOP(x);
+ PREDICT(FOR_ITER);
continue;
}
***************
*** 2057,2060 ****
--- 2060,2064 ----
break;
+ PREDICTED_WITH_ARG(FOR_ITER);
case FOR_ITER:
/* before: [iter]; after: [iter, iter()] *or* [] */
***************
*** 2063,2066 ****
--- 2067,2072 ----
if (x != NULL) {
PUSH(x);
+ PREDICT(STORE_FAST);
+ PREDICT(UNPACK_SEQUENCE);
continue;
}