@@ -3284,7 +3284,7 @@ dummy_func(
32843284
32853285 // Tier 2 instructions
32863286 // Type propagator assumes this doesn't affect type context
3287- inst (BB_BRANCH , (unused /1 -- )) {
3287+ inst (BB_BRANCH , (unused /2 -- )) {
32883288 _Py_CODEUNIT * t2_nextinstr = NULL ;
32893289 _PyBBBranchCache * cache = (_PyBBBranchCache * )next_instr ;
32903290 _Py_CODEUNIT * tier1_fallback = NULL ;
@@ -3314,14 +3314,14 @@ dummy_func(
33143314 DISPATCH ();
33153315 }
33163316 }
3317- // Their addresses should be the same. Because
3318- // The first BB should be generated right after the previous one.
3319- assert ( next_instr + INLINE_CACHE_ENTRIES_BB_BRANCH == t2_nextinstr ) ;
3317+ Py_ssize_t forward_jump = t2_nextinstr - next_instr ;
3318+ assert (( uint16_t ) forward_jump == forward_jump );
3319+ cache -> successor_jumpby = ( uint16_t ) forward_jump ;
33203320 next_instr = t2_nextinstr ;
33213321 DISPATCH ();
33223322 }
33233323
3324- inst (BB_BRANCH_IF_FLAG_UNSET , (unused /1 -- )) {
3324+ inst (BB_BRANCH_IF_FLAG_UNSET , (unused /2 -- )) {
33253325 if (!BB_TEST_IS_SUCCESSOR (bb_test )) {
33263326 _Py_CODEUNIT * curr = next_instr - 1 ;
33273327 _Py_CODEUNIT * t2_nextinstr = NULL ;
@@ -3341,17 +3341,22 @@ dummy_func(
33413341 _PyTier2_RewriteForwardJump (curr , next_instr );
33423342 DISPATCH ();
33433343 }
3344+ _PyBBBranchCache * cache = (_PyBBBranchCache * )next_instr ;
3345+ JUMPBY (cache -> successor_jumpby );
3346+ DISPATCH ();
33443347 }
33453348
3346- inst (BB_JUMP_IF_FLAG_UNSET , (unused /1 -- )) {
3349+ inst (BB_JUMP_IF_FLAG_UNSET , (unused /2 -- )) {
33473350 if (!BB_TEST_IS_SUCCESSOR (bb_test )) {
33483351 JUMPBY (oparg );
33493352 DISPATCH ();
33503353 }
3351- // Fall through to next instruction.
3354+ _PyBBBranchCache * cache = (_PyBBBranchCache * )next_instr ;
3355+ JUMPBY (cache -> successor_jumpby );
3356+ DISPATCH ();
33523357 }
33533358
3354- inst (BB_BRANCH_IF_FLAG_SET , (unused /1 -- )) {
3359+ inst (BB_BRANCH_IF_FLAG_SET , (unused /2 -- )) {
33553360 if (BB_TEST_IS_SUCCESSOR (bb_test )) {
33563361 _Py_CODEUNIT * curr = next_instr - 1 ;
33573362 _Py_CODEUNIT * t2_nextinstr = NULL ;
@@ -3371,14 +3376,19 @@ dummy_func(
33713376 _PyTier2_RewriteForwardJump (curr , next_instr );
33723377 DISPATCH ();
33733378 }
3379+ _PyBBBranchCache * cache = (_PyBBBranchCache * )next_instr ;
3380+ JUMPBY (cache -> successor_jumpby );
3381+ DISPATCH ();
33743382 }
33753383
3376- inst (BB_JUMP_IF_FLAG_SET , (unused /1 -- )) {
3384+ inst (BB_JUMP_IF_FLAG_SET , (unused /2 -- )) {
33773385 if (BB_TEST_IS_SUCCESSOR (bb_test )) {
33783386 JUMPBY (oparg );
33793387 DISPATCH ();
33803388 }
3381- // Fall through to next instruction.
3389+ _PyBBBranchCache * cache = (_PyBBBranchCache * )next_instr ;
3390+ JUMPBY (cache -> successor_jumpby );
3391+ DISPATCH ();
33823392 }
33833393
33843394 // Type propagator assumes this doesn't affect type context
0 commit comments