@@ -167,6 +167,7 @@ _PyOptimizer_BackEdge(_PyInterpreterFrame *frame, _Py_CODEUNIT *src, _Py_CODEUNI
167167 }
168168 _PyOptimizerObject * opt = interp -> optimizer ;
169169 _PyExecutorObject * executor = NULL ;
170+ /* Start optimizing at the destination to guarantee forward progress */
170171 int err = opt -> optimize (opt , code , dest , & executor , (int )(stack_pointer - _PyFrame_Stackbase (frame )));
171172 if (err <= 0 ) {
172173 assert (executor == NULL );
@@ -247,14 +248,13 @@ PyTypeObject _PyCounterExecutor_Type = {
247248 .tp_methods = executor_methods ,
248249};
249250
250- static _PyInterpreterFrame *
251+ static _Py_CODEUNIT *
251252counter_execute (_PyExecutorObject * self , _PyInterpreterFrame * frame , PyObject * * stack_pointer )
252253{
253254 ((_PyCounterExecutorObject * )self )-> optimizer -> count ++ ;
254255 _PyFrame_SetStackPointer (frame , stack_pointer );
255- frame -> instr_ptr = ((_PyCounterExecutorObject * )self )-> next_instr ;
256256 Py_DECREF (self );
257- return frame ;
257+ return (( _PyCounterExecutorObject * ) self ) -> next_instr ;
258258}
259259
260260static int
@@ -891,7 +891,7 @@ uop_optimize(
891891/* Dummy execute() function for UOp Executor.
892892 * The actual implementation is inlined in ceval.c,
893893 * in _PyEval_EvalFrameDefault(). */
894- _PyInterpreterFrame *
894+ _Py_CODEUNIT *
895895_PyUOpExecute (_PyExecutorObject * executor , _PyInterpreterFrame * frame , PyObject * * stack_pointer )
896896{
897897 Py_FatalError ("Tier 2 is now inlined into Tier 1" );
0 commit comments