FIR CFG: remove ordering from control flow through in-place lambdas

Old graph:

  arg -> lambda enter -> ... -> lambda exit -> lambda enter -> ... ->
   -> lambda exit -> call

New graph:

  arg -+-> lambda enter -> ... -> lambda exit -+-> call
       \-> lambda enter -> ... -> lambda exit -/
This commit is contained in:
pyos
2022-11-23 10:10:16 +01:00
committed by teamcity
parent 5dce772f0b
commit c4c05f5248
41 changed files with 515 additions and 555 deletions
@@ -88,8 +88,8 @@ digraph complexPostponedCfg_kt {
6 -> {7};
7 -> {8};
8 -> {9};
9 -> {18};
9 -> {10} [color=red];
9 -> {18 11};
9 -> {10} [style=dotted];
9 -> {18} [style=dashed];
10 -> {11};
11 -> {12};
@@ -101,14 +101,14 @@ digraph complexPostponedCfg_kt {
16 -> {17} [style=dotted];
18 -> {19};
19 -> {20};
20 -> {25};
20 -> {21} [color=red];
20 -> {22 25};
20 -> {21} [style=dotted];
20 -> {25} [style=dashed];
21 -> {22};
21 -> {11} [color=red];
21 -> {22} [color=green];
22 -> {23};
23 -> {24};
24 -> {11} [color=red];
24 -> {10} [color=green];
24 -> {10};
25 -> {26};
26 -> {27};
27 -> {28};
@@ -116,14 +116,13 @@ digraph complexPostponedCfg_kt {
29 -> {30};
30 -> {31};
31 -> {32};
32 -> {37};
32 -> {33} [color=red];
32 -> {37 34};
32 -> {33} [style=dotted];
32 -> {37} [style=dashed];
33 -> {34};
34 -> {35};
35 -> {36};
36 -> {11} [color=red];
36 -> {21} [color=green];
36 -> {21};
37 -> {38};
38 -> {39};
39 -> {40};
@@ -132,7 +131,6 @@ digraph complexPostponedCfg_kt {
42 -> {43};
43 -> {44};
44 -> {45};
45 -> {34} [color=red];
45 -> {33} [color=green];
45 -> {33};
}
@@ -34,8 +34,8 @@ digraph callsInPlace_kt {
0 -> {1};
1 -> {2};
2 -> {3};
3 -> {10};
3 -> {4} [color=red];
3 -> {10 5};
3 -> {4} [style=dotted];
3 -> {10} [style=dashed];
4 -> {5};
5 -> {6};
@@ -47,8 +47,7 @@ digraph callsInPlace_kt {
12 -> {13};
13 -> {14};
14 -> {15};
15 -> {5} [color=red];
15 -> {4} [color=green];
15 -> {4};
subgraph cluster_4 {
color=red
@@ -78,7 +77,7 @@ digraph callsInPlace_kt {
16 -> {17};
17 -> {18};
18 -> {19};
19 -> {20 24};
19 -> {20 24 21};
19 -> {24} [style=dashed];
20 -> {21};
20 -> {19} [color=green style=dashed];
@@ -108,8 +107,8 @@ digraph callsInPlace_kt {
}
41 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
32 [label="Postponed exit from lambda"];
33 [label="Const: Int(10)"];
32 [label="Postponed exit from lambda"];
34 [label="Function call: R|kotlin/repeat|(...)" style="filled" fillcolor=yellow];
35 [label="Exit block"];
}
@@ -117,9 +116,9 @@ digraph callsInPlace_kt {
}
29 -> {30};
30 -> {31};
31 -> {32 37};
31 -> {32 33 37};
31 -> {37} [style=dashed];
32 -> {33};
32 -> {34};
32 -> {31} [color=green style=dashed];
33 -> {34};
34 -> {35};
@@ -162,8 +161,8 @@ digraph callsInPlace_kt {
42 -> {43};
43 -> {44};
44 -> {45};
45 -> {50};
45 -> {46} [color=red];
45 -> {50 47};
45 -> {46} [style=dotted];
45 -> {50} [style=dashed];
46 -> {47};
47 -> {48};
@@ -176,8 +175,7 @@ digraph callsInPlace_kt {
55 -> {56};
56 -> {57};
57 -> {58};
58 -> {47} [color=red];
58 -> {46} [color=green];
58 -> {46};
subgraph cluster_16 {
color=red
@@ -211,8 +209,8 @@ digraph callsInPlace_kt {
59 -> {60};
60 -> {61};
61 -> {62};
62 -> {67};
62 -> {63} [color=red];
62 -> {67 64};
62 -> {63} [style=dotted];
62 -> {67} [style=dashed];
63 -> {64};
64 -> {65};
@@ -225,8 +223,7 @@ digraph callsInPlace_kt {
72 -> {73};
73 -> {74};
74 -> {75};
75 -> {64} [color=red];
75 -> {63} [color=green];
75 -> {63};
subgraph cluster_20 {
color=red
@@ -264,7 +261,6 @@ digraph callsInPlace_kt {
}
100 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
85 [label="Postponed exit from lambda"];
86 [label="Postponed enter to lambda"];
subgraph cluster_26 {
color=blue
@@ -278,6 +274,7 @@ digraph callsInPlace_kt {
95 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
87 [label="Postponed exit from lambda"];
85 [label="Postponed exit from lambda"];
88 [label="Function call: R|/myRun|(...)" style="filled" fillcolor=yellow];
89 [label="Exit block"];
}
@@ -285,11 +282,11 @@ digraph callsInPlace_kt {
}
82 -> {83};
83 -> {84};
84 -> {85 96};
84 -> {85 86 96};
84 -> {96} [style=dashed];
85 -> {86};
85 -> {88};
85 -> {84} [color=green style=dashed];
86 -> {87 91};
86 -> {87 91 88};
86 -> {91} [style=dashed];
87 -> {88};
87 -> {86} [color=green style=dashed];
@@ -324,7 +321,6 @@ digraph callsInPlace_kt {
}
114 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
104 [label="Postponed exit from lambda"];
105 [label="Postponed enter to lambda"];
subgraph cluster_32 {
color=blue
@@ -338,6 +334,7 @@ digraph callsInPlace_kt {
119 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
106 [label="Postponed exit from lambda"];
104 [label="Postponed exit from lambda"];
107 [label="Function call: R|/myRun|(...)" style="filled" fillcolor=yellow];
108 [label="Exit block"];
}
@@ -345,11 +342,11 @@ digraph callsInPlace_kt {
}
101 -> {102};
102 -> {103};
103 -> {104 110};
103 -> {104 105 110};
103 -> {110} [style=dashed];
104 -> {105};
104 -> {107};
104 -> {103} [color=green style=dashed];
105 -> {106 115};
105 -> {106 115 107};
105 -> {115} [style=dashed];
106 -> {107};
106 -> {105} [color=green style=dashed];
@@ -408,7 +405,7 @@ digraph callsInPlace_kt {
}
125 -> {126};
126 -> {127};
127 -> {128 132};
127 -> {128 132 129};
127 -> {132} [style=dashed];
128 -> {129};
129 -> {130};
@@ -66,8 +66,8 @@ digraph atLeastOnce_kt {
10 -> {11};
11 -> {12};
12 -> {13};
13 -> {20};
13 -> {14} [color=red];
13 -> {20 15};
13 -> {14} [style=dotted];
13 -> {20} [style=dashed];
14 -> {15};
14 -> {13} [color=green style=dashed];
@@ -80,8 +80,7 @@ digraph atLeastOnce_kt {
22 -> {23};
23 -> {24};
24 -> {25};
25 -> {15} [color=red];
25 -> {14} [color=green];
25 -> {14};
subgraph cluster_8 {
color=red
@@ -114,8 +113,8 @@ digraph atLeastOnce_kt {
26 -> {27};
27 -> {28};
28 -> {29};
29 -> {36};
29 -> {30} [color=red];
29 -> {36 31};
29 -> {30} [style=dotted];
29 -> {36} [style=dashed];
30 -> {31};
30 -> {29} [color=green style=dashed];
@@ -128,7 +127,6 @@ digraph atLeastOnce_kt {
38 -> {39};
39 -> {40};
40 -> {41};
41 -> {31} [color=red];
41 -> {30} [color=green];
41 -> {30};
}
@@ -66,7 +66,7 @@ digraph atMostOnce_kt {
10 -> {11};
11 -> {12};
12 -> {13};
13 -> {14 20};
13 -> {14 20 15};
13 -> {20} [style=dashed];
14 -> {15};
15 -> {16};
@@ -111,7 +111,7 @@ digraph atMostOnce_kt {
26 -> {27};
27 -> {28};
28 -> {29};
29 -> {30 36};
29 -> {30 36 31};
29 -> {36} [style=dashed];
30 -> {31};
31 -> {32};
@@ -66,8 +66,8 @@ digraph exactlyOnce_kt {
10 -> {11};
11 -> {12};
12 -> {13};
13 -> {20};
13 -> {14} [color=red];
13 -> {20 15};
13 -> {14} [style=dotted];
13 -> {20} [style=dashed];
14 -> {15};
15 -> {16};
@@ -79,8 +79,7 @@ digraph exactlyOnce_kt {
22 -> {23};
23 -> {24};
24 -> {25};
25 -> {15} [color=red];
25 -> {14} [color=green];
25 -> {14};
subgraph cluster_8 {
color=red
@@ -113,8 +112,8 @@ digraph exactlyOnce_kt {
26 -> {27};
27 -> {28};
28 -> {29};
29 -> {36};
29 -> {30} [color=red];
29 -> {36 31};
29 -> {30} [style=dotted];
29 -> {36} [style=dashed];
30 -> {31};
31 -> {32};
@@ -126,7 +125,6 @@ digraph exactlyOnce_kt {
38 -> {39};
39 -> {40};
40 -> {41};
41 -> {31} [color=red];
41 -> {30} [color=green];
41 -> {30};
}
@@ -76,7 +76,7 @@ digraph inPlaceLambda_kt {
15 -> {16};
16 -> {17};
17 -> {18};
18 -> {19 23};
18 -> {19 23 20};
18 -> {23} [style=dashed];
19 -> {20};
20 -> {21};
@@ -66,7 +66,7 @@ digraph unknown_kt {
10 -> {11};
11 -> {12};
12 -> {13};
13 -> {14 20};
13 -> {14 20 15};
13 -> {20} [style=dashed];
14 -> {15};
14 -> {13} [color=green style=dashed];
@@ -112,7 +112,7 @@ digraph unknown_kt {
26 -> {27};
27 -> {28};
28 -> {29};
29 -> {30 36};
29 -> {30 36 31};
29 -> {36} [style=dashed];
30 -> {31};
30 -> {29} [color=green style=dashed];
@@ -229,9 +229,10 @@ digraph delegateWithAnonymousObject_kt {
78 [label="Exit property" style="filled" fillcolor=red];
}
71 -> {72};
72 -> {73};
72 -> {73 74};
72 -> {26} [style=dashed];
73 -> {74};
73 -> {77} [color=red];
73 -> {74} [color=green];
74 -> {75};
75 -> {76};
76 -> {77};
@@ -40,7 +40,7 @@ digraph plusAssignWithLambdaInRhs_kt {
4 -> {5} [style=dotted];
5 -> {6} [style=dotted];
6 -> {7} [style=dotted];
7 -> {8 12} [style=dotted];
7 -> {8 12 9} [style=dotted];
7 -> {12} [style=dashed];
8 -> {9} [style=dotted];
8 -> {7} [color=green style=dotted];
@@ -135,7 +135,7 @@ digraph plusAssignWithLambdaInRhs_kt {
27 -> {28};
28 -> {29};
29 -> {30};
30 -> {31 37};
30 -> {31 37 32};
30 -> {37} [style=dashed];
31 -> {32};
32 -> {33};
@@ -146,7 +146,7 @@ digraph plusAssignWithLambdaInRhs_kt {
37 -> {38};
38 -> {39};
39 -> {40};
40 -> {41 45};
40 -> {41 45 42};
40 -> {45} [style=dashed];
41 -> {42};
41 -> {40} [color=green style=dashed];
@@ -105,7 +105,7 @@ finally {
14 -> {15};
15 -> {16};
16 -> {17};
17 -> {18 31};
17 -> {18 31 19};
17 -> {31} [style=dashed];
18 -> {19};
18 -> {17} [color=green style=dashed];
@@ -195,7 +195,7 @@ finally {
39 -> {40};
40 -> {41};
41 -> {42};
42 -> {43 56};
42 -> {43 56 44};
42 -> {56} [style=dashed];
43 -> {44};
44 -> {45};