diff options
author | Ken Jin <kenjin@python.org> | 2024-03-07 16:21:21 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-07 16:21:21 (GMT) |
commit | 41457c7fdb04819d04a528b8dfa72c1aa5745cc9 (patch) | |
tree | 45a20bbed062946dae7b20c9fb616245b2751485 /Python/bytecodes.c | |
parent | 4298d69d4b2f7d0e9d93ad325238930bd6235dbf (diff) | |
download | cpython-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/bytecodes.c')
-rw-r--r-- | Python/bytecodes.c | 32 |
1 files changed, 4 insertions, 28 deletions
diff --git a/Python/bytecodes.c b/Python/bytecodes.c index 3276a4a..0397d96 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -2238,11 +2238,8 @@ dummy_func( } family(CONTAINS_OP, INLINE_CACHE_ENTRIES_CONTAINS_OP) = { - CONTAINS_OP_LIST, CONTAINS_OP_SET, - CONTAINS_OP_TUPLE, CONTAINS_OP_DICT, - CONTAINS_OP_STR, }; op(_CONTAINS_OP, (left, right -- b)) { @@ -2266,46 +2263,25 @@ dummy_func( macro(CONTAINS_OP) = _SPECIALIZE_CONTAINS_OP + _CONTAINS_OP; - inst(CONTAINS_OP_LIST, (unused/1, left, right -- b)) { - DEOPT_IF(!PyList_CheckExact(right)); - int res = _PyList_Contains(right, left); - DECREF_INPUTS(); - ERROR_IF(res < 0, error); - b = (res ^ oparg) ? Py_True : Py_False; - } - inst(CONTAINS_OP_SET, (unused/1, left, right -- b)) { - DEOPT_IF(!PySet_CheckExact(right)); + DEOPT_IF(!(PySet_CheckExact(right) || PyFrozenSet_CheckExact(right))); + STAT_INC(CONTAINS_OP, hit); + // Note: both set and frozenset use the same seq_contains method! int res = _PySet_Contains((PySetObject *)right, left); DECREF_INPUTS(); ERROR_IF(res < 0, error); b = (res ^ oparg) ? Py_True : Py_False; } - inst(CONTAINS_OP_TUPLE, (unused/1, left, right -- b)) { - DEOPT_IF(!PyTuple_CheckExact(right)); - int res = _PyTuple_Contains((PyTupleObject *)right, left); - DECREF_INPUTS(); - ERROR_IF(res < 0, error); - b = (res ^ oparg) ? Py_True : Py_False; - } - inst(CONTAINS_OP_DICT, (unused/1, left, right -- b)) { DEOPT_IF(!PyDict_CheckExact(right)); + STAT_INC(CONTAINS_OP, hit); int res = PyDict_Contains(right, left); DECREF_INPUTS(); ERROR_IF(res < 0, error); b = (res ^ oparg) ? Py_True : Py_False; } - inst(CONTAINS_OP_STR, (unused/1, left, right -- b)) { - DEOPT_IF(!PyUnicode_CheckExact(right)); - int res = PyUnicode_Contains(right, left); - DECREF_INPUTS(); - ERROR_IF(res < 0, error); - b = (res ^ oparg) ? Py_True : Py_False; - } - inst(CHECK_EG_MATCH, (exc_value, match_type -- rest, match)) { if (_PyEval_CheckExceptStarTypeValid(tstate, match_type) < 0) { DECREF_INPUTS(); |