From 897edf53a384411dbf1fba4ccc20f4d11a050a80 Mon Sep 17 00:00:00 2001 From: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com> Date: Wed, 5 Nov 2025 18:53:30 +0000 Subject: [PATCH] remove two chain depths --- Include/internal/pycore_optimizer.h | 3 --- Python/optimizer.c | 7 +------ 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/Include/internal/pycore_optimizer.h b/Include/internal/pycore_optimizer.h index daa5d36da474..3ea62eab1f46 100644 --- a/Include/internal/pycore_optimizer.h +++ b/Include/internal/pycore_optimizer.h @@ -132,9 +132,6 @@ static inline uint16_t uop_get_error_target(const _PyUOpInstruction *inst) // handle before rejoining the rest of the program. #define MAX_CHAIN_DEPTH 4 -// The maximum number of side exits arising from unpredictable control-flow. -#define MAX_DYNAMIC_CHAIN_DEPTH 6 - /* Symbols */ /* See explanation in optimizer_symbols.c */ diff --git a/Python/optimizer.c b/Python/optimizer.c index 24ca1c5c0394..d4578b5e2bde 100644 --- a/Python/optimizer.c +++ b/Python/optimizer.c @@ -133,12 +133,7 @@ _PyOptimizer_Optimize( // make progress in order to avoid infinite loops or excessively-long // side-exit chains. We can only insert the executor into the bytecode if // this is true, since a deopt won't infinitely re-enter the executor: - if (tstate->interp->jit_state.code_buffer[0].opcode == _START_DYNAMIC_EXECUTOR) { - chain_depth %= MAX_DYNAMIC_CHAIN_DEPTH; - } - else { - chain_depth %= MAX_CHAIN_DEPTH; - } + chain_depth %= MAX_CHAIN_DEPTH; bool progress_needed = chain_depth == 0; PyCodeObject *code = (PyCodeObject *)tstate->interp->jit_state.initial_code; _Py_CODEUNIT *start = tstate->interp->jit_state.insert_exec_instr; -- 2.47.3