@@ -1046,7 +1046,7 @@ struct ExecutingFrame<'a> {
10461046}
10471047
10481048#[ inline]
1049- fn cpython_compact_int_value ( i : & PyInt , vm : & VirtualMachine ) -> Option < isize > {
1049+ fn specialization_compact_int_value ( i : & PyInt , vm : & VirtualMachine ) -> Option < isize > {
10501050 // _PyLong_IsCompact(): a one-digit PyLong (base 2^30),
10511051 // i.e. abs(value) <= 2^30 - 1.
10521052 const CPYTHON_COMPACT_LONG_ABS_MAX : i64 = ( 1i64 << 30 ) - 1 ;
@@ -1061,7 +1061,7 @@ fn cpython_compact_int_value(i: &PyInt, vm: &VirtualMachine) -> Option<isize> {
10611061#[ inline]
10621062fn compact_int_from_obj ( obj : & PyObject , vm : & VirtualMachine ) -> Option < isize > {
10631063 obj. downcast_ref_if_exact :: < PyInt > ( vm)
1064- . and_then ( |i| cpython_compact_int_value ( i, vm) )
1064+ . and_then ( |i| specialization_compact_int_value ( i, vm) )
10651065}
10661066
10671067#[ inline]
@@ -1070,7 +1070,7 @@ fn exact_float_from_obj(obj: &PyObject, vm: &VirtualMachine) -> Option<f64> {
10701070}
10711071
10721072#[ inline]
1073- fn cpython_nonnegative_compact_index ( i : & PyInt , vm : & VirtualMachine ) -> Option < usize > {
1073+ fn specialization_nonnegative_compact_index ( i : & PyInt , vm : & VirtualMachine ) -> Option < usize > {
10741074 // _PyLong_IsNonNegativeCompact(): a single base-2^30 digit.
10751075 const CPYTHON_COMPACT_LONG_MAX : u64 = ( 1u64 << 30 ) - 1 ;
10761076 let v = i. try_to_primitive :: < u64 > ( vm) . ok ( ) ?;
@@ -3926,7 +3926,7 @@ impl ExecutingFrame<'_> {
39263926 let value = self . pop_value ( ) ;
39273927 if let Some ( list) = obj. downcast_ref_if_exact :: < PyList > ( vm)
39283928 && let Some ( int_idx) = idx. downcast_ref_if_exact :: < PyInt > ( vm)
3929- && let Some ( i) = Self :: specialization_nonnegative_compact_index ( int_idx, vm)
3929+ && let Some ( i) = specialization_nonnegative_compact_index ( int_idx, vm)
39303930 {
39313931 let mut vec = list. borrow_vec_mut ( ) ;
39323932 if i < vec. len ( ) {
@@ -4026,7 +4026,7 @@ impl ExecutingFrame<'_> {
40264026 if let ( Some ( list) , Some ( idx) ) = (
40274027 a. downcast_ref_if_exact :: < PyList > ( vm) ,
40284028 b. downcast_ref_if_exact :: < PyInt > ( vm) ,
4029- ) && let Some ( i) = Self :: specialization_nonnegative_compact_index ( idx, vm)
4029+ ) && let Some ( i) = specialization_nonnegative_compact_index ( idx, vm)
40304030 {
40314031 let vec = list. borrow_vec ( ) ;
40324032 if i < vec. len ( ) {
@@ -4046,7 +4046,7 @@ impl ExecutingFrame<'_> {
40464046 if let ( Some ( tuple) , Some ( idx) ) = (
40474047 a. downcast_ref_if_exact :: < PyTuple > ( vm) ,
40484048 b. downcast_ref_if_exact :: < PyInt > ( vm) ,
4049- ) && let Some ( i) = Self :: specialization_nonnegative_compact_index ( idx, vm)
4049+ ) && let Some ( i) = specialization_nonnegative_compact_index ( idx, vm)
40504050 {
40514051 let elements = tuple. as_slice ( ) ;
40524052 if i < elements. len ( ) {
@@ -4088,7 +4088,7 @@ impl ExecutingFrame<'_> {
40884088 if let ( Some ( a_str) , Some ( b_int) ) = (
40894089 a. downcast_ref_if_exact :: < PyStr > ( vm) ,
40904090 b. downcast_ref_if_exact :: < PyInt > ( vm) ,
4091- ) && let Some ( i) = Self :: specialization_nonnegative_compact_index ( b_int, vm)
4091+ ) && let Some ( i) = specialization_nonnegative_compact_index ( b_int, vm)
40924092 && let Ok ( ch) = a_str. getitem_by_index ( vm, i as isize )
40934093 && ch. is_ascii ( )
40944094 {
@@ -5143,8 +5143,8 @@ impl ExecutingFrame<'_> {
51435143 a. downcast_ref_if_exact :: < PyInt > ( vm) ,
51445144 b. downcast_ref_if_exact :: < PyInt > ( vm) ,
51455145 ) && let ( Some ( a_val) , Some ( b_val) ) = (
5146- Self :: specialization_compact_int_value ( a_int, vm) ,
5147- Self :: specialization_compact_int_value ( b_int, vm) ,
5146+ specialization_compact_int_value ( a_int, vm) ,
5147+ specialization_compact_int_value ( b_int, vm) ,
51485148 ) {
51495149 let op = self . compare_op_from_arg ( arg) ;
51505150 let result = op. eval_ord ( a_val. cmp ( & b_val) ) ;
@@ -7724,9 +7724,9 @@ impl ExecutingFrame<'_> {
77247724 }
77257725 }
77267726 bytecode:: BinaryOperator :: Subscr => {
7727- let b_is_nonnegative_int = b. downcast_ref_if_exact :: < PyInt > ( vm ) . is_some_and ( |i| {
7728- Self :: specialization_nonnegative_compact_index ( i , vm ) . is_some ( )
7729- } ) ;
7727+ let b_is_nonnegative_int = b
7728+ . downcast_ref_if_exact :: < PyInt > ( vm )
7729+ . is_some_and ( |i| specialization_nonnegative_compact_index ( i , vm ) . is_some ( ) ) ;
77307730 if a. downcast_ref_if_exact :: < PyList > ( vm) . is_some ( ) && b_is_nonnegative_int {
77317731 Some ( Instruction :: BinaryOpSubscrListInt )
77327732 } else if a. downcast_ref_if_exact :: < PyTuple > ( vm) . is_some ( ) && b_is_nonnegative_int {
@@ -8531,8 +8531,8 @@ impl ExecutingFrame<'_> {
85318531 a. downcast_ref_if_exact :: < PyInt > ( vm) ,
85328532 b. downcast_ref_if_exact :: < PyInt > ( vm) ,
85338533 ) {
8534- if Self :: specialization_compact_int_value ( a_int, vm) . is_some ( )
8535- && Self :: specialization_compact_int_value ( b_int, vm) . is_some ( )
8534+ if specialization_compact_int_value ( a_int, vm) . is_some ( )
8535+ && specialization_compact_int_value ( b_int, vm) . is_some ( )
85368536 {
85378537 Some ( Instruction :: CompareOpInt )
85388538 } else {
@@ -8687,16 +8687,6 @@ impl ExecutingFrame<'_> {
86878687 }
86888688 }
86898689
8690- #[ inline]
8691- fn specialization_compact_int_value ( i : & PyInt , vm : & VirtualMachine ) -> Option < isize > {
8692- cpython_compact_int_value ( i, vm)
8693- }
8694-
8695- #[ inline]
8696- fn specialization_nonnegative_compact_index ( i : & PyInt , vm : & VirtualMachine ) -> Option < usize > {
8697- cpython_nonnegative_compact_index ( i, vm)
8698- }
8699-
87008690 #[ inline]
87018691 fn specialization_call_recursion_guard ( & self , vm : & VirtualMachine ) -> bool {
87028692 self . specialization_call_recursion_guard_with_extra_frames ( vm, 0 )
@@ -8840,9 +8830,7 @@ impl ExecutingFrame<'_> {
88408830 idx. downcast_ref_if_exact :: < PyInt > ( vm) ,
88418831 ) {
88428832 let list_len = list. borrow_vec ( ) . len ( ) ;
8843- if Self :: specialization_nonnegative_compact_index ( int_idx, vm)
8844- . is_some_and ( |i| i < list_len)
8845- {
8833+ if specialization_nonnegative_compact_index ( int_idx, vm) . is_some_and ( |i| i < list_len) {
88468834 Some ( Instruction :: StoreSubscrListInt )
88478835 } else {
88488836 None
0 commit comments