summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorKen Jin <28750310+Fidget-Spinner@users.noreply.github.com>2021-10-19 16:25:31 (GMT)
committerGitHub <noreply@github.com>2021-10-19 16:25:31 (GMT)
commit6e35b096ac07288a2e23909bb39f3a18c0c83951 (patch)
treeaccd9d7d55a7d5b1739d899d2facbfe2291cb903 /Python
parent09c04e7f0d26f0006964554b6a0caa5ef7f0bd24 (diff)
downloadcpython-6e35b096ac07288a2e23909bb39f3a18c0c83951.zip
cpython-6e35b096ac07288a2e23909bb39f3a18c0c83951.tar.gz
cpython-6e35b096ac07288a2e23909bb39f3a18c0c83951.tar.bz2
Record cache hits for BINARY_SUBSCR specializations (GH-29060)
Diffstat (limited to 'Python')
-rw-r--r--Python/ceval.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index 05bdcc5..2fb60a8 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -2242,6 +2242,7 @@ check_eval_breaker:
Py_ssize_t index = ((PyLongObject*)sub)->ob_digit[0];
DEOPT_IF(index >= PyList_GET_SIZE(list), BINARY_SUBSCR);
+ record_hit_inline(next_instr, oparg);
STAT_INC(BINARY_SUBSCR, hit);
PyObject *res = PyList_GET_ITEM(list, index);
assert(res != NULL);
@@ -2266,6 +2267,7 @@ check_eval_breaker:
Py_ssize_t index = ((PyLongObject*)sub)->ob_digit[0];
DEOPT_IF(index >= PyTuple_GET_SIZE(tuple), BINARY_SUBSCR);
+ record_hit_inline(next_instr, oparg);
STAT_INC(BINARY_SUBSCR, hit);
PyObject *res = PyTuple_GET_ITEM(tuple, index);
assert(res != NULL);
@@ -2280,6 +2282,7 @@ check_eval_breaker:
TARGET(BINARY_SUBSCR_DICT) {
PyObject *dict = SECOND();
DEOPT_IF(!PyDict_CheckExact(SECOND()), BINARY_SUBSCR);
+ record_hit_inline(next_instr, oparg);
STAT_INC(BINARY_SUBSCR, hit);
PyObject *sub = TOP();
PyObject *res = PyDict_GetItemWithError(dict, sub);