Skip to content

Commit de5ec2a

Browse files
committed
SF# 1409443: Expand comment to cover the interaction between f->f_lasti and the PREDICT macros.
1 parent e12944d commit de5ec2a

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

Python/ceval.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,16 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
741741
this wasn't always true before 2.3! PyFrame_New now sets
742742
f->f_lasti to -1 (i.e. the index *before* the first instruction)
743743
and YIELD_VALUE doesn't fiddle with f_lasti any more. So this
744-
does work. Promise. */
744+
does work. Promise.
745+
746+
When the PREDICT() macros are enabled, some opcode pairs follow in
747+
direct succession without updating f->f_lasti. A successful
748+
prediction effectively links the two codes together as if they
749+
were a single new opcode; accordingly,f->f_lasti will point to
750+
the first code in the pair (for instance, GET_ITER followed by
751+
FOR_ITER is effectively a single opcode and f->f_lasti will point
752+
at to the beginning of the combined pair.)
753+
*/
745754
next_instr = first_instr + f->f_lasti + 1;
746755
stack_pointer = f->f_stacktop;
747756
assert(stack_pointer != NULL);

0 commit comments

Comments
 (0)