Skip to content

Commit

Permalink
Simplify bytecodes.c logic a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
colesbury committed Nov 21, 2024
1 parent 5583ac0 commit 16f7e7b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 29 deletions.
12 changes: 2 additions & 10 deletions Python/bytecodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -2406,14 +2406,6 @@ dummy_func(
}
else {
res = PyStackRef_FromPyObjectSteal(res_o);
#ifdef Py_GIL_DISABLED
// Ensure that Py_TAG_DEFERRED is set for Py_True and Py_False
// so that ops like _POP_JUMP_IF_FALSE can use the faster
// PyStackRef_IsExactly() check.
if (_Py_IsImmortal(res_o)) {
res.bits |= Py_TAG_DEFERRED;
}
#endif
}
}

Expand Down Expand Up @@ -2693,7 +2685,7 @@ dummy_func(

replaced op(_POP_JUMP_IF_FALSE, (cond -- )) {
assert(PyStackRef_BoolCheck(cond));
int flag = PyStackRef_IsExactly(cond, PyStackRef_False);
int flag = PyStackRef_IsFalse(cond);
DEAD(cond);
RECORD_BRANCH_TAKEN(this_instr[1].cache, flag);
JUMPBY(oparg * flag);
Expand Down Expand Up @@ -4721,7 +4713,7 @@ dummy_func(
inst(INSTRUMENTED_POP_JUMP_IF_FALSE, (unused/1 -- )) {
_PyStackRef cond = POP();
assert(PyStackRef_BoolCheck(cond));
int flag = PyStackRef_IsExactly(cond, PyStackRef_False);
int flag = PyStackRef_IsFalse(cond);
int offset = flag * oparg;
RECORD_BRANCH_TAKEN(this_instr[1].cache, flag);
INSTRUMENTED_JUMP(this_instr, next_instr + offset, PY_MONITORING_EVENT_BRANCH);
Expand Down
8 changes: 0 additions & 8 deletions Python/executor_cases.c.h

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

14 changes: 3 additions & 11 deletions Python/generated_cases.c.h

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

0 comments on commit 16f7e7b

Please sign in to comment.