@@ -973,6 +973,21 @@ _PyObjectArray_Free(PyObject **array, PyObject **scratch)
973973 }
974974}
975975
976+ // 1 for trace full, 0 for successful write.
977+ static inline int
978+ add_to_code_trace (PyThreadState * tstate , _Py_CODEUNIT * this_instr )
979+ {
980+ assert (tstate -> interp -> jit_tracer_code_curr_size < TRACE_MAX_TRACE_LENGTH );
981+ int curr_size = tstate -> interp -> jit_tracer_code_curr_size ;
982+ int nsize = _PyOpcode_Caches [this_instr -> op .code ] + 1 ;
983+ if (curr_size + nsize > TRACE_MAX_TRACE_LENGTH ) {
984+ return 1 ;
985+ }
986+ for (int i = 0 ; i < nsize ; i ++ ) {
987+ tstate -> interp -> jit_tracer_code_buffer [curr_size + i ] = * (this_instr + i );
988+ }
989+ return 0 ;
990+ }
976991
977992/* _PyEval_EvalFrameDefault is too large to optimize for speed with PGO on MSVC.
978993 */
@@ -1102,9 +1117,9 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
11021117 stack_pointer = _PyFrame_GetStackPointer (frame );
11031118#if _Py_TAIL_CALL_INTERP
11041119# if Py_STATS
1105- return _TAIL_CALL_error (frame , stack_pointer , tstate , next_instr , instruction_funcptr_table , 0 , lastopcode );
1120+ return _TAIL_CALL_error (frame , stack_pointer , tstate , next_instr , instruction_funcptr_handler_table , 0 , lastopcode );
11061121# else
1107- return _TAIL_CALL_error (frame , stack_pointer , tstate , next_instr , instruction_funcptr_table , 0 );
1122+ return _TAIL_CALL_error (frame , stack_pointer , tstate , next_instr , instruction_funcptr_handler_table , 0 );
11081123# endif
11091124#else
11101125 goto error ;
@@ -1113,9 +1128,9 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
11131128
11141129#if _Py_TAIL_CALL_INTERP
11151130# if Py_STATS
1116- return _TAIL_CALL_start_frame (frame , NULL , tstate , NULL , instruction_funcptr_table , 0 , lastopcode );
1131+ return _TAIL_CALL_start_frame (frame , NULL , tstate , NULL , instruction_funcptr_handler_table , 0 , lastopcode );
11171132# else
1118- return _TAIL_CALL_start_frame (frame , NULL , tstate , NULL , instruction_funcptr_table , 0 );
1133+ return _TAIL_CALL_start_frame (frame , NULL , tstate , NULL , instruction_funcptr_handler_table , 0 );
11191134# endif
11201135#else
11211136 goto start_frame ;
0 commit comments