Skip to content

Commit 127797f

Browse files
authored
bpo-46841: Improve the failure stats for COMPARE_OP (GH-31663)
1 parent cc40058 commit 127797f

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Add more detailed specialization failure stats for :opcode:`COMPARE_OP`
2+
followed by :opcode:`EXTENDED_ARG`.

Python/specialize.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,7 @@ initial_counter_value(void) {
616616
#define SPEC_FAIL_COMPARE_OP_BASEOBJECT 21
617617
#define SPEC_FAIL_COMPARE_OP_FLOAT_LONG 22
618618
#define SPEC_FAIL_COMPARE_OP_LONG_FLOAT 23
619+
#define SPEC_FAIL_COMPARE_OP_EXTENDED_ARG 24
619620

620621
/* FOR_ITER */
621622
#define SPEC_FAIL_FOR_ITER_GENERATOR 10
@@ -2088,6 +2089,10 @@ _Py_Specialize_CompareOp(PyObject *lhs, PyObject *rhs, _Py_CODEUNIT *instr,
20882089
*instr = _Py_MAKECODEUNIT(COMPARE_OP, oparg);
20892090
return;
20902091
#endif
2092+
if (next_opcode == EXTENDED_ARG) {
2093+
SPECIALIZATION_FAIL(COMPARE_OP, SPEC_FAIL_COMPARE_OP_EXTENDED_ARG);
2094+
goto failure;
2095+
}
20912096
SPECIALIZATION_FAIL(COMPARE_OP, SPEC_FAIL_COMPARE_OP_NOT_FOLLOWED_BY_COND_JUMP);
20922097
goto failure;
20932098
}

0 commit comments

Comments
 (0)