Skip to content

Commit 57f417e

Browse files
fix branch tracing
1 parent 396818b commit 57f417e

File tree

3 files changed

+7
-21
lines changed

3 files changed

+7
-21
lines changed

Python/bytecodes.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3059,15 +3059,15 @@ dummy_func(
30593059
assert(PyStackRef_BoolCheck(cond));
30603060
int flag = PyStackRef_IsFalse(cond);
30613061
DEAD(cond);
3062-
RECORD_BRANCH_TAKEN(this_instr[1].cache, flag);
3062+
RECORD_JUMP_TAKEN();
30633063
JUMPBY(flag ? oparg : next_instr->op.code == NOT_TAKEN);
30643064
}
30653065

30663066
replaced op(_POP_JUMP_IF_TRUE, (cond -- )) {
30673067
assert(PyStackRef_BoolCheck(cond));
30683068
int flag = PyStackRef_IsTrue(cond);
30693069
DEAD(cond);
3070-
RECORD_BRANCH_TAKEN(this_instr[1].cache, flag);
3070+
RECORD_JUMP_TAKEN();
30713071
JUMPBY(flag ? oparg : next_instr->op.code == NOT_TAKEN);
30723072
}
30733073

Python/generated_cases.c.h

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

Python/optimizer.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -671,9 +671,7 @@ _PyJIT_translate_single_bytecode_to_trace(
671671
case POP_JUMP_IF_TRUE:
672672
{
673673
RESERVE(1);
674-
int counter = this_instr[1].cache;
675-
int bitcount = counter & 1;
676-
int jump_likely = bitcount;
674+
int jump_likely = jump_taken;
677675
uint32_t uopcode = BRANCH_TO_GUARD[opcode - POP_JUMP_IF_FALSE][jump_likely];
678676
_Py_CODEUNIT *next_instr = target_instr + 1 + _PyOpcode_Caches[_PyOpcode_Deopt[opcode]];
679677
_Py_CODEUNIT *false_target = next_instr + oparg;

0 commit comments

Comments
 (0)