FIR DFA: fork flow everywhere

In theory, forking persistent flows should be cheap because of object
reuse, so the proposal here is to start from scratch and prove
redundancy of forks on a case-by-case basis. Something something better
safe than sorry.

^KT-28333 tag fixed-in-k2
^KT-28489 tag fixed-in-k2
This commit is contained in:
pyos
2022-11-08 21:33:40 +01:00
committed by teamcity
parent 757921e63e
commit edaca59d83
17 changed files with 554 additions and 683 deletions
@@ -80,27 +80,25 @@ digraph flowFromInplaceLambda3_kt {
27 [label="Postponed enter to lambda"];
subgraph cluster_10 {
color=blue
38 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
36 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_11 {
color=blue
39 [label="Enter block"];
40 [label="Const: Int(1)"];
41 [label="Assignment: R|<local>/x|"];
42 [label="Exit block"];
37 [label="Enter block"];
38 [label="Const: Int(1)"];
39 [label="Assignment: R|<local>/x|"];
40 [label="Exit block"];
}
43 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
41 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
28 [label="Postponed exit from lambda"];
29 [label="Function call: R|/unknown|(...)"];
30 [label="Access variable R|<local>/x|"];
31 [label="Smart cast: R|<local>/x|"];
32 [label="Access variable <Unresolved name: length>#"];
33 [label="Access variable R|<local>/x|"];
34 [label="Smart cast: R|<local>/x|"];
35 [label="Function call: R|<local>/x|.<Unresolved name: inc>#()"];
36 [label="Exit block"];
31 [label="Access variable <Unresolved name: length>#"];
32 [label="Access variable R|<local>/x|"];
33 [label="Function call: R|<local>/x|.<Unresolved name: inc>#()"];
34 [label="Exit block"];
}
37 [label="Exit function test1" style="filled" fillcolor=red];
35 [label="Exit function test1" style="filled" fillcolor=red];
}
19 -> {20};
20 -> {21};
@@ -110,8 +108,8 @@ digraph flowFromInplaceLambda3_kt {
24 -> {25};
25 -> {26};
26 -> {27};
27 -> {28 38};
27 -> {38} [style=dashed];
27 -> {28 36};
27 -> {36} [style=dashed];
28 -> {29};
29 -> {30};
30 -> {31};
@@ -119,199 +117,199 @@ digraph flowFromInplaceLambda3_kt {
32 -> {33};
33 -> {34};
34 -> {35};
35 -> {36};
36 -> {37};
38 -> {43 39};
36 -> {41 37};
37 -> {38};
38 -> {39};
39 -> {40};
40 -> {41};
41 -> {42};
42 -> {43};
43 -> {28};
43 -> {38} [color=green style=dashed];
41 -> {28};
41 -> {36} [color=green style=dashed];
subgraph cluster_12 {
color=red
44 [label="Enter function test2" style="filled" fillcolor=red];
42 [label="Enter function test2" style="filled" fillcolor=red];
subgraph cluster_13 {
color=blue
45 [label="Enter block"];
46 [label="Variable declaration: lvar x: R|kotlin/Any?|"];
47 [label="Const: String()"];
48 [label="Assignment: R|<local>/x|"];
49 [label="Access variable R|<local>/x|"];
50 [label="Smart cast: R|<local>/x|"];
51 [label="Access variable R|kotlin/String.length|"];
52 [label="Postponed enter to lambda"];
43 [label="Enter block"];
44 [label="Variable declaration: lvar x: R|kotlin/Any?|"];
45 [label="Const: String()"];
46 [label="Assignment: R|<local>/x|"];
47 [label="Access variable R|<local>/x|"];
48 [label="Smart cast: R|<local>/x|"];
49 [label="Access variable R|kotlin/String.length|"];
50 [label="Postponed enter to lambda"];
subgraph cluster_14 {
color=blue
64 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
62 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_15 {
color=blue
65 [label="Enter block"];
66 [label="Const: Int(1)"];
67 [label="Assignment: R|<local>/x|"];
68 [label="Exit block"];
63 [label="Enter block"];
64 [label="Const: Int(1)"];
65 [label="Assignment: R|<local>/x|"];
66 [label="Exit block"];
}
69 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
67 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
53 [label="Call arguments union" style="filled" fillcolor=yellow];
54 [label="Postponed exit from lambda"];
55 [label="Function call: R|/atLeastOnce|(...)"];
56 [label="Access variable R|<local>/x|"];
57 [label="Smart cast: R|<local>/x|"];
58 [label="Access variable <Unresolved name: length>#"];
59 [label="Access variable R|<local>/x|"];
60 [label="Smart cast: R|<local>/x|"];
61 [label="Function call: R|<local>/x|.R|kotlin/Int.inc|()"];
62 [label="Exit block"];
51 [label="Call arguments union" style="filled" fillcolor=yellow];
52 [label="Postponed exit from lambda"];
53 [label="Function call: R|/atLeastOnce|(...)"];
54 [label="Access variable R|<local>/x|"];
55 [label="Smart cast: R|<local>/x|"];
56 [label="Access variable <Unresolved name: length>#"];
57 [label="Access variable R|<local>/x|"];
58 [label="Smart cast: R|<local>/x|"];
59 [label="Function call: R|<local>/x|.R|kotlin/Int.inc|()"];
60 [label="Exit block"];
}
63 [label="Exit function test2" style="filled" fillcolor=red];
61 [label="Exit function test2" style="filled" fillcolor=red];
}
42 -> {43};
43 -> {44};
44 -> {45};
45 -> {46};
46 -> {47};
47 -> {48};
48 -> {49};
49 -> {50};
50 -> {51};
51 -> {52};
52 -> {64};
52 -> {54} [color=red];
52 -> {64} [style=dashed];
53 -> {55} [color=red];
54 -> {55} [color=green];
50 -> {62};
50 -> {52} [color=red];
50 -> {62} [style=dashed];
51 -> {53} [color=red];
52 -> {53} [color=green];
53 -> {54};
54 -> {55};
55 -> {56};
56 -> {57};
57 -> {58};
58 -> {59};
59 -> {60};
60 -> {61};
61 -> {62};
62 -> {63};
63 -> {64};
64 -> {65};
65 -> {66};
66 -> {67};
67 -> {68};
68 -> {69};
69 -> {53} [color=red];
69 -> {54} [color=green];
69 -> {64} [color=green style=dashed];
67 -> {51} [color=red];
67 -> {52} [color=green];
67 -> {62} [color=green style=dashed];
subgraph cluster_16 {
color=red
70 [label="Enter function test3" style="filled" fillcolor=red];
68 [label="Enter function test3" style="filled" fillcolor=red];
subgraph cluster_17 {
color=blue
71 [label="Enter block"];
72 [label="Variable declaration: lvar x: R|kotlin/Any?|"];
73 [label="Const: String()"];
74 [label="Assignment: R|<local>/x|"];
75 [label="Access variable R|<local>/x|"];
76 [label="Smart cast: R|<local>/x|"];
77 [label="Access variable R|kotlin/String.length|"];
78 [label="Postponed enter to lambda"];
69 [label="Enter block"];
70 [label="Variable declaration: lvar x: R|kotlin/Any?|"];
71 [label="Const: String()"];
72 [label="Assignment: R|<local>/x|"];
73 [label="Access variable R|<local>/x|"];
74 [label="Smart cast: R|<local>/x|"];
75 [label="Access variable R|kotlin/String.length|"];
76 [label="Postponed enter to lambda"];
subgraph cluster_18 {
color=blue
90 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
88 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_19 {
color=blue
91 [label="Enter block"];
92 [label="Const: Int(1)"];
93 [label="Assignment: R|<local>/x|"];
94 [label="Exit block"];
89 [label="Enter block"];
90 [label="Const: Int(1)"];
91 [label="Assignment: R|<local>/x|"];
92 [label="Exit block"];
}
95 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
93 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
79 [label="Call arguments union" style="filled" fillcolor=yellow];
80 [label="Postponed exit from lambda"];
81 [label="Function call: R|/exactlyOnce|(...)"];
82 [label="Access variable R|<local>/x|"];
83 [label="Smart cast: R|<local>/x|"];
84 [label="Access variable <Unresolved name: length>#"];
85 [label="Access variable R|<local>/x|"];
86 [label="Smart cast: R|<local>/x|"];
87 [label="Function call: R|<local>/x|.R|kotlin/Int.inc|()"];
88 [label="Exit block"];
77 [label="Call arguments union" style="filled" fillcolor=yellow];
78 [label="Postponed exit from lambda"];
79 [label="Function call: R|/exactlyOnce|(...)"];
80 [label="Access variable R|<local>/x|"];
81 [label="Smart cast: R|<local>/x|"];
82 [label="Access variable <Unresolved name: length>#"];
83 [label="Access variable R|<local>/x|"];
84 [label="Smart cast: R|<local>/x|"];
85 [label="Function call: R|<local>/x|.R|kotlin/Int.inc|()"];
86 [label="Exit block"];
}
89 [label="Exit function test3" style="filled" fillcolor=red];
87 [label="Exit function test3" style="filled" fillcolor=red];
}
68 -> {69};
69 -> {70};
70 -> {71};
71 -> {72};
72 -> {73};
73 -> {74};
74 -> {75};
75 -> {76};
76 -> {77};
77 -> {78};
78 -> {90};
78 -> {80} [color=red];
78 -> {90} [style=dashed];
79 -> {81} [color=red];
80 -> {81} [color=green];
76 -> {88};
76 -> {78} [color=red];
76 -> {88} [style=dashed];
77 -> {79} [color=red];
78 -> {79} [color=green];
79 -> {80};
80 -> {81};
81 -> {82};
82 -> {83};
83 -> {84};
84 -> {85};
85 -> {86};
86 -> {87};
87 -> {88};
88 -> {89};
89 -> {90};
90 -> {91};
91 -> {92};
92 -> {93};
93 -> {94};
94 -> {95};
95 -> {79} [color=red];
95 -> {80} [color=green];
95 -> {90} [color=green style=dashed];
93 -> {77} [color=red];
93 -> {78} [color=green];
93 -> {88} [color=green style=dashed];
subgraph cluster_20 {
color=red
96 [label="Enter function test4" style="filled" fillcolor=red];
94 [label="Enter function test4" style="filled" fillcolor=red];
subgraph cluster_21 {
color=blue
97 [label="Enter block"];
98 [label="Variable declaration: lvar x: R|kotlin/Any?|"];
99 [label="Const: String()"];
100 [label="Assignment: R|<local>/x|"];
101 [label="Access variable R|<local>/x|"];
102 [label="Smart cast: R|<local>/x|"];
103 [label="Access variable R|kotlin/String.length|"];
104 [label="Postponed enter to lambda"];
95 [label="Enter block"];
96 [label="Variable declaration: lvar x: R|kotlin/Any?|"];
97 [label="Const: String()"];
98 [label="Assignment: R|<local>/x|"];
99 [label="Access variable R|<local>/x|"];
100 [label="Smart cast: R|<local>/x|"];
101 [label="Access variable R|kotlin/String.length|"];
102 [label="Postponed enter to lambda"];
subgraph cluster_22 {
color=blue
115 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
113 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_23 {
color=blue
116 [label="Enter block"];
117 [label="Const: Int(1)"];
118 [label="Assignment: R|<local>/x|"];
119 [label="Exit block"];
114 [label="Enter block"];
115 [label="Const: Int(1)"];
116 [label="Assignment: R|<local>/x|"];
117 [label="Exit block"];
}
120 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
118 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
105 [label="Postponed exit from lambda"];
106 [label="Function call: R|/atMostOnce|(...)"];
107 [label="Access variable R|<local>/x|"];
108 [label="Smart cast: R|<local>/x|"];
109 [label="Access variable <Unresolved name: length>#"];
110 [label="Access variable R|<local>/x|"];
111 [label="Smart cast: R|<local>/x|"];
112 [label="Function call: R|<local>/x|.<Unresolved name: inc>#()"];
113 [label="Exit block"];
103 [label="Postponed exit from lambda"];
104 [label="Function call: R|/atMostOnce|(...)"];
105 [label="Access variable R|<local>/x|"];
106 [label="Smart cast: R|<local>/x|"];
107 [label="Access variable <Unresolved name: length>#"];
108 [label="Access variable R|<local>/x|"];
109 [label="Smart cast: R|<local>/x|"];
110 [label="Function call: R|<local>/x|.<Unresolved name: inc>#()"];
111 [label="Exit block"];
}
114 [label="Exit function test4" style="filled" fillcolor=red];
112 [label="Exit function test4" style="filled" fillcolor=red];
}
94 -> {95};
95 -> {96};
96 -> {97};
97 -> {98};
98 -> {99};
99 -> {100};
100 -> {101};
101 -> {102};
102 -> {103};
102 -> {103 113};
102 -> {113} [style=dashed];
103 -> {104};
104 -> {105 115};
104 -> {115} [style=dashed];
104 -> {105};
105 -> {106};
106 -> {107};
107 -> {108};
@@ -319,13 +317,11 @@ digraph flowFromInplaceLambda3_kt {
109 -> {110};
110 -> {111};
111 -> {112};
112 -> {113};
113 -> {114};
115 -> {120 116};
113 -> {118 114};
114 -> {115};
115 -> {116};
116 -> {117};
117 -> {118};
118 -> {119};
119 -> {120};
120 -> {105};
118 -> {103};
}