@@ -4741,6 +4741,9 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr
4741
4741
PyObject * callable = SECOND ();
4742
4742
DEOPT_IF (!PyCFunction_CheckExact (callable ), CALL_FUNCTION );
4743
4743
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 );
4744
4747
4745
4748
PyCFunction cfunc = PyCFunction_GET_FUNCTION (callable );
4746
4749
PyObject * arg = POP ();
@@ -4751,7 +4754,6 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr
4751
4754
Py_DECREF (arg );
4752
4755
Py_DECREF (callable );
4753
4756
SET_TOP (res );
4754
- STAT_INC (CALL_FUNCTION , hit );
4755
4757
if (res == NULL ) {
4756
4758
goto error ;
4757
4759
}
@@ -4769,6 +4771,8 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr
4769
4771
DEOPT_IF (!PyCFunction_CheckExact (callable ), CALL_FUNCTION );
4770
4772
DEOPT_IF (PyCFunction_GET_FLAGS (callable ) != METH_FASTCALL ,
4771
4773
CALL_FUNCTION );
4774
+ record_cache_hit (cache0 );
4775
+ STAT_INC (CALL_FUNCTION , hit );
4772
4776
4773
4777
PyCFunction cfunc = PyCFunction_GET_FUNCTION (callable );
4774
4778
/* res = func(self, args, nargs) */
@@ -4784,8 +4788,6 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr
4784
4788
Py_DECREF (x );
4785
4789
}
4786
4790
PUSH (res );
4787
- record_cache_hit (cache0 );
4788
- STAT_INC (CALL_FUNCTION , hit );
4789
4791
if (res == NULL ) {
4790
4792
/* Not deopting because this doesn't mean our optimization was
4791
4793
wrong. `res` can be NULL for valid reasons. Eg. getattr(x,
0 commit comments