Skip to content

Commit d18c1a1

Browse files
Revert remedies against trace explosion
1 parent dd0e16f commit d18c1a1

File tree

1 file changed

+0
-16
lines changed

1 file changed

+0
-16
lines changed

Python/optimizer.c

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -709,29 +709,13 @@ _PyJIT_translate_single_bytecode_to_trace(
709709
case POP_JUMP_IF_FALSE:
710710
case POP_JUMP_IF_TRUE:
711711
{
712-
int counter = target_instr[1].cache;
713-
int direction = _Py_popcount32(counter);
714712
_Py_CODEUNIT *computed_next_instr_without_modifiers = target_instr + 1 + _PyOpcode_Caches[_PyOpcode_Deopt[opcode]];
715713
_Py_CODEUNIT *computed_next_instr = computed_next_instr_without_modifiers + (computed_next_instr_without_modifiers->op.code == NOT_TAKEN);
716714
_Py_CODEUNIT *computed_jump_instr = computed_next_instr_without_modifiers + oparg;
717715
assert(next_instr == computed_next_instr || next_instr == computed_jump_instr);
718716
int jump_happened = computed_jump_instr == next_instr;
719717
uint32_t uopcode = BRANCH_TO_GUARD[opcode - POP_JUMP_IF_FALSE][jump_happened];
720718
ADD_TO_TRACE(uopcode, 0, 0, INSTR_IP(jump_happened ? computed_next_instr : computed_jump_instr, old_code));
721-
// Branch is biased to jumping, but jump did not happen.
722-
// We are likely in a bad trace. So we should retrace later.
723-
if ((direction > 10 && !jump_happened) ||
724-
// Branch is biased to not jumping, but jump did not happen.
725-
// We are likely in a bad trace. So we should retrace later
726-
(direction < 6 && jump_happened) ||
727-
// Finally, branch is just not heavily biased.
728-
// So we should not trace through it anyways
729-
// This prevents trace explosion
730-
(direction >= 6 && direction <= 10)
731-
) {
732-
ADD_TO_TRACE(_EXIT_TRACE, 0, 0, INSTR_IP(next_instr, old_code));
733-
goto full;
734-
}
735719
break;
736720
}
737721
case JUMP_BACKWARD_JIT:

0 commit comments

Comments
 (0)