[Python-checkins] python/dist/src/Python ceval.c,2.320,2.321
montanaro@users.sourceforge.net
montanaro@users.sourceforge.net
Sun, 04 Aug 2002 14:03:37 -0700
Update of /cvsroot/python/python/dist/src/Python
In directory usw-pr-cvs1:/tmp/cvs-serv19551
Modified Files:
ceval.c
Log Message:
small speedup for constant and name access
see sf #506436
Index: ceval.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v
retrieving revision 2.320
retrieving revision 2.321
diff -C2 -d -r2.320 -r2.321
*** ceval.c 17 Jul 2002 16:57:13 -0000 2.320
--- ceval.c 4 Aug 2002 21:03:35 -0000 2.321
***************
*** 495,498 ****
--- 495,500 ----
PyCodeObject *co;
unsigned char *first_instr;
+ PyObject *names;
+ PyObject *consts;
#ifdef LLTRACE
int lltrace;
***************
*** 513,518 ****
/* Code access macros */
! #define GETCONST(i) (GETITEM(co->co_consts, (i)))
! #define GETNAMEV(i) (GETITEM(co->co_names, (i)))
#define INSTR_OFFSET() (next_instr - first_instr)
#define NEXTOP() (*next_instr++)
--- 515,519 ----
/* Code access macros */
! #define GETNAMEV(i) (GETITEM(names, (i)))
#define INSTR_OFFSET() (next_instr - first_instr)
#define NEXTOP() (*next_instr++)
***************
*** 576,579 ****
--- 577,582 ----
tstate->frame = f;
co = f->f_code;
+ names = co->co_names;
+ consts = co->co_consts;
fastlocals = f->f_localsplus;
freevars = f->f_localsplus + f->f_nlocals;
***************
*** 754,758 ****
case LOAD_CONST:
! x = GETCONST(oparg);
Py_INCREF(x);
PUSH(x);
--- 757,761 ----
case LOAD_CONST:
! x = GETITEM(consts, oparg);
Py_INCREF(x);
PUSH(x);