mirror of
https://github.com/python/cpython.git
synced 2025-12-31 04:23:37 +00:00
gh-143183: Link trace to side exits, rather than stop (GH-143268)
This commit is contained in:
parent
f37f57dfe6
commit
6cb245d260
3 changed files with 46 additions and 7 deletions
|
|
@ -625,7 +625,6 @@ _PyJit_translate_single_bytecode_to_trace(
|
|||
int trace_length = _tstate->jit_tracer_state.prev_state.code_curr_size;
|
||||
_PyUOpInstruction *trace = _tstate->jit_tracer_state.code_buffer;
|
||||
int max_length = _tstate->jit_tracer_state.prev_state.code_max_size;
|
||||
int exit_op = stop_tracing_opcode == 0 ? _EXIT_TRACE : stop_tracing_opcode;
|
||||
|
||||
_Py_CODEUNIT *this_instr = _tstate->jit_tracer_state.prev_state.instr;
|
||||
_Py_CODEUNIT *target_instr = this_instr;
|
||||
|
|
@ -691,13 +690,18 @@ _PyJit_translate_single_bytecode_to_trace(
|
|||
goto full;
|
||||
}
|
||||
|
||||
if (stop_tracing_opcode != 0) {
|
||||
if (stop_tracing_opcode == _DEOPT) {
|
||||
// gh-143183: It's important we rewind to the last known proper target.
|
||||
// The current target might be garbage as stop tracing usually indicates
|
||||
// we are in something that we can't trace.
|
||||
DPRINTF(2, "Told to stop tracing\n");
|
||||
goto unsupported;
|
||||
}
|
||||
else if (stop_tracing_opcode != 0) {
|
||||
assert(stop_tracing_opcode == _EXIT_TRACE);
|
||||
ADD_TO_TRACE(stop_tracing_opcode, 0, 0, target);
|
||||
goto done;
|
||||
}
|
||||
|
||||
DPRINTF(2, "%p %d: %s(%d) %d %d\n", old_code, target, _PyOpcode_OpName[opcode], oparg, needs_guard_ip, old_stack_level);
|
||||
|
||||
|
|
@ -733,7 +737,7 @@ _PyJit_translate_single_bytecode_to_trace(
|
|||
int32_t old_target = (int32_t)uop_get_target(curr);
|
||||
curr++;
|
||||
trace_length++;
|
||||
curr->opcode = exit_op;
|
||||
curr->opcode = _DEOPT;
|
||||
curr->format = UOP_FORMAT_TARGET;
|
||||
curr->target = old_target;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue