Mercurial > cpython-lru_cache-weakref
diff Python/ceval.c @ 40560:07c4702020dc legacy-trunk
SF# 1409443: Expand comment to cover the interaction between f->f_lasti and the PREDICT macros.
| author | Raymond Hettinger <python@rcn.com> |
|---|---|
| date | Sat, 06 Jan 2007 01:14:41 +0000 |
| parents | 4e368e82c70d |
| children | bd3739a87259 |
line wrap: on
line diff
--- a/Python/ceval.c Fri Jan 05 21:45:09 2007 +0000 +++ b/Python/ceval.c Sat Jan 06 01:14:41 2007 +0000 @@ -741,7 +741,16 @@ this wasn't always true before 2.3! PyFrame_New now sets f->f_lasti to -1 (i.e. the index *before* the first instruction) and YIELD_VALUE doesn't fiddle with f_lasti any more. So this - does work. Promise. */ + does work. Promise. + + When the PREDICT() macros are enabled, some opcode pairs follow in + direct succession without updating f->f_lasti. A successful + prediction effectively links the two codes together as if they + were a single new opcode; accordingly,f->f_lasti will point to + the first code in the pair (for instance, GET_ITER followed by + FOR_ITER is effectively a single opcode and f->f_lasti will point + at to the beginning of the combined pair.) + */ next_instr = first_instr + f->f_lasti + 1; stack_pointer = f->f_stacktop; assert(stack_pointer != NULL);
