summaryrefslogtreecommitdiffstats
path: root/Python/generated_cases.c.h
diff options
context:
space:
mode:
authorKen Jin <kenjin@python.org>2024-03-07 16:21:21 (GMT)
committerGitHub <noreply@github.com>2024-03-07 16:21:21 (GMT)
commit41457c7fdb04819d04a528b8dfa72c1aa5745cc9 (patch)
tree45a20bbed062946dae7b20c9fb616245b2751485 /Python/generated_cases.c.h
parent4298d69d4b2f7d0e9d93ad325238930bd6235dbf (diff)
downloadcpython-41457c7fdb04819d04a528b8dfa72c1aa5745cc9.zip
cpython-41457c7fdb04819d04a528b8dfa72c1aa5745cc9.tar.gz
cpython-41457c7fdb04819d04a528b8dfa72c1aa5745cc9.tar.bz2
gh-116381: Remove bad specializations, add fail stats (GH-116464)
* Remove bad specializations, add fail stats
Diffstat (limited to 'Python/generated_cases.c.h')
-rw-r--r--Python/generated_cases.c.h71
1 files changed, 4 insertions, 67 deletions
diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h
index 54c4861..f5d125c 100644
--- a/Python/generated_cases.c.h
+++ b/Python/generated_cases.c.h
@@ -2176,6 +2176,7 @@
right = stack_pointer[-1];
left = stack_pointer[-2];
DEOPT_IF(!PyDict_CheckExact(right), CONTAINS_OP);
+ STAT_INC(CONTAINS_OP, hit);
int res = PyDict_Contains(right, left);
Py_DECREF(left);
Py_DECREF(right);
@@ -2186,28 +2187,6 @@
DISPATCH();
}
- TARGET(CONTAINS_OP_LIST) {
- frame->instr_ptr = next_instr;
- next_instr += 2;
- INSTRUCTION_STATS(CONTAINS_OP_LIST);
- static_assert(INLINE_CACHE_ENTRIES_CONTAINS_OP == 1, "incorrect cache size");
- PyObject *right;
- PyObject *left;
- PyObject *b;
- /* Skip 1 cache entry */
- right = stack_pointer[-1];
- left = stack_pointer[-2];
- DEOPT_IF(!PyList_CheckExact(right), CONTAINS_OP);
- int res = _PyList_Contains(right, left);
- Py_DECREF(left);
- Py_DECREF(right);
- if (res < 0) goto pop_2_error;
- b = (res ^ oparg) ? Py_True : Py_False;
- stack_pointer[-2] = b;
- stack_pointer += -1;
- DISPATCH();
- }
-
TARGET(CONTAINS_OP_SET) {
frame->instr_ptr = next_instr;
next_instr += 2;
@@ -2219,7 +2198,9 @@
/* Skip 1 cache entry */
right = stack_pointer[-1];
left = stack_pointer[-2];
- DEOPT_IF(!PySet_CheckExact(right), CONTAINS_OP);
+ DEOPT_IF(!(PySet_CheckExact(right) || PyFrozenSet_CheckExact(right)), CONTAINS_OP);
+ STAT_INC(CONTAINS_OP, hit);
+ // Note: both set and frozenset use the same seq_contains method!
int res = _PySet_Contains((PySetObject *)right, left);
Py_DECREF(left);
Py_DECREF(right);
@@ -2230,50 +2211,6 @@
DISPATCH();
}
- TARGET(CONTAINS_OP_STR) {
- frame->instr_ptr = next_instr;
- next_instr += 2;
- INSTRUCTION_STATS(CONTAINS_OP_STR);
- static_assert(INLINE_CACHE_ENTRIES_CONTAINS_OP == 1, "incorrect cache size");
- PyObject *right;
- PyObject *left;
- PyObject *b;
- /* Skip 1 cache entry */
- right = stack_pointer[-1];
- left = stack_pointer[-2];
- DEOPT_IF(!PyUnicode_CheckExact(right), CONTAINS_OP);
- int res = PyUnicode_Contains(right, left);
- Py_DECREF(left);
- Py_DECREF(right);
- if (res < 0) goto pop_2_error;
- b = (res ^ oparg) ? Py_True : Py_False;
- stack_pointer[-2] = b;
- stack_pointer += -1;
- DISPATCH();
- }
-
- TARGET(CONTAINS_OP_TUPLE) {
- frame->instr_ptr = next_instr;
- next_instr += 2;
- INSTRUCTION_STATS(CONTAINS_OP_TUPLE);
- static_assert(INLINE_CACHE_ENTRIES_CONTAINS_OP == 1, "incorrect cache size");
- PyObject *right;
- PyObject *left;
- PyObject *b;
- /* Skip 1 cache entry */
- right = stack_pointer[-1];
- left = stack_pointer[-2];
- DEOPT_IF(!PyTuple_CheckExact(right), CONTAINS_OP);
- int res = _PyTuple_Contains((PyTupleObject *)right, left);
- Py_DECREF(left);
- Py_DECREF(right);
- if (res < 0) goto pop_2_error;
- b = (res ^ oparg) ? Py_True : Py_False;
- stack_pointer[-2] = b;
- stack_pointer += -1;
- DISPATCH();
- }
-
TARGET(CONVERT_VALUE) {
frame->instr_ptr = next_instr;
next_instr += 1;