Skip to content
Prev Previous commit
Also disable updating the bitmask cache for PUP_JUMP_IF*
  • Loading branch information
gvanrossum committed Apr 16, 2024
commit ced0ca939c2fbd7e2f7ffe2d38ce4c2e06789084
12 changes: 12 additions & 0 deletions Python/bytecodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -2398,18 +2398,22 @@ dummy_func(
replaced op(_POP_JUMP_IF_FALSE, (cond -- )) {
assert(PyBool_Check(cond));
int flag = Py_IsFalse(cond);
#ifndef _Py_NOTIER2
#if ENABLE_SPECIALIZATION
this_instr[1].cache = (this_instr[1].cache << 1) | flag;
#endif
#endif
JUMPBY(oparg * flag);
}

replaced op(_POP_JUMP_IF_TRUE, (cond -- )) {
assert(PyBool_Check(cond));
int flag = Py_IsTrue(cond);
#ifndef _Py_NOTIER2
#if ENABLE_SPECIALIZATION
this_instr[1].cache = (this_instr[1].cache << 1) | flag;
#endif
#endif
JUMPBY(oparg * flag);
}

Expand Down Expand Up @@ -3979,9 +3983,11 @@ dummy_func(
assert(PyBool_Check(cond));
int flag = Py_IsTrue(cond);
int offset = flag * oparg;
#ifndef _Py_NOTIER2
#if ENABLE_SPECIALIZATION
this_instr[1].cache = (this_instr[1].cache << 1) | flag;
#endif
#endif
INSTRUMENTED_JUMP(this_instr, next_instr + offset, PY_MONITORING_EVENT_BRANCH);
}

Expand All @@ -3990,9 +3996,11 @@ dummy_func(
assert(PyBool_Check(cond));
int flag = Py_IsFalse(cond);
int offset = flag * oparg;
#ifndef _Py_NOTIER2
#if ENABLE_SPECIALIZATION
this_instr[1].cache = (this_instr[1].cache << 1) | flag;
#endif
#endif
INSTRUMENTED_JUMP(this_instr, next_instr + offset, PY_MONITORING_EVENT_BRANCH);
}

Expand All @@ -4007,9 +4015,11 @@ dummy_func(
Py_DECREF(value);
offset = 0;
}
#ifndef _Py_NOTIER2
#if ENABLE_SPECIALIZATION
this_instr[1].cache = (this_instr[1].cache << 1) | flag;
#endif
#endif
INSTRUMENTED_JUMP(this_instr, next_instr + offset, PY_MONITORING_EVENT_BRANCH);
}

Expand All @@ -4024,9 +4034,11 @@ dummy_func(
Py_DECREF(value);
offset = oparg;
}
#ifndef _Py_NOTIER2
#if ENABLE_SPECIALIZATION
this_instr[1].cache = (this_instr[1].cache << 1) | !nflag;
#endif
#endif
INSTRUMENTED_JUMP(this_instr, next_instr + offset, PY_MONITORING_EVENT_BRANCH);
}

Expand Down
16 changes: 16 additions & 0 deletions Python/generated_cases.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.