Skip to content

Commit 6e35b09

Browse files
Record cache hits for BINARY_SUBSCR specializations (GH-29060)
1 parent 09c04e7 commit 6e35b09

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Python/ceval.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2242,6 +2242,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr
22422242
Py_ssize_t index = ((PyLongObject*)sub)->ob_digit[0];
22432243
DEOPT_IF(index >= PyList_GET_SIZE(list), BINARY_SUBSCR);
22442244

2245+
record_hit_inline(next_instr, oparg);
22452246
STAT_INC(BINARY_SUBSCR, hit);
22462247
PyObject *res = PyList_GET_ITEM(list, index);
22472248
assert(res != NULL);
@@ -2266,6 +2267,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr
22662267
Py_ssize_t index = ((PyLongObject*)sub)->ob_digit[0];
22672268
DEOPT_IF(index >= PyTuple_GET_SIZE(tuple), BINARY_SUBSCR);
22682269

2270+
record_hit_inline(next_instr, oparg);
22692271
STAT_INC(BINARY_SUBSCR, hit);
22702272
PyObject *res = PyTuple_GET_ITEM(tuple, index);
22712273
assert(res != NULL);
@@ -2280,6 +2282,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr
22802282
TARGET(BINARY_SUBSCR_DICT) {
22812283
PyObject *dict = SECOND();
22822284
DEOPT_IF(!PyDict_CheckExact(SECOND()), BINARY_SUBSCR);
2285+
record_hit_inline(next_instr, oparg);
22832286
STAT_INC(BINARY_SUBSCR, hit);
22842287
PyObject *sub = TOP();
22852288
PyObject *res = PyDict_GetItemWithError(dict, sub);

0 commit comments

Comments
 (0)