]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-46841: Improve the failure stats for COMPARE_OP (GH-31663)
authorBrandt Bucher <brandtbucher@microsoft.com>
Thu, 3 Mar 2022 19:28:47 +0000 (11:28 -0800)
committerGitHub <noreply@github.com>
Thu, 3 Mar 2022 19:28:47 +0000 (11:28 -0800)
Misc/NEWS.d/next/Core and Builtins/2022-03-03-10-46-13.bpo-46841.7CkuZx.rst [new file with mode: 0644]
Python/specialize.c

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 (file)
index 0000000..8be83bc
--- /dev/null
@@ -0,0 +1,2 @@
+Add more detailed specialization failure stats for :opcode:`COMPARE_OP`
+followed by :opcode:`EXTENDED_ARG`.
index 676258268f1786e3fe0b9dc5db4e00c0bc681102..4a94aafefea9c154f1b7148a6951330eb2f5b02d 100644 (file)
@@ -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;
     }