File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,17 @@ def get_first_executor(func):
4040 pass
4141 return None
4242
43+ def get_all_executors (func ):
44+ code = func .__code__
45+ co_code = code .co_code
46+ execs = []
47+ for i in range (0 , len (co_code ), 2 ):
48+ try :
49+ execs .append (_opcode .get_executor (code , i ))
50+ except ValueError :
51+ pass
52+ return execs
53+
4354
4455def iter_opnames (ex ):
4556 for item in ex :
@@ -2629,6 +2640,18 @@ def gen():
26292640 next(g)
26302641 """ % _testinternalcapi .SPECIALIZATION_THRESHOLD ))
26312642
2643+ def test_executor_side_exits_create_another_executor (self ):
2644+ def f ():
2645+ for x in range (TIER2_THRESHOLD + 3 ):
2646+ for y in range (TIER2_THRESHOLD + 3 ):
2647+ z = x + y
2648+
2649+ f ()
2650+ # Inner loop warms up first.
2651+ # Outer loop warms up later, linking to the innter one.
2652+ # Therefore, at least two executors.
2653+ self .assertGreaterEqual (len (get_all_executors (f )), 2 )
2654+
26322655
26332656def global_identity (x ):
26342657 return x
You can’t perform that action at this time.
0 commit comments