mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
gh-116381: Remove bad specializations, add fail stats (GH-116464)
* Remove bad specializations, add fail stats
This commit is contained in:
parent
4298d69d4b
commit
41457c7fdb
16 changed files with 125 additions and 320 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue