Skip to content

Commit 1798ab1

Browse files
Fix _CHECK_PERIODIC insertion
1 parent 960d647 commit 1798ab1

File tree

4 files changed

+12
-17
lines changed

4 files changed

+12
-17
lines changed

Python/bytecodes.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2981,8 +2981,10 @@ dummy_func(
29812981
_PyJIT_InitializeTracing(tstate, frame, this_instr, STACK_LEVEL(), 0, NULL);
29822982
ENTER_TRACING();
29832983
}
2984-
// Don't add the JUMP_BACKWARD_JIT instruction to the trace.
2985-
DISPATCH();
2984+
int _jump_taken = false;
2985+
PyCodeObject *old_code = _PyFrame_GetCode(frame);
2986+
PyFunctionObject *old_func = (PyFunctionObject *)PyStackRef_AsPyObjectBorrow(frame->f_funcobj);
2987+
TRACING_DISPATCH();
29862988
}
29872989
else {
29882990
ADVANCE_ADAPTIVE_COUNTER(this_instr[1].counter);

Python/generated_cases.c.h

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

Python/generated_tracer_cases.c.h

Lines changed: 3 additions & 0 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 & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,6 @@ _PyJIT_translate_single_bytecode_to_trace(
673673

674674
// Loop back to the start
675675
if (is_first_instr && tstate->interp->jit_state.jit_tracer_code_curr_size > 2) {
676-
ADD_TO_TRACE(_CHECK_PERIODIC, 0, 0, target);
677676
ADD_TO_TRACE(_JUMP_TO_TOP, 0, 0, 0);
678677
goto done;
679678
}
@@ -705,19 +704,7 @@ _PyJIT_translate_single_bytecode_to_trace(
705704
break;
706705
}
707706
case JUMP_BACKWARD_JIT:
708-
// This is possible as the JIT might have re-activated after it was disabled. // if (next_uop->opcode != _START_EXECUTOR) {
709-
// if (next_uop->format == UOP_FORMAT_TARGET) {
710-
// _Py_CODEUNIT *aim = _PyFrame_GetBytecode(frame) + next_uop->target;
711-
// printf(" aim=[%s]\n", _PyOpcode_OpName[aim->op.code]);
712-
// }
713-
// else if (next_uop->format == UOP_FORMAT_JUMP) {
714-
// _PyUOpInstruction *aim_uop = current_executor->trace + next_uop->jump_target;
715-
// if (aim_uop->format == UOP_FORMAT_TARGET) {
716-
// _Py_CODEUNIT *aim = _PyFrame_GetBytecode(frame) + aim_uop->target;
717-
// printf(" aim=[%s]\n", _PyOpcode_OpName[aim->op.code]);
718-
// }
719-
// }
720-
// }
707+
// This is possible as the JIT might have re-activated after it was disabled
721708
case JUMP_BACKWARD_NO_JIT:
722709
case JUMP_BACKWARD:
723710
ADD_TO_TRACE(_CHECK_PERIODIC, 0, 0, target);

0 commit comments

Comments
 (0)