Skip to content

Commit ed045d7

Browse files
committed
Update counter in INSTRUMENTED_POP_JUMP_IF_FALSE
Alas, this goes untested (how to test it?). In INSTRUMENTED_POP_JUMP_IF_NOT_NONE, rename flag to nflag to emphasise that its sense is reversed (this is the only op that jumps if the flag is false, because there's no Py_IsNotNone() function). (Alternatively, we could have changed the sense of the flag, but that would have been more work.)
1 parent fbd322a commit ed045d7

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

Python/bytecodes.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3751,6 +3751,9 @@ dummy_func(
37513751
_Py_CODEUNIT *here = next_instr - 1;
37523752
int flag = Py_IsFalse(cond);
37533753
int offset = flag * oparg;
3754+
#if ENABLE_SPECIALIZATION
3755+
next_instr->cache = (next_instr->cache << 1) | flag;
3756+
#endif
37543757
INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH);
37553758
}
37563759

@@ -3776,16 +3779,16 @@ dummy_func(
37763779
PyObject *value = POP();
37773780
_Py_CODEUNIT *here = next_instr-1;
37783781
int offset;
3779-
int flag = Py_IsNone(value);
3780-
if (flag) {
3782+
int nflag = Py_IsNone(value);
3783+
if (nflag) {
37813784
offset = 0;
37823785
}
37833786
else {
37843787
Py_DECREF(value);
37853788
offset = oparg;
37863789
}
37873790
#if ENABLE_SPECIALIZATION
3788-
next_instr->cache = (next_instr->cache << 1) | !flag;
3791+
next_instr->cache = (next_instr->cache << 1) | !nflag;
37893792
#endif
37903793
INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH);
37913794
}

Python/generated_cases.c.h

Lines changed: 6 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)