mirror of
https://github.com/python/cpython.git
synced 2025-08-28 20:56:54 +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
59
Python/executor_cases.c.h
generated
59
Python/executor_cases.c.h
generated
|
@ -2189,24 +2189,6 @@
|
|||
break;
|
||||
}
|
||||
|
||||
case _CONTAINS_OP_LIST: {
|
||||
PyObject *right;
|
||||
PyObject *left;
|
||||
PyObject *b;
|
||||
oparg = CURRENT_OPARG();
|
||||
right = stack_pointer[-1];
|
||||
left = stack_pointer[-2];
|
||||
if (!PyList_CheckExact(right)) goto deoptimize;
|
||||
int res = _PyList_Contains(right, left);
|
||||
Py_DECREF(left);
|
||||
Py_DECREF(right);
|
||||
if (res < 0) goto pop_2_error_tier_two;
|
||||
b = (res ^ oparg) ? Py_True : Py_False;
|
||||
stack_pointer[-2] = b;
|
||||
stack_pointer += -1;
|
||||
break;
|
||||
}
|
||||
|
||||
case _CONTAINS_OP_SET: {
|
||||
PyObject *right;
|
||||
PyObject *left;
|
||||
|
@ -2214,7 +2196,9 @@
|
|||
oparg = CURRENT_OPARG();
|
||||
right = stack_pointer[-1];
|
||||
left = stack_pointer[-2];
|
||||
if (!PySet_CheckExact(right)) goto deoptimize;
|
||||
if (!(PySet_CheckExact(right) || PyFrozenSet_CheckExact(right))) goto deoptimize;
|
||||
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);
|
||||
|
@ -2225,24 +2209,6 @@
|
|||
break;
|
||||
}
|
||||
|
||||
case _CONTAINS_OP_TUPLE: {
|
||||
PyObject *right;
|
||||
PyObject *left;
|
||||
PyObject *b;
|
||||
oparg = CURRENT_OPARG();
|
||||
right = stack_pointer[-1];
|
||||
left = stack_pointer[-2];
|
||||
if (!PyTuple_CheckExact(right)) goto deoptimize;
|
||||
int res = _PyTuple_Contains((PyTupleObject *)right, left);
|
||||
Py_DECREF(left);
|
||||
Py_DECREF(right);
|
||||
if (res < 0) goto pop_2_error_tier_two;
|
||||
b = (res ^ oparg) ? Py_True : Py_False;
|
||||
stack_pointer[-2] = b;
|
||||
stack_pointer += -1;
|
||||
break;
|
||||
}
|
||||
|
||||
case _CONTAINS_OP_DICT: {
|
||||
PyObject *right;
|
||||
PyObject *left;
|
||||
|
@ -2251,6 +2217,7 @@
|
|||
right = stack_pointer[-1];
|
||||
left = stack_pointer[-2];
|
||||
if (!PyDict_CheckExact(right)) goto deoptimize;
|
||||
STAT_INC(CONTAINS_OP, hit);
|
||||
int res = PyDict_Contains(right, left);
|
||||
Py_DECREF(left);
|
||||
Py_DECREF(right);
|
||||
|
@ -2261,24 +2228,6 @@
|
|||
break;
|
||||
}
|
||||
|
||||
case _CONTAINS_OP_STR: {
|
||||
PyObject *right;
|
||||
PyObject *left;
|
||||
PyObject *b;
|
||||
oparg = CURRENT_OPARG();
|
||||
right = stack_pointer[-1];
|
||||
left = stack_pointer[-2];
|
||||
if (!PyUnicode_CheckExact(right)) goto deoptimize;
|
||||
int res = PyUnicode_Contains(right, left);
|
||||
Py_DECREF(left);
|
||||
Py_DECREF(right);
|
||||
if (res < 0) goto pop_2_error_tier_two;
|
||||
b = (res ^ oparg) ? Py_True : Py_False;
|
||||
stack_pointer[-2] = b;
|
||||
stack_pointer += -1;
|
||||
break;
|
||||
}
|
||||
|
||||
case _CHECK_EG_MATCH: {
|
||||
PyObject *match_type;
|
||||
PyObject *exc_value;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue