File tree Expand file tree Collapse file tree 4 files changed +27
-6
lines changed Expand file tree Collapse file tree 4 files changed +27
-6
lines changed Original file line number Diff line number Diff line change @@ -568,6 +568,30 @@ def testfunc(loops):
568
568
self .assertGreaterEqual (len (binop_count ), 3 )
569
569
self .assertLessEqual (len (guard_both_int_count ), 1 )
570
570
571
+ def test_int_type_propagation_through_frame (self ):
572
+ def double (x ):
573
+ return x + x
574
+ def testfunc (loops ):
575
+ num = 0
576
+ while num < loops :
577
+ x = num + num
578
+ a = double (x )
579
+ num += 1
580
+ return a
581
+
582
+ opt = _testinternalcapi .get_uop_optimizer ()
583
+ res = None
584
+ with temporary_optimizer (opt ):
585
+ res = testfunc (32 )
586
+
587
+ ex = get_first_executor (testfunc )
588
+ self .assertIsNotNone (ex )
589
+ self .assertEqual (res , 124 )
590
+ binop_count = [opname for opname , _ , _ in ex if opname == "_BINARY_OP_ADD_INT" ]
591
+ guard_both_int_count = [opname for opname , _ , _ in ex if opname == "_GUARD_BOTH_INT" ]
592
+ self .assertGreaterEqual (len (binop_count ), 3 )
593
+ self .assertLessEqual (len (guard_both_int_count ), 1 )
594
+
571
595
def test_int_impure_region (self ):
572
596
def testfunc (loops ):
573
597
num = 0
@@ -705,9 +729,5 @@ def testfunc(n):
705
729
706
730
707
731
708
- class Foo :
709
- attr = 1
710
-
711
-
712
732
if __name__ == "__main__" :
713
733
unittest .main ()
Original file line number Diff line number Diff line change @@ -551,7 +551,7 @@ emit_i(uops_emitter *emitter,
551
551
552
552
553
553
#ifndef Py_DEBUG
554
- #define GETITEM (ctx , i ) Py_UNREACHABLE();
554
+ #define GETITEM (ctx , i ) (_Py_UOpsSymType *) Py_UNREACHABLE();
555
555
#else
556
556
static inline _Py_UOpsSymType *
557
557
GETITEM (_Py_UOpsAbstractInterpContext * ctx , Py_ssize_t i ) {
Original file line number Diff line number Diff line change @@ -1252,7 +1252,7 @@ init_interp_main(PyThreadState *tstate)
1252
1252
if (_Py_get_xoption (& config -> xoptions , L"uops" ) != NULL ) {
1253
1253
enabled = 1 ;
1254
1254
}
1255
- enabled = 1 ; // TEMPORARY: always enable
1255
+
1256
1256
if (enabled ) {
1257
1257
#else
1258
1258
// Always enable tier two for JIT builds (ignoring the environment
Original file line number Diff line number Diff line change 3
3
import parser
4
4
from typing import Optional
5
5
6
+
6
7
@dataclass
7
8
class Properties :
8
9
escapes : bool
You can’t perform that action at this time.
0 commit comments