]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
remove two chain depths
authorKen Jin <28750310+Fidget-Spinner@users.noreply.github.com>
Wed, 5 Nov 2025 18:53:30 +0000 (18:53 +0000)
committerKen Jin <28750310+Fidget-Spinner@users.noreply.github.com>
Wed, 5 Nov 2025 18:53:30 +0000 (18:53 +0000)
Include/internal/pycore_optimizer.h
Python/optimizer.c

index daa5d36da474fbec7c3f7fe094126bee54c99e95..3ea62eab1f4693a9949d27130df199418f7c5b49 100644 (file)
@@ -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 */
 
index 24ca1c5c03940bd06fafe857241deee0529569bc..d4578b5e2bde757c8dfccfd0709ccee4565ae0a0 100644 (file)
@@ -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;