@@ -472,9 +472,11 @@ def testfunc(loops):
472472 self .assertIsNotNone (ex )
473473 self .assertEqual (res , (TIER2_THRESHOLD - 1 ) * 2 + 1 )
474474 binop_count = [opname for opname in iter_opnames (ex ) if opname == "_BINARY_OP_ADD_INT" ]
475- guard_both_int_count = [opname for opname in iter_opnames (ex ) if opname == "_GUARD_BOTH_INT" ]
475+ guard_tos_int_count = [opname for opname in iter_opnames (ex ) if opname == "_GUARD_TOS_INT" ]
476+ guard_nos_int_count = [opname for opname in iter_opnames (ex ) if opname == "_GUARD_NOS_INT" ]
476477 self .assertGreaterEqual (len (binop_count ), 3 )
477- self .assertLessEqual (len (guard_both_int_count ), 1 )
478+ self .assertLessEqual (len (guard_tos_int_count ), 1 )
479+ self .assertLessEqual (len (guard_nos_int_count ), 1 )
478480
479481 def test_int_type_propagation_through_frame (self ):
480482 def double (x ):
@@ -493,9 +495,11 @@ def testfunc(loops):
493495 self .assertIsNotNone (ex )
494496 self .assertEqual (res , (TIER2_THRESHOLD - 1 ) * 4 )
495497 binop_count = [opname for opname in iter_opnames (ex ) if opname == "_BINARY_OP_ADD_INT" ]
496- guard_both_int_count = [opname for opname in iter_opnames (ex ) if opname == "_GUARD_BOTH_INT" ]
498+ guard_tos_int_count = [opname for opname in iter_opnames (ex ) if opname == "_GUARD_TOS_INT" ]
499+ guard_nos_int_count = [opname for opname in iter_opnames (ex ) if opname == "_GUARD_NOS_INT" ]
497500 self .assertGreaterEqual (len (binop_count ), 3 )
498- self .assertLessEqual (len (guard_both_int_count ), 1 )
501+ self .assertLessEqual (len (guard_tos_int_count ), 1 )
502+ self .assertLessEqual (len (guard_nos_int_count ), 1 )
499503
500504 def test_int_type_propagation_from_frame (self ):
501505 def double (x ):
@@ -514,9 +518,11 @@ def testfunc(loops):
514518 self .assertIsNotNone (ex )
515519 self .assertEqual (res , (TIER2_THRESHOLD - 1 ) * 4 )
516520 binop_count = [opname for opname in iter_opnames (ex ) if opname == "_BINARY_OP_ADD_INT" ]
517- guard_both_int_count = [opname for opname in iter_opnames (ex ) if opname == "_GUARD_BOTH_INT" ]
521+ guard_tos_int_count = [opname for opname in iter_opnames (ex ) if opname == "_GUARD_TOS_INT" ]
522+ guard_nos_int_count = [opname for opname in iter_opnames (ex ) if opname == "_GUARD_NOS_INT" ]
518523 self .assertGreaterEqual (len (binop_count ), 3 )
519- self .assertLessEqual (len (guard_both_int_count ), 1 )
524+ self .assertLessEqual (len (guard_tos_int_count ), 1 )
525+ self .assertLessEqual (len (guard_nos_int_count ), 1 )
520526
521527 def test_int_impure_region (self ):
522528 def testfunc (loops ):
@@ -559,7 +565,8 @@ def testfunc(n):
559565 self .assertEqual (res , (TIER2_THRESHOLD - 1 ) * 2 )
560566 self .assertIsNotNone (ex )
561567 uops = get_opnames (ex )
562- self .assertNotIn ("_GUARD_BOTH_INT" , uops )
568+ self .assertNotIn ("_GUARD_TOS_INT" , uops )
569+ self .assertNotIn ("_GUARD_NOS_INT" , uops )
563570
564571 def test_int_value_numbering (self ):
565572 def testfunc (n ):
@@ -577,9 +584,10 @@ def testfunc(n):
577584 self .assertEqual (res , 4 )
578585 self .assertIsNotNone (ex )
579586 uops = get_opnames (ex )
580- self .assertIn ("_GUARD_BOTH_INT" , uops )
581- guard_count = [opname for opname in iter_opnames (ex ) if opname == "_GUARD_BOTH_INT" ]
582- self .assertEqual (len (guard_count ), 1 )
587+ self .assertIn ("_GUARD_TOS_INT" , uops )
588+ self .assertNotIn ("_GUARD_NOS_INT" , uops )
589+ guard_tos_count = [opname for opname in iter_opnames (ex ) if opname == "_GUARD_TOS_INT" ]
590+ self .assertEqual (len (guard_tos_count ), 1 )
583591
584592 def test_comprehension (self ):
585593 def testfunc (n ):
@@ -664,8 +672,10 @@ def testfunc(n):
664672 self .assertAlmostEqual (res , TIER2_THRESHOLD + 1 )
665673 self .assertIsNotNone (ex )
666674 uops = get_opnames (ex )
667- guard_both_float_count = [opname for opname in iter_opnames (ex ) if opname == "_GUARD_BOTH_FLOAT" ]
668- self .assertLessEqual (len (guard_both_float_count ), 1 )
675+ guard_tos_float_count = [opname for opname in iter_opnames (ex ) if opname == "_GUARD_TOS_FLOAT" ]
676+ guard_nos_float_count = [opname for opname in iter_opnames (ex ) if opname == "_GUARD_NOS_FLOAT" ]
677+ self .assertLessEqual (len (guard_tos_float_count ), 1 )
678+ self .assertLessEqual (len (guard_nos_float_count ), 1 )
669679 # TODO gh-115506: this assertion may change after propagating constants.
670680 # We'll also need to verify that propagation actually occurs.
671681 self .assertIn ("_BINARY_OP_ADD_FLOAT" , uops )
@@ -684,8 +694,10 @@ def testfunc(n):
684694 self .assertAlmostEqual (res , - TIER2_THRESHOLD + 1 )
685695 self .assertIsNotNone (ex )
686696 uops = get_opnames (ex )
687- guard_both_float_count = [opname for opname in iter_opnames (ex ) if opname == "_GUARD_BOTH_FLOAT" ]
688- self .assertLessEqual (len (guard_both_float_count ), 1 )
697+ guard_tos_float_count = [opname for opname in iter_opnames (ex ) if opname == "_GUARD_TOS_FLOAT" ]
698+ guard_nos_float_count = [opname for opname in iter_opnames (ex ) if opname == "_GUARD_NOS_FLOAT" ]
699+ self .assertLessEqual (len (guard_tos_float_count ), 1 )
700+ self .assertLessEqual (len (guard_nos_float_count ), 1 )
689701 # TODO gh-115506: this assertion may change after propagating constants.
690702 # We'll also need to verify that propagation actually occurs.
691703 self .assertIn ("_BINARY_OP_SUBTRACT_FLOAT" , uops )
@@ -704,8 +716,10 @@ def testfunc(n):
704716 self .assertAlmostEqual (res , 1.0 )
705717 self .assertIsNotNone (ex )
706718 uops = get_opnames (ex )
707- guard_both_float_count = [opname for opname in iter_opnames (ex ) if opname == "_GUARD_BOTH_FLOAT" ]
708- self .assertLessEqual (len (guard_both_float_count ), 1 )
719+ guard_tos_float_count = [opname for opname in iter_opnames (ex ) if opname == "_GUARD_TOS_FLOAT" ]
720+ guard_nos_float_count = [opname for opname in iter_opnames (ex ) if opname == "_GUARD_NOS_FLOAT" ]
721+ self .assertLessEqual (len (guard_tos_float_count ), 1 )
722+ self .assertLessEqual (len (guard_nos_float_count ), 1 )
709723 # TODO gh-115506: this assertion may change after propagating constants.
710724 # We'll also need to verify that propagation actually occurs.
711725 self .assertIn ("_BINARY_OP_MULTIPLY_FLOAT" , uops )
@@ -724,8 +738,10 @@ def testfunc(n):
724738 self .assertEqual (res , "" )
725739 self .assertIsNotNone (ex )
726740 uops = get_opnames (ex )
727- guard_both_unicode_count = [opname for opname in iter_opnames (ex ) if opname == "_GUARD_BOTH_UNICODE" ]
728- self .assertLessEqual (len (guard_both_unicode_count ), 1 )
741+ guard_tos_unicode_count = [opname for opname in iter_opnames (ex ) if opname == "_GUARD_TOS_UNICODE" ]
742+ guard_nos_unicode_count = [opname for opname in iter_opnames (ex ) if opname == "_GUARD_NOS_UNICODE" ]
743+ self .assertLessEqual (len (guard_tos_unicode_count ), 1 )
744+ self .assertLessEqual (len (guard_nos_unicode_count ), 1 )
729745 self .assertIn ("_BINARY_OP_ADD_UNICODE" , uops )
730746
731747 def test_compare_op_type_propagation_float (self ):
@@ -742,8 +758,10 @@ def testfunc(n):
742758 self .assertTrue (res )
743759 self .assertIsNotNone (ex )
744760 uops = get_opnames (ex )
745- guard_both_float_count = [opname for opname in iter_opnames (ex ) if opname == "_GUARD_BOTH_FLOAT" ]
746- self .assertLessEqual (len (guard_both_float_count ), 1 )
761+ guard_tos_float_count = [opname for opname in iter_opnames (ex ) if opname == "_GUARD_TOS_FLOAT" ]
762+ guard_nos_float_count = [opname for opname in iter_opnames (ex ) if opname == "_GUARD_NOS_FLOAT" ]
763+ self .assertLessEqual (len (guard_tos_float_count ), 1 )
764+ self .assertLessEqual (len (guard_nos_float_count ), 1 )
747765 self .assertIn ("_COMPARE_OP_FLOAT" , uops )
748766
749767 def test_compare_op_type_propagation_int (self ):
@@ -760,8 +778,10 @@ def testfunc(n):
760778 self .assertTrue (res )
761779 self .assertIsNotNone (ex )
762780 uops = get_opnames (ex )
763- guard_both_int_count = [opname for opname in iter_opnames (ex ) if opname == "_GUARD_BOTH_INT" ]
764- self .assertLessEqual (len (guard_both_int_count ), 1 )
781+ guard_tos_int_count = [opname for opname in iter_opnames (ex ) if opname == "_GUARD_TOS_INT" ]
782+ guard_nos_int_count = [opname for opname in iter_opnames (ex ) if opname == "_GUARD_NOS_INT" ]
783+ self .assertLessEqual (len (guard_tos_int_count ), 1 )
784+ self .assertLessEqual (len (guard_nos_int_count ), 1 )
765785 self .assertIn ("_COMPARE_OP_INT" , uops )
766786
767787 def test_compare_op_type_propagation_int_partial (self ):
@@ -778,10 +798,10 @@ def testfunc(n):
778798 self .assertEqual (res , 1 )
779799 self .assertIsNotNone (ex )
780800 uops = get_opnames (ex )
781- guard_left_int_count = [opname for opname in iter_opnames (ex ) if opname == "_GUARD_NOS_INT" ]
782- guard_both_int_count = [opname for opname in iter_opnames (ex ) if opname == "_GUARD_BOTH_INT " ]
783- self .assertLessEqual (len (guard_left_int_count ), 1 )
784- self .assertEqual (len (guard_both_int_count ), 0 )
801+ guard_nos_int_count = [opname for opname in iter_opnames (ex ) if opname == "_GUARD_NOS_INT" ]
802+ guard_tos_int_count = [opname for opname in iter_opnames (ex ) if opname == "_GUARD_TOS_INT " ]
803+ self .assertLessEqual (len (guard_nos_int_count ), 1 )
804+ self .assertEqual (len (guard_tos_int_count ), 0 )
785805 self .assertIn ("_COMPARE_OP_INT" , uops )
786806
787807 def test_compare_op_type_propagation_float_partial (self ):
@@ -798,10 +818,10 @@ def testfunc(n):
798818 self .assertEqual (res , 1 )
799819 self .assertIsNotNone (ex )
800820 uops = get_opnames (ex )
801- guard_left_float_count = [opname for opname in iter_opnames (ex ) if opname == "_GUARD_NOS_FLOAT" ]
802- guard_both_float_count = [opname for opname in iter_opnames (ex ) if opname == "_GUARD_BOTH_FLOAT " ]
803- self .assertLessEqual (len (guard_left_float_count ), 1 )
804- self .assertEqual (len (guard_both_float_count ), 0 )
821+ guard_nos_float_count = [opname for opname in iter_opnames (ex ) if opname == "_GUARD_NOS_FLOAT" ]
822+ guard_tos_float_count = [opname for opname in iter_opnames (ex ) if opname == "_GUARD_TOS_FLOAT " ]
823+ self .assertLessEqual (len (guard_nos_float_count ), 1 )
824+ self .assertEqual (len (guard_tos_float_count ), 0 )
805825 self .assertIn ("_COMPARE_OP_FLOAT" , uops )
806826
807827 def test_compare_op_type_propagation_unicode (self ):
@@ -818,8 +838,10 @@ def testfunc(n):
818838 self .assertTrue (res )
819839 self .assertIsNotNone (ex )
820840 uops = get_opnames (ex )
821- guard_both_float_count = [opname for opname in iter_opnames (ex ) if opname == "_GUARD_BOTH_UNICODE" ]
822- self .assertLessEqual (len (guard_both_float_count ), 1 )
841+ guard_tos_unicode_count = [opname for opname in iter_opnames (ex ) if opname == "_GUARD_TOS_UNICODE" ]
842+ guard_nos_unicode_count = [opname for opname in iter_opnames (ex ) if opname == "_GUARD_NOS_UNICODE" ]
843+ self .assertLessEqual (len (guard_tos_unicode_count ), 1 )
844+ self .assertLessEqual (len (guard_nos_unicode_count ), 1 )
823845 self .assertIn ("_COMPARE_OP_STR" , uops )
824846
825847 def test_type_inconsistency (self ):
@@ -838,7 +860,8 @@ def testfunc(n):
838860 _ , ex = self ._run_with_optimizer (testfunc , TIER2_THRESHOLD - 1 )
839861 self .assertIsNotNone (ex )
840862 uops = get_opnames (ex )
841- self .assertNotIn ("_GUARD_BOTH_INT" , uops )
863+ self .assertNotIn ("_GUARD_TOS_INT" , uops )
864+ self .assertNotIn ("_GUARD_NOS_INT" , uops )
842865 self .assertIn ("_BINARY_OP_ADD_INT" , uops )
843866 # Try again, but between the runs, set the global to a float.
844867 # This should result in no executor the second time.
@@ -1414,7 +1437,6 @@ def testfunc(n):
14141437 self .assertIsNotNone (ex )
14151438 uops = get_opnames (ex )
14161439 self .assertIn ("_BINARY_OP_ADD_INT" , uops )
1417- self .assertNotIn ("_GUARD_BOTH_INT" , uops )
14181440 self .assertNotIn ("_GUARD_NOS_INT" , uops )
14191441 self .assertNotIn ("_GUARD_TOS_INT" , uops )
14201442
0 commit comments