[FIR] Add control flow graph to inplace lambdas

This commit is contained in:
Dmitriy Novozhilov
2020-03-31 15:23:32 +03:00
parent 1d39270b3e
commit bcd2e5ed2c
20 changed files with 983 additions and 996 deletions
@@ -44,7 +44,7 @@ digraph inPlaceLambdas_kt {
14 [label="Type operator: (R|<local>/x| is R|A|)"];
15 [label="Exit when branch condition"];
}
28 [label="Synthetic else branch"];
24 [label="Synthetic else branch"];
16 [label="Enter when branch result"];
subgraph cluster_7 {
color=blue
@@ -52,17 +52,17 @@ digraph inPlaceLambdas_kt {
18 [label="Postponed enter to lambda"];
subgraph cluster_8 {
color=blue
20 [label="Enter function anonymousFunction"];
22 [label="Access variable R|<local>/x|"];
23 [label="Function call: R|<local>/x|.R|/A.foo|()"];
21 [label="Exit function anonymousFunction"];
25 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
27 [label="Access variable R|<local>/x|"];
28 [label="Function call: R|<local>/x|.R|/A.foo|()"];
26 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
25 [label="Call arguments union" style="filled" fillcolor=yellow];
21 [label="Call arguments union" style="filled" fillcolor=yellow];
19 [label="Postponed exit from lambda"];
24 [label="Function call: R|kotlin/run|<R|kotlin/Unit|>(...)"];
26 [label="Exit block"];
20 [label="Function call: R|kotlin/run|<R|kotlin/Unit|>(...)"];
22 [label="Exit block"];
}
27 [label="Exit when branch result"];
23 [label="Exit when branch result"];
11 [label="Exit when"];
}
9 [label="Exit function test_1" style="filled" fillcolor=red];
@@ -73,22 +73,22 @@ digraph inPlaceLambdas_kt {
12 -> {13};
13 -> {14};
14 -> {15};
15 -> {16 28};
15 -> {16 24};
16 -> {17};
17 -> {18};
18 -> {20};
18 -> {25};
18 -> {19} [color=red];
19 -> {24} [color=green];
19 -> {20} [color=green];
20 -> {22};
21 -> {19} [color=green];
21 -> {25} [color=red];
21 -> {20} [color=red];
22 -> {23};
23 -> {21};
24 -> {26};
25 -> {24} [color=red];
26 -> {27};
27 -> {11};
28 -> {11};
23 -> {11};
24 -> {11};
25 -> {27};
26 -> {19} [color=green];
26 -> {21} [color=red];
27 -> {28};
28 -> {26};
subgraph cluster_9 {
color=red
@@ -96,31 +96,31 @@ digraph inPlaceLambdas_kt {
31 [label="Postponed enter to lambda"];
subgraph cluster_10 {
color=blue
33 [label="Enter function anonymousFunction"];
35 [label="Access variable R|<local>/x|"];
36 [label="Type operator: (R|<local>/x| as R|B|)"];
34 [label="Exit function anonymousFunction"];
37 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
39 [label="Access variable R|<local>/x|"];
40 [label="Type operator: (R|<local>/x| as R|B|)"];
38 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
38 [label="Call arguments union" style="filled" fillcolor=yellow];
34 [label="Call arguments union" style="filled" fillcolor=yellow];
32 [label="Postponed exit from lambda"];
37 [label="Function call: R|kotlin/run|<R|B|>(...)"];
39 [label="Access variable R|<local>/x|"];
40 [label="Function call: R|<local>/x|.R|/B.bar|()"];
33 [label="Function call: R|kotlin/run|<R|B|>(...)"];
35 [label="Access variable R|<local>/x|"];
36 [label="Function call: R|<local>/x|.R|/B.bar|()"];
30 [label="Exit function test_2" style="filled" fillcolor=red];
}
29 -> {31};
31 -> {33};
31 -> {37};
31 -> {32} [color=red];
32 -> {37} [color=green];
32 -> {33} [color=green];
33 -> {35};
34 -> {32} [color=green];
34 -> {38} [color=red];
34 -> {33} [color=red];
35 -> {36};
36 -> {34};
36 -> {30};
37 -> {39};
38 -> {37} [color=red];
38 -> {32} [color=green];
38 -> {34} [color=red];
39 -> {40};
40 -> {30};
40 -> {38};
subgraph cluster_11 {
color=red
@@ -135,7 +135,7 @@ digraph inPlaceLambdas_kt {
47 [label="Type operator: (R|<local>/x| is R|A|)"];
48 [label="Exit when branch condition"];
}
65 [label="Synthetic else branch"];
59 [label="Synthetic else branch"];
49 [label="Enter when branch result"];
subgraph cluster_14 {
color=blue
@@ -143,21 +143,21 @@ digraph inPlaceLambdas_kt {
51 [label="Postponed enter to lambda"];
subgraph cluster_15 {
color=blue
53 [label="Enter function anonymousFunction"];
55 [label="Access variable R|<local>/x|"];
56 [label="Function call: R|<local>/x|.R|/A.foo|()"];
57 [label="Access variable R|<local>/x|"];
58 [label="Type operator: (R|<local>/x| as R|B|)"];
54 [label="Exit function anonymousFunction"];
60 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
62 [label="Access variable R|<local>/x|"];
63 [label="Function call: R|<local>/x|.R|/A.foo|()"];
64 [label="Access variable R|<local>/x|"];
65 [label="Type operator: (R|<local>/x| as R|B|)"];
61 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
60 [label="Call arguments union" style="filled" fillcolor=yellow];
54 [label="Call arguments union" style="filled" fillcolor=yellow];
52 [label="Postponed exit from lambda"];
59 [label="Function call: R|kotlin/run|<R|B|>(...)"];
61 [label="Access variable R|<local>/x|"];
62 [label="Function call: R|<local>/x|.R|/B.bar|()"];
63 [label="Exit block"];
53 [label="Function call: R|kotlin/run|<R|B|>(...)"];
55 [label="Access variable R|<local>/x|"];
56 [label="Function call: R|<local>/x|.R|/B.bar|()"];
57 [label="Exit block"];
}
64 [label="Exit when branch result"];
58 [label="Exit when branch result"];
44 [label="Exit when"];
}
42 [label="Exit function test_3" style="filled" fillcolor=red];
@@ -168,25 +168,25 @@ digraph inPlaceLambdas_kt {
45 -> {46};
46 -> {47};
47 -> {48};
48 -> {49 65};
48 -> {49 59};
49 -> {50};
50 -> {51};
51 -> {53};
51 -> {60};
51 -> {52} [color=red];
52 -> {59} [color=green];
52 -> {53} [color=green];
53 -> {55};
54 -> {52} [color=green];
54 -> {60} [color=red];
54 -> {53} [color=red];
55 -> {56};
56 -> {57};
57 -> {58};
58 -> {54};
59 -> {61};
60 -> {59} [color=red];
61 -> {62};
58 -> {44};
59 -> {44};
60 -> {62};
61 -> {52} [color=green];
61 -> {54} [color=red];
62 -> {63};
63 -> {64};
64 -> {44};
65 -> {44};
64 -> {65};
65 -> {61};
}
@@ -207,76 +207,75 @@ digraph implicitReceivers_kt {
73 [label="Postponed enter to lambda"];
subgraph cluster_20 {
color=blue
75 [label="Enter function anonymousFunction"];
77 [label="Access variable R|<local>/b|"];
78 [label="Postponed enter to lambda"];
77 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
79 [label="Access variable R|<local>/b|"];
80 [label="Postponed enter to lambda"];
subgraph cluster_21 {
color=blue
80 [label="Enter function anonymousFunction"];
82 [label="Access variable R|<local>/c|"];
83 [label="Postponed enter to lambda"];
83 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
85 [label="Access variable R|<local>/c|"];
86 [label="Postponed enter to lambda"];
subgraph cluster_22 {
color=blue
85 [label="Enter function anonymousFunction"];
87 [label="Access variable this@R|special/anonymous|"];
88 [label="Type operator: (this@R|special/anonymous| as R|A|)"];
89 [label="Access variable this@R|special/anonymous|"];
90 [label="Function call: this@R|special/anonymous|.R|/A.foo|()"];
91 [label="Function call: this@R|special/anonymous|.R|/A.foo|()"];
86 [label="Exit function anonymousFunction"];
93 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
95 [label="Access variable this@R|special/anonymous|"];
96 [label="Type operator: (this@R|special/anonymous| as R|A|)"];
97 [label="Access variable this@R|special/anonymous|"];
98 [label="Function call: this@R|special/anonymous|.R|/A.foo|()"];
99 [label="Function call: this@R|special/anonymous|.R|/A.foo|()"];
94 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
93 [label="Call arguments union" style="filled" fillcolor=yellow];
84 [label="Postponed exit from lambda"];
92 [label="Function call: R|kotlin/with|<R|kotlin/Any|, R|kotlin/Unit|>(...)"];
94 [label="Access variable this@R|special/anonymous|"];
95 [label="Function call: this@R|special/anonymous|.R|/A.foo|()"];
96 [label="Function call: this@R|special/anonymous|.R|/A.foo|()"];
81 [label="Exit function anonymousFunction"];
89 [label="Call arguments union" style="filled" fillcolor=yellow];
87 [label="Postponed exit from lambda"];
88 [label="Function call: R|kotlin/with|<R|kotlin/Any|, R|kotlin/Unit|>(...)"];
90 [label="Access variable this@R|special/anonymous|"];
91 [label="Function call: this@R|special/anonymous|.R|/A.foo|()"];
92 [label="Function call: this@R|special/anonymous|.R|/A.foo|()"];
84 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
79 [label="Postponed exit from lambda"];
97 [label="Function call: R|kotlin/with|<R|kotlin/Any|, R|kotlin/Unit|>(...)"];
76 [label="Exit function anonymousFunction"];
81 [label="Postponed exit from lambda"];
82 [label="Function call: R|kotlin/with|<R|kotlin/Any|, R|kotlin/Unit|>(...)"];
78 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
99 [label="Call arguments union" style="filled" fillcolor=yellow];
76 [label="Call arguments union" style="filled" fillcolor=yellow];
74 [label="Postponed exit from lambda"];
98 [label="Function call: R|kotlin/with|<R|kotlin/Any|, R|kotlin/Unit|>(...)"];
75 [label="Function call: R|kotlin/with|<R|kotlin/Any|, R|kotlin/Unit|>(...)"];
71 [label="Exit function test_3" style="filled" fillcolor=red];
}
70 -> {72};
72 -> {73};
73 -> {75};
73 -> {77};
73 -> {74} [color=red];
74 -> {98} [color=green];
75 -> {77};
76 -> {74} [color=green];
76 -> {99} [color=red];
77 -> {78};
78 -> {80};
78 -> {79} [color=red];
79 -> {97};
80 -> {82};
81 -> {79} [color=green];
81 -> {99} [color=red];
82 -> {83};
74 -> {75} [color=green];
75 -> {71};
76 -> {75} [color=red];
77 -> {79};
78 -> {74} [color=green];
78 -> {76} [color=red];
79 -> {80};
80 -> {83};
80 -> {81} [color=red];
81 -> {82};
82 -> {78};
83 -> {85};
83 -> {84} [color=red];
84 -> {92} [color=green];
85 -> {87};
86 -> {84} [color=green];
86 -> {93} [color=red];
87 -> {88};
88 -> {89};
89 -> {90};
84 -> {81} [color=green];
85 -> {86};
86 -> {93};
86 -> {87} [color=red];
87 -> {88} [color=green];
88 -> {90};
89 -> {88} [color=red];
90 -> {91};
91 -> {86};
92 -> {94};
93 -> {92} [color=red];
94 -> {95};
91 -> {92};
92 -> {84};
93 -> {95};
94 -> {87} [color=green];
94 -> {89} [color=red];
95 -> {96};
96 -> {81};
97 -> {76};
98 -> {71};
99 -> {98} [color=red];
96 -> {97};
97 -> {98};
98 -> {99};
99 -> {94};
subgraph cluster_23 {
color=red
@@ -192,45 +192,45 @@ digraph safeCalls_kt {
77 [label="Postponed enter to lambda"];
subgraph cluster_13 {
color=blue
79 [label="Enter function anonymousFunction"];
81 [label="Jump: ^test_5 Unit"];
82 [label="Stub" style="filled" fillcolor=gray];
80 [label="Exit function anonymousFunction" style="filled" fillcolor=gray];
88 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
90 [label="Jump: ^test_5 Unit"];
91 [label="Stub" style="filled" fillcolor=gray];
89 [label="Exit function anonymousFunction" style="filled" fillcolor=red style="filled" fillcolor=gray];
}
84 [label="Call arguments union" style="filled" fillcolor=gray];
80 [label="Call arguments union" style="filled" fillcolor=gray];
78 [label="Postponed exit from lambda"];
83 [label="Function call: R|<local>/x|?.R|kotlin/let|<R|A|, R|kotlin/Nothing|>(...)" style="filled" fillcolor=gray];
79 [label="Function call: R|<local>/x|?.R|kotlin/let|<R|A|, R|kotlin/Nothing|>(...)" style="filled" fillcolor=gray];
76 [label="Exit safe call"];
85 [label="Enter safe call"];
87 [label="Access variable R|<local>/x|"];
88 [label="Function call: R|<local>/x|.R|/A.bool|()"];
89 [label="Function call: R|<local>/x|?.R|kotlin/let|<R|A|, R|kotlin/Nothing|>(...)?.R|/boo|(...)"];
86 [label="Exit safe call"];
90 [label="Access variable R|<local>/x|"];
91 [label="Function call: R|<local>/x|.<Inapplicable(WRONG_RECEIVER): [/A.id]>#()"];
81 [label="Enter safe call"];
83 [label="Access variable R|<local>/x|"];
84 [label="Function call: R|<local>/x|.R|/A.bool|()"];
85 [label="Function call: R|<local>/x|?.R|kotlin/let|<R|A|, R|kotlin/Nothing|>(...)?.R|/boo|(...)"];
82 [label="Exit safe call"];
86 [label="Access variable R|<local>/x|"];
87 [label="Function call: R|<local>/x|.<Inapplicable(WRONG_RECEIVER): [/A.id]>#()"];
73 [label="Exit function test_5" style="filled" fillcolor=red];
}
72 -> {74};
74 -> {75 76};
75 -> {77};
76 -> {85 86};
77 -> {79};
76 -> {81 82};
77 -> {88};
77 -> {78} [color=red];
78 -> {83} [color=green];
79 -> {81};
80 -> {84} [style=dotted];
80 -> {78} [color=green];
81 -> {73};
81 -> {82} [style=dotted];
82 -> {80} [style=dotted];
83 -> {76} [style=dotted];
84 -> {83} [style=dotted];
85 -> {87};
86 -> {90};
87 -> {88};
88 -> {89};
89 -> {86};
90 -> {91};
91 -> {73};
78 -> {79} [color=green];
79 -> {76} [style=dotted];
80 -> {79} [style=dotted];
81 -> {83};
82 -> {86};
83 -> {84};
84 -> {85};
85 -> {82};
86 -> {87};
87 -> {73};
88 -> {90};
89 -> {80} [style=dotted];
89 -> {78} [color=green];
90 -> {73};
90 -> {91} [style=dotted];
91 -> {89} [style=dotted];
}
@@ -202,14 +202,14 @@ digraph smartcastToNothing_kt {
88 [label="Postponed enter to lambda"];
subgraph cluster_21 {
color=blue
90 [label="Enter function anonymousFunction"];
92 [label="Access variable R|<local>/it|"];
93 [label="Access variable R|/A.a|"];
91 [label="Exit function anonymousFunction"];
92 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
94 [label="Access variable R|<local>/it|"];
95 [label="Access variable R|/A.a|"];
93 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
95 [label="Call arguments union" style="filled" fillcolor=yellow];
91 [label="Call arguments union" style="filled" fillcolor=yellow];
89 [label="Postponed exit from lambda"];
94 [label="Function call: R|<local>/s|?.R|kotlin/let|<R|A|, R|kotlin/Int|>(...)"];
90 [label="Function call: R|<local>/s|?.R|kotlin/let|<R|A|, R|kotlin/Int|>(...)"];
87 [label="Exit safe call"];
48 [label="Exit function test_0" style="filled" fillcolor=red];
}
@@ -254,15 +254,15 @@ digraph smartcastToNothing_kt {
85 -> {86 87};
86 -> {88};
87 -> {48} [style=dotted];
88 -> {90};
88 -> {92};
88 -> {89} [color=red];
89 -> {94} [color=green];
90 -> {92};
91 -> {89} [color=green];
91 -> {95} [color=red];
92 -> {93};
93 -> {91};
94 -> {87};
95 -> {94} [color=red];
89 -> {90} [color=green];
90 -> {87};
91 -> {90} [color=red];
92 -> {94};
93 -> {89} [color=green];
93 -> {91} [color=red];
94 -> {95};
95 -> {93};
}