@@ -2036,8 +2036,9 @@ impl CodeInfo {
20362036 let idx = i as usize ;
20372037 let swap_arg = match instructions[ idx] . instr . real ( ) {
20382038 Some ( Instruction :: Swap { .. } ) => u32:: from ( instructions[ idx] . arg ) ,
2039- Some ( Instruction :: Nop )
2040- | Some ( Instruction :: PopTop | Instruction :: StoreFast { .. } ) => {
2039+ Some (
2040+ Instruction :: Nop | Instruction :: PopTop | Instruction :: StoreFast { .. } ,
2041+ ) => {
20412042 i -= 1 ;
20422043 continue ;
20432044 }
@@ -2332,8 +2333,10 @@ impl CodeInfo {
23322333 match ( curr_instr, next_instr) {
23332334 // Note: StoreFast + LoadFast → StoreFastLoadFast is done in a
23342335 // later pass aligned with CPython insert_superinstructions().
2335- ( Instruction :: LoadConst { .. } , Instruction :: ToBool )
2336- | ( Instruction :: LoadSmallInt { .. } , Instruction :: ToBool ) => {
2336+ (
2337+ Instruction :: LoadConst { .. } | Instruction :: LoadSmallInt { .. } ,
2338+ Instruction :: ToBool ,
2339+ ) => {
23372340 if let Some ( value) =
23382341 const_truthiness ( curr_instr, curr. arg , & self . metadata )
23392342 {
@@ -2355,10 +2358,10 @@ impl CodeInfo {
23552358 curr_instr,
23562359 OpArg :: new ( u32:: from ( curr. arg ) | oparg:: COMPARE_OP_BOOL_MASK ) ,
23572360 ) ) ,
2358- ( Instruction :: ContainsOp { .. } , Instruction :: ToBool )
2359- | ( Instruction :: IsOp { .. } , Instruction :: ToBool ) => {
2360- Some ( ( curr_instr , curr . arg ) )
2361- }
2361+ (
2362+ Instruction :: ContainsOp { .. } | Instruction :: IsOp { .. } ,
2363+ Instruction :: ToBool ,
2364+ ) => Some ( ( curr_instr , curr . arg ) ) ,
23622365 ( Instruction :: LoadConst { consti } , Instruction :: UnaryNot ) => {
23632366 let constant = & self . metadata . consts [ consti. get ( curr. arg ) . as_usize ( ) ] ;
23642367 match constant {
@@ -2434,8 +2437,10 @@ impl CodeInfo {
24342437
24352438 let redundant = matches ! (
24362439 ( curr_instr, next_instr) ,
2437- ( Instruction :: LoadConst { .. } , Instruction :: PopTop )
2438- | ( Instruction :: LoadSmallInt { .. } , Instruction :: PopTop )
2440+ (
2441+ Instruction :: LoadConst { .. } | Instruction :: LoadSmallInt { .. } ,
2442+ Instruction :: PopTop
2443+ )
24392444 ) || matches ! ( curr_instr, Instruction :: Copy { i } if i. get( curr. arg) == 1 )
24402445 && matches ! ( next_instr, Instruction :: PopTop ) ;
24412446
@@ -3757,7 +3762,7 @@ impl CodeInfo {
37573762 Some ( Instruction :: PushExcInfo ) => {
37583763 in_exception_state = true ;
37593764 }
3760- Some ( Instruction :: PopExcept ) | Some ( Instruction :: Reraise { .. } ) => {
3765+ Some ( Instruction :: PopExcept | Instruction :: Reraise { .. } ) => {
37613766 in_exception_state = false ;
37623767 }
37633768 Some ( Instruction :: LoadFastBorrow { .. } ) if in_exception_state => {
@@ -4458,10 +4463,10 @@ impl CodeInfo {
44584463 Some (
44594464 Instruction :: StoreFast { .. }
44604465 | Instruction :: StoreFastLoadFast { .. }
4461- | Instruction :: StoreFastStoreFast { .. } ,
4462- )
4463- | Some ( Instruction :: DeleteFast { .. } )
4464- | Some ( Instruction :: LoadFastAndClear { .. } ) => return false ,
4466+ | Instruction :: StoreFastStoreFast { .. }
4467+ | Instruction :: DeleteFast { .. }
4468+ | Instruction :: LoadFastAndClear { .. } ,
4469+ ) => return false ,
44654470 _ => { }
44664471 }
44674472 }
@@ -4613,8 +4618,10 @@ impl CodeInfo {
46134618 {
46144619 if matches ! (
46154620 extra_info. instr. real( ) ,
4616- Some ( Instruction :: LoadFastBorrow { .. } )
4617- | Some ( Instruction :: LoadFastBorrowLoadFastBorrow { .. } )
4621+ Some (
4622+ Instruction :: LoadFastBorrow { .. }
4623+ | Instruction :: LoadFastBorrowLoadFastBorrow { .. }
4624+ )
46184625 ) {
46194626 to_deopt. push ( * extra_instr_idx) ;
46204627 }
@@ -4642,8 +4649,10 @@ impl CodeInfo {
46424649 {
46434650 if matches ! (
46444651 tail_info. instr. real( ) ,
4645- Some ( Instruction :: LoadFastBorrow { .. } )
4646- | Some ( Instruction :: LoadFastBorrowLoadFastBorrow { .. } )
4652+ Some (
4653+ Instruction :: LoadFastBorrow { .. }
4654+ | Instruction :: LoadFastBorrowLoadFastBorrow { .. }
4655+ )
46474656 ) {
46484657 cross_block_deopts. push ( ( tail_block_idx, tail_instr_idx) ) ;
46494658 }
@@ -4722,7 +4731,7 @@ impl CodeInfo {
47224731 && predecessor_blocks. iter ( ) . copied ( ) . all ( |pred_idx| {
47234732 matches ! (
47244733 last_real_instr( & self . blocks[ pred_idx] ) ,
4725- Some ( Instruction :: PopIter ) | Some ( Instruction :: Swap { .. } )
4734+ Some ( Instruction :: PopIter | Instruction :: Swap { .. } )
47264735 )
47274736 } )
47284737 } )
@@ -4743,7 +4752,7 @@ impl CodeInfo {
47434752 && ( new_instructions. iter ( ) . all ( |prev : & InstructionInfo | {
47444753 matches ! (
47454754 prev. instr. real( ) ,
4746- Some ( Instruction :: Swap { .. } ) | Some ( Instruction :: PopTop )
4755+ Some ( Instruction :: Swap { .. } | Instruction :: PopTop )
47474756 )
47484757 } ) || is_cleanup_restore_prefix ( & new_instructions) )
47494758 {
@@ -4906,8 +4915,9 @@ impl CodeInfo {
49064915 }
49074916 new_instructions. push ( info) ;
49084917 }
4909- Some ( Instruction :: LoadFast { var_num } )
4910- | Some ( Instruction :: LoadFastBorrow { var_num } ) => {
4918+ Some (
4919+ Instruction :: LoadFast { var_num } | Instruction :: LoadFastBorrow { var_num } ,
4920+ ) => {
49114921 let var_idx = usize:: from ( var_num. get ( info. arg ) ) ;
49124922 if var_idx < nlocals && unsafe_mask[ var_idx] {
49134923 info. instr = Opcode :: LoadFastCheck . into ( ) ;
@@ -4918,8 +4928,10 @@ impl CodeInfo {
49184928 }
49194929 new_instructions. push ( info) ;
49204930 }
4921- Some ( Instruction :: LoadFastLoadFast { var_nums } )
4922- | Some ( Instruction :: LoadFastBorrowLoadFastBorrow { var_nums } ) => {
4931+ Some (
4932+ Instruction :: LoadFastLoadFast { var_nums }
4933+ | Instruction :: LoadFastBorrowLoadFastBorrow { var_nums } ,
4934+ ) => {
49234935 let packed = var_nums. get ( info. arg ) ;
49244936 let ( idx1, idx2) = packed. indexes ( ) ;
49254937 let idx1 = usize:: from ( idx1) ;
@@ -6802,7 +6814,7 @@ fn deoptimize_borrow_after_push_exc_info_in_blocks(blocks: &mut [Block]) {
68026814 Some ( Instruction :: PushExcInfo ) => {
68036815 in_exception_state = true ;
68046816 }
6805- Some ( Instruction :: PopExcept ) | Some ( Instruction :: Reraise { .. } ) => {
6817+ Some ( Instruction :: PopExcept | Instruction :: Reraise { .. } ) => {
68066818 in_exception_state = false ;
68076819 }
68086820 Some ( Instruction :: LoadFastBorrow { .. } ) if in_exception_state => {
@@ -6896,7 +6908,7 @@ fn is_exit_without_lineno(block: &Block) -> bool {
68966908 && prefix. iter ( ) . all ( |info| {
68976909 matches ! (
68986910 info. instr. real( ) ,
6899- Some ( Instruction :: PopExcept ) | Some ( Instruction :: Nop )
6911+ Some ( Instruction :: PopExcept | Instruction :: Nop )
69006912 )
69016913 } )
69026914 && prefix
@@ -6924,7 +6936,7 @@ fn shared_jump_back_target(block: &Block) -> Option<BlockIdx> {
69246936 if !prefix. iter ( ) . all ( |info| {
69256937 matches ! (
69266938 info. instr. real( ) ,
6927- Some ( Instruction :: PopExcept ) | Some ( Instruction :: Nop )
6939+ Some ( Instruction :: PopExcept | Instruction :: Nop )
69286940 )
69296941 } ) {
69306942 return None ;
0 commit comments