summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrandt Bucher <brandtbucher@microsoft.com>2022-03-03 19:28:47 (GMT)
committerGitHub <noreply@github.com>2022-03-03 19:28:47 (GMT)
commit127797f572cc7374192e415c44ea2e95b009d5ab (patch)
tree582f20ed225250c33e2e7ea7b81a715ab9e8dd18
parentcc400585fab02994255f21ae8183d5f147236815 (diff)
downloadcpython-127797f572cc7374192e415c44ea2e95b009d5ab.zip
cpython-127797f572cc7374192e415c44ea2e95b009d5ab.tar.gz
cpython-127797f572cc7374192e415c44ea2e95b009d5ab.tar.bz2
bpo-46841: Improve the failure stats for COMPARE_OP (GH-31663)
-rw-r--r--Misc/NEWS.d/next/Core and Builtins/2022-03-03-10-46-13.bpo-46841.7CkuZx.rst2
-rw-r--r--Python/specialize.c5
2 files changed, 7 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Core and Builtins/2022-03-03-10-46-13.bpo-46841.7CkuZx.rst b/Misc/NEWS.d/next/Core and Builtins/2022-03-03-10-46-13.bpo-46841.7CkuZx.rst
new file mode 100644
index 0000000..8be83bc
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2022-03-03-10-46-13.bpo-46841.7CkuZx.rst
@@ -0,0 +1,2 @@
+Add more detailed specialization failure stats for :opcode:`COMPARE_OP`
+followed by :opcode:`EXTENDED_ARG`.
diff --git a/Python/specialize.c b/Python/specialize.c
index 6762582..4a94aaf 100644
--- a/Python/specialize.c
+++ b/Python/specialize.c
@@ -616,6 +616,7 @@ initial_counter_value(void) {
#define SPEC_FAIL_COMPARE_OP_BASEOBJECT 21
#define SPEC_FAIL_COMPARE_OP_FLOAT_LONG 22
#define SPEC_FAIL_COMPARE_OP_LONG_FLOAT 23
+#define SPEC_FAIL_COMPARE_OP_EXTENDED_ARG 24
/* FOR_ITER */
#define SPEC_FAIL_FOR_ITER_GENERATOR 10
@@ -2088,6 +2089,10 @@ _Py_Specialize_CompareOp(PyObject *lhs, PyObject *rhs, _Py_CODEUNIT *instr,
*instr = _Py_MAKECODEUNIT(COMPARE_OP, oparg);
return;
#endif
+ if (next_opcode == EXTENDED_ARG) {
+ SPECIALIZATION_FAIL(COMPARE_OP, SPEC_FAIL_COMPARE_OP_EXTENDED_ARG);
+ goto failure;
+ }
SPECIALIZATION_FAIL(COMPARE_OP, SPEC_FAIL_COMPARE_OP_NOT_FOLLOWED_BY_COND_JUMP);
goto failure;
}