GH-118095: Unify the behavior of tier 2 FOR_ITER branch micro-ops - #118420
Conversation
FOR_ITER branch micro-opsFOR_ITER branch micro-ops
…prepare for execution step.
…and fix off by one error)
25a889a to
bb7efd4
Compare
|
The test hangs for tier two seem to be in |
gvanrossum
left a comment
There was a problem hiding this comment.
Seem to be some unrelated cleanups -- maybe minimize those or extract them to another PR? Otherwise LGTM.
| #define MAX_EXECUTORS_SIZE 256 | ||
|
|
||
| #ifdef Py_DEBUG | ||
| static int base_opcode(PyCodeObject *code, int offset) |
There was a problem hiding this comment.
| static int base_opcode(PyCodeObject *code, int offset) | |
| static int | |
| base_opcode(PyCodeObject *code, int offset) |
| if (_Py_uop_sym_is_not_null(sym)) { | ||
| sym_set_bottom(sym); | ||
| return false; | ||
| } | ||
| sym_set_flag(sym, IS_NULL); | ||
| return !_Py_uop_sym_is_bottom(sym); | ||
| return true; |
There was a problem hiding this comment.
Does this refactoring matter? If so, why not do the same for set_non_null below?
There was a problem hiding this comment.
It is not a refactoring.
Calling _Py_uop_sym_set_null on a non-NULL symbol would fail an assertion in _Py_uop_sym_is_bottom
And yes, it should be applied to set_non_null as well.
There was a problem hiding this comment.
Probably best to include the case also in { ... } to limit the scope of the two variables declared in debug mode.
…ps (pythonGH-118420) * Target _FOR_ITER_TIER_TWO at POP_TOP following the matching END_FOR * Modify _GUARD_NOT_EXHAUSTED_RANGE, _GUARD_NOT_EXHAUSTED_LIST and _GUARD_NOT_EXHAUSTED_TUPLE so that they also target the POP_TOP following the matching END_FOR

Simplifies and unifies the behavior of
_GUARD_NOT_EXHAUSTED_RANGE_GUARD_NOT_EXHAUSTED_LIST_GUARD_NOT_EXHAUSTED_TUPLE_FOR_ITER_TIER_TWOSuch that all leave just the iterator on the stack and they exit to the
POP_TOPimmediately after the associatedEND_FOR.This fixes a bug in the tier 2 handling of
_FOR_ITER_TIER_TWOwhere errors were treated as occurring at the jump target, not an the original instructions.