@@ -4741,6 +4741,9 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr
47414741 PyObject * callable = SECOND ();
47424742 DEOPT_IF (!PyCFunction_CheckExact (callable ), CALL_FUNCTION );
47434743 DEOPT_IF (PyCFunction_GET_FLAGS (callable ) != METH_O , CALL_FUNCTION );
4744+ _PyAdaptiveEntry * cache0 = & GET_CACHE ()[0 ].adaptive ;
4745+ record_cache_hit (cache0 );
4746+ STAT_INC (CALL_FUNCTION , hit );
47444747
47454748 PyCFunction cfunc = PyCFunction_GET_FUNCTION (callable );
47464749 PyObject * arg = POP ();
@@ -4751,7 +4754,6 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr
47514754 Py_DECREF (arg );
47524755 Py_DECREF (callable );
47534756 SET_TOP (res );
4754- STAT_INC (CALL_FUNCTION , hit );
47554757 if (res == NULL ) {
47564758 goto error ;
47574759 }
@@ -4769,6 +4771,8 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr
47694771 DEOPT_IF (!PyCFunction_CheckExact (callable ), CALL_FUNCTION );
47704772 DEOPT_IF (PyCFunction_GET_FLAGS (callable ) != METH_FASTCALL ,
47714773 CALL_FUNCTION );
4774+ record_cache_hit (cache0 );
4775+ STAT_INC (CALL_FUNCTION , hit );
47724776
47734777 PyCFunction cfunc = PyCFunction_GET_FUNCTION (callable );
47744778 /* res = func(self, args, nargs) */
@@ -4784,8 +4788,6 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr
47844788 Py_DECREF (x );
47854789 }
47864790 PUSH (res );
4787- record_cache_hit (cache0 );
4788- STAT_INC (CALL_FUNCTION , hit );
47894791 if (res == NULL ) {
47904792 /* Not deopting because this doesn't mean our optimization was
47914793 wrong. `res` can be NULL for valid reasons. Eg. getattr(x,
0 commit comments