4040
4141#define _PyExecutorObject_CAST (op ) ((_PyExecutorObject *)(op))
4242
43+ #ifndef Py_GIL_DISABLED
4344static bool
4445has_space_for_executor (PyCodeObject * code , _Py_CODEUNIT * instr )
4546{
@@ -110,6 +111,7 @@ insert_executor(PyCodeObject *code, _Py_CODEUNIT *instr, int index, _PyExecutorO
110111 instr -> op .code = ENTER_EXECUTOR ;
111112 instr -> op .arg = index ;
112113}
114+ #endif // Py_GIL_DISABLED
113115
114116static _PyExecutorObject *
115117make_executor_from_uops (_PyThreadStateImpl * tstate , _PyUOpInstruction * buffer , int length , const _PyBloomFilter * dependencies );
@@ -128,7 +130,6 @@ _PyOptimizer_Optimize(
128130 _PyInterpreterFrame * frame , PyThreadState * tstate )
129131{
130132 _PyThreadStateImpl * _tstate = (_PyThreadStateImpl * )tstate ;
131- int chain_depth = _tstate -> jit_tracer_state -> initial_state .chain_depth ;
132133 PyInterpreterState * interp = _PyInterpreterState_GET ();
133134 if (!interp -> jit ) {
134135 // gh-140936: It is possible that interp->jit will become false during
@@ -152,6 +153,7 @@ _PyOptimizer_Optimize(
152153 // make progress in order to avoid infinite loops or excessively-long
153154 // side-exit chains. We can only insert the executor into the bytecode if
154155 // this is true, since a deopt won't infinitely re-enter the executor:
156+ int chain_depth = _tstate -> jit_tracer_state -> initial_state .chain_depth ;
155157 chain_depth %= MAX_CHAIN_DEPTH ;
156158 bool progress_needed = chain_depth == 0 ;
157159 PyCodeObject * code = (PyCodeObject * )_tstate -> jit_tracer_state -> initial_state .code ;
0 commit comments