@@ -719,7 +719,7 @@ specialize(_Py_CODEUNIT *instr, uint8_t specialized_opcode)
719719}
720720
721721static inline void
722- unspecialize (_Py_CODEUNIT * instr , int reason )
722+ unspecialize (_Py_CODEUNIT * instr )
723723{
724724 assert (!PyErr_Occurred ());
725725 uint8_t opcode = FT_ATOMIC_LOAD_UINT8_RELAXED (instr -> op .code );
@@ -729,7 +729,6 @@ unspecialize(_Py_CODEUNIT *instr, int reason)
729729 SPECIALIZATION_FAIL (generic_opcode , SPEC_FAIL_OTHER );
730730 return ;
731731 }
732- SPECIALIZATION_FAIL (generic_opcode , reason );
733732 _Py_BackoffCounter * counter = (_Py_BackoffCounter * )instr + 1 ;
734733 _Py_BackoffCounter cur = load_counter (counter );
735734 set_counter (counter , adaptive_counter_backoff (cur ));
@@ -2243,6 +2242,7 @@ _Py_Specialize_CallKw(_PyStackRef callable_st, _Py_CODEUNIT *instr, int nargs)
22432242 }
22442243}
22452244
2245+ #ifdef Py_STATS
22462246static int
22472247binary_op_fail_kind (int oparg , PyObject * lhs , PyObject * rhs )
22482248{
@@ -2310,6 +2310,7 @@ binary_op_fail_kind(int oparg, PyObject *lhs, PyObject *rhs)
23102310 }
23112311 Py_UNREACHABLE ();
23122312}
2313+ #endif
23132314
23142315void
23152316_Py_Specialize_BinaryOp (_PyStackRef lhs_st , _PyStackRef rhs_st , _Py_CODEUNIT * instr ,
@@ -2373,7 +2374,8 @@ _Py_Specialize_BinaryOp(_PyStackRef lhs_st, _PyStackRef rhs_st, _Py_CODEUNIT *in
23732374 }
23742375 break ;
23752376 }
2376- unspecialize (instr , binary_op_fail_kind (oparg , lhs , rhs ));
2377+ SPECIALIZATION_FAIL (BINARY_OP , binary_op_fail_kind (oparg , lhs , rhs ));
2378+ unspecialize (instr );
23772379}
23782380
23792381
@@ -2760,6 +2762,7 @@ _Py_Specialize_ToBool(_PyStackRef value_o, _Py_CODEUNIT *instr)
27602762 cache -> counter = adaptive_counter_cooldown ();
27612763}
27622764
2765+ #ifdef Py_STATS
27632766static int
27642767containsop_fail_kind (PyObject * value ) {
27652768 if (PyUnicode_CheckExact (value )) {
@@ -2776,6 +2779,7 @@ containsop_fail_kind(PyObject *value) {
27762779 }
27772780 return SPEC_FAIL_OTHER ;
27782781}
2782+ #endif
27792783
27802784void
27812785_Py_Specialize_ContainsOp (_PyStackRef value_st , _Py_CODEUNIT * instr )
@@ -2793,7 +2797,8 @@ _Py_Specialize_ContainsOp(_PyStackRef value_st, _Py_CODEUNIT *instr)
27932797 return ;
27942798 }
27952799
2796- unspecialize (instr , containsop_fail_kind (value ));
2800+ SPECIALIZATION_FAIL (CONTAINS_OP , containsop_fail_kind (value ));
2801+ unspecialize (instr );
27972802 return ;
27982803}
27992804
0 commit comments