diff options
author | Mark Shannon <mark@hotpy.org> | 2021-07-29 19:50:03 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-29 19:50:03 (GMT) |
commit | 2116909b3e1f044c268cebea78c92c7f593f99fe (patch) | |
tree | b39210fd0ae1c5ee62cbe7fe6f7d7b9132fc6f28 /Python/specialize.c | |
parent | 7e311e496b0e26b3d3c62fe9b0ed2a4677c37ee9 (diff) | |
download | cpython-2116909b3e1f044c268cebea78c92c7f593f99fe.zip cpython-2116909b3e1f044c268cebea78c92c7f593f99fe.tar.gz cpython-2116909b3e1f044c268cebea78c92c7f593f99fe.tar.bz2 |
Minor fixes to specialization stats. (GH-27457)
* Use class, not value for fail stats for BINARY_SUBSCR.
* Fix counts for unquickened instructions.
Diffstat (limited to 'Python/specialize.c')
-rw-r--r-- | Python/specialize.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/Python/specialize.c b/Python/specialize.c index f699065..680ffb4 100644 --- a/Python/specialize.c +++ b/Python/specialize.c @@ -203,7 +203,8 @@ done: Py_XDECREF(key); } -#define SPECIALIZATION_FAIL(opcode, type, attribute, kind) _Py_IncrementTypeCounter(opcode, (PyObject *)(type), attribute, kind) +#define SPECIALIZATION_FAIL(opcode, type, attribute, kind) _Py_IncrementTypeCounter(opcode, (PyObject *)(type), (PyObject *)(attribute), kind) + #endif #endif @@ -722,6 +723,7 @@ success: return 0; } + int _Py_Specialize_BinarySubscr( PyObject *container, PyObject *sub, _Py_CODEUNIT *instr) @@ -732,7 +734,8 @@ _Py_Specialize_BinarySubscr( *instr = _Py_MAKECODEUNIT(BINARY_SUBSCR_LIST_INT, saturating_start()); goto success; } else { - SPECIALIZATION_FAIL(BINARY_SUBSCR, Py_TYPE(container), sub, "list; non-integer subscr"); + SPECIALIZATION_FAIL(BINARY_SUBSCR, Py_TYPE(container), Py_TYPE(sub), "list; non-integer subscr"); + goto fail; } } if (container_type == &PyTuple_Type) { @@ -740,15 +743,15 @@ _Py_Specialize_BinarySubscr( *instr = _Py_MAKECODEUNIT(BINARY_SUBSCR_TUPLE_INT, saturating_start()); goto success; } else { - SPECIALIZATION_FAIL(BINARY_SUBSCR, Py_TYPE(container), sub, "tuple; non-integer subscr"); + SPECIALIZATION_FAIL(BINARY_SUBSCR, Py_TYPE(container), Py_TYPE(sub), "tuple; non-integer subscr"); + goto fail; } } if (container_type == &PyDict_Type) { *instr = _Py_MAKECODEUNIT(BINARY_SUBSCR_DICT, saturating_start()); goto success; } - - SPECIALIZATION_FAIL(BINARY_SUBSCR, Py_TYPE(container), sub, "not list|tuple|dict"); + SPECIALIZATION_FAIL(BINARY_SUBSCR, Py_TYPE(container), Py_TYPE(sub), "not list|tuple|dict"); goto fail; fail: STAT_INC(BINARY_SUBSCR, specialization_failure); |