@@ -2760,8 +2760,8 @@ _Py_Specialize_ToBool(_PyStackRef value_o, _Py_CODEUNIT *instr)
2760
2760
cache -> counter = adaptive_counter_cooldown ();
2761
2761
}
2762
2762
2763
- #ifdef Py_STATS
2764
- static int containsop_fail_kind (PyObject * value ) {
2763
+ static int
2764
+ containsop_fail_kind (PyObject * value ) {
2765
2765
if (PyUnicode_CheckExact (value )) {
2766
2766
return SPEC_FAIL_CONTAINS_OP_STR ;
2767
2767
}
@@ -2776,7 +2776,6 @@ static int containsop_fail_kind(PyObject *value) {
2776
2776
}
2777
2777
return SPEC_FAIL_OTHER ;
2778
2778
}
2779
- #endif // Py_STATS
2780
2779
2781
2780
void
2782
2781
_Py_Specialize_ContainsOp (_PyStackRef value_st , _Py_CODEUNIT * instr )
@@ -2785,26 +2784,17 @@ _Py_Specialize_ContainsOp(_PyStackRef value_st, _Py_CODEUNIT *instr)
2785
2784
2786
2785
assert (ENABLE_SPECIALIZATION_FT );
2787
2786
assert (_PyOpcode_Caches [CONTAINS_OP ] == INLINE_CACHE_ENTRIES_COMPARE_OP );
2788
- uint8_t specialized_op ;
2789
- _PyContainsOpCache * cache = (_PyContainsOpCache * )(instr + 1 );
2790
2787
if (PyDict_CheckExact (value )) {
2791
- specialized_op = CONTAINS_OP_DICT ;
2792
- goto success ;
2788
+ specialize ( instr , CONTAINS_OP_DICT ) ;
2789
+ return ;
2793
2790
}
2794
2791
if (PySet_CheckExact (value ) || PyFrozenSet_CheckExact (value )) {
2795
- specialized_op = CONTAINS_OP_SET ;
2796
- goto success ;
2792
+ specialize ( instr , CONTAINS_OP_SET ) ;
2793
+ return ;
2797
2794
}
2798
2795
2799
- SPECIALIZATION_FAIL (CONTAINS_OP , containsop_fail_kind (value ));
2800
- STAT_INC (CONTAINS_OP , failure );
2801
- SET_OPCODE_OR_RETURN (instr , CONTAINS_OP );
2802
- cache -> counter = adaptive_counter_backoff (cache -> counter );
2796
+ unspecialize (instr , containsop_fail_kind (value ));
2803
2797
return ;
2804
- success :
2805
- STAT_INC (CONTAINS_OP , success );
2806
- SET_OPCODE_OR_RETURN (instr , specialized_op );
2807
- cache -> counter = adaptive_counter_cooldown ();
2808
2798
}
2809
2799
2810
2800
/* Code init cleanup.
0 commit comments