[FIR] Introduce new algorithm for building CFG for declarations

This commit is contained in:
Dmitriy Novozhilov
2020-06-05 15:47:57 +03:00
parent 950bbfe3a5
commit 87859b0faa
95 changed files with 16070 additions and 13199 deletions
@@ -6,263 +6,309 @@ digraph propertiesAndInitBlocks_kt {
subgraph cluster_0 {
color=red
0 [label="Enter function run" style="filled" fillcolor=red];
2 [label="Function call: R|<local>/block|.R|FakeOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()"];
subgraph cluster_1 {
color=blue
2 [label="Enter block"];
3 [label="Function call: R|<local>/block|.R|FakeOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()"];
4 [label="Exit block"];
}
1 [label="Exit function run" style="filled" fillcolor=red];
}
0 -> {2};
2 -> {1};
subgraph cluster_1 {
color=red
5 [label="Enter property" style="filled" fillcolor=red];
subgraph cluster_2 {
color=blue
3 [label="Enter function getter" style="filled" fillcolor=red];
4 [label="Exit function getter" style="filled" fillcolor=red];
}
7 [label="Const: Int(1)"];
6 [label="Exit property" style="filled" fillcolor=red];
}
5 -> {7};
7 -> {6};
2 -> {3};
3 -> {4};
4 -> {1};
subgraph cluster_2 {
color=red
5 [label="Enter function getter" style="filled" fillcolor=red];
6 [label="Exit function getter" style="filled" fillcolor=red];
}
5 -> {6};
subgraph cluster_3 {
color=red
17 [label="Enter property" style="filled" fillcolor=red];
subgraph cluster_4 {
color=blue
13 [label="Enter function setter" style="filled" fillcolor=red];
15 [label="Const: Int(1)"];
16 [label="Assignment: F|/x2|"];
14 [label="Exit function setter" style="filled" fillcolor=red];
}
7 [label="Enter property" style="filled" fillcolor=red];
9 [label="Const: Int(1)"];
8 [label="Exit property" style="filled" fillcolor=red];
}
7 -> {9};
9 -> {8};
subgraph cluster_4 {
color=red
10 [label="Enter function getter" style="filled" fillcolor=red];
subgraph cluster_5 {
color=blue
8 [label="Enter function getter" style="filled" fillcolor=red];
10 [label="Const: Int(1)"];
11 [label="Jump: ^ Int(1)"];
12 [label="Stub" style="filled" fillcolor=gray];
9 [label="Exit function getter" style="filled" fillcolor=red];
12 [label="Enter block"];
13 [label="Const: Int(1)"];
14 [label="Jump: ^ Int(1)"];
15 [label="Stub" style="filled" fillcolor=gray];
16 [label="Exit block" style="filled" fillcolor=gray];
}
19 [label="Const: Int(1)"];
18 [label="Exit property" style="filled" fillcolor=red];
11 [label="Exit function getter" style="filled" fillcolor=red];
}
17 -> {19};
19 -> {18};
8 -> {10};
10 -> {11};
11 -> {9};
11 -> {12} [style=dotted];
12 -> {9} [style=dotted];
13 -> {15};
15 -> {16};
16 -> {14};
10 -> {12};
12 -> {13};
13 -> {14};
14 -> {11};
14 -> {15} [style=dotted];
15 -> {16} [style=dotted];
16 -> {11} [style=dotted];
subgraph cluster_6 {
color=red
35 [label="Enter function <init>" style="filled" fillcolor=red];
37 [label="Delegated constructor call: super<R|kotlin/Any|>()"];
36 [label="Exit function <init>" style="filled" fillcolor=red];
}
35 -> {37};
37 -> {36};
subgraph cluster_7 {
color=red
46 [label="Enter class LocalClass" style="filled" fillcolor=red];
subgraph cluster_8 {
17 [label="Enter function setter" style="filled" fillcolor=red];
subgraph cluster_7 {
color=blue
38 [label="Enter init block" style="filled" fillcolor=red];
subgraph cluster_9 {
color=blue
40 [label="Enter block"];
41 [label="Function call: R|java/lang/Exception.Exception|()"];
42 [label="Throw: throw R|java/lang/Exception.Exception|()"];
43 [label="Stub" style="filled" fillcolor=gray];
44 [label="Const: Int(1)" style="filled" fillcolor=gray];
45 [label="Exit block" style="filled" fillcolor=gray];
}
39 [label="Exit init block" style="filled" fillcolor=red];
19 [label="Enter block"];
20 [label="Const: Int(1)"];
21 [label="Assignment: F|/x2|"];
22 [label="Exit block"];
}
47 [label="Exit class LocalClass" style="filled" fillcolor=red];
18 [label="Exit function setter" style="filled" fillcolor=red];
}
46 -> {38} [color=green];
38 -> {40};
39 -> {47} [color=green];
40 -> {41};
41 -> {42};
42 -> {39};
42 -> {43} [style=dotted];
43 -> {44} [style=dotted];
44 -> {45} [style=dotted];
45 -> {39} [style=dotted];
17 -> {19};
19 -> {20};
20 -> {21};
21 -> {22};
22 -> {18};
subgraph cluster_10 {
subgraph cluster_8 {
color=red
51 [label="Enter function <init>" style="filled" fillcolor=red];
53 [label="Delegated constructor call: super<R|kotlin/Any|>()"];
52 [label="Exit function <init>" style="filled" fillcolor=red];
23 [label="Enter property" style="filled" fillcolor=red];
25 [label="Const: Int(1)"];
24 [label="Exit property" style="filled" fillcolor=red];
}
51 -> {53};
53 -> {52};
23 -> {25};
25 -> {24};
subgraph cluster_9 {
color=red
44 [label="Enter function foo" style="filled" fillcolor=red];
subgraph cluster_10 {
color=blue
46 [label="Enter block"];
47 [label="Const: Int(1)"];
48 [label="Const: Int(1)"];
49 [label="Function call: Int(1).R|kotlin/Int.plus|(...)"];
50 [label="Variable declaration: lval c: R|kotlin/Int|"];
51 [label="Function call: R|java/lang/Exception.Exception|()"];
52 [label="Throw: throw R|java/lang/Exception.Exception|()"];
53 [label="Stub" style="filled" fillcolor=gray];
54 [label="Exit block" style="filled" fillcolor=gray];
}
45 [label="Exit function foo" style="filled" fillcolor=red];
}
44 -> {46};
46 -> {47};
47 -> {48};
48 -> {49};
49 -> {50};
50 -> {51};
51 -> {52};
52 -> {45};
52 -> {53} [style=dotted];
53 -> {54} [style=dotted];
54 -> {45} [style=dotted];
subgraph cluster_11 {
color=red
61 [label="Enter class LocalClass" style="filled" fillcolor=red];
subgraph cluster_12 {
color=blue
54 [label="Enter init block" style="filled" fillcolor=red];
subgraph cluster_13 {
color=blue
56 [label="Enter block"];
57 [label="Function call: R|java/lang/Exception.Exception|()"];
58 [label="Throw: throw R|java/lang/Exception.Exception|()"];
59 [label="Stub" style="filled" fillcolor=gray];
60 [label="Exit block" style="filled" fillcolor=gray];
}
55 [label="Exit init block" style="filled" fillcolor=red];
}
62 [label="Exit class LocalClass" style="filled" fillcolor=red];
55 [label="Enter function <init>" style="filled" fillcolor=red];
57 [label="Delegated constructor call: super<R|kotlin/Any|>()"];
56 [label="Exit function <init>" style="filled" fillcolor=red];
}
61 -> {54} [color=green];
54 -> {56};
55 -> {62} [color=green];
56 -> {57};
57 -> {58};
58 -> {55};
58 -> {59} [style=dotted];
59 -> {60} [style=dotted];
60 -> {55} [style=dotted];
55 -> {57};
57 -> {56};
subgraph cluster_14 {
subgraph cluster_12 {
color=red
63 [label="Enter property" style="filled" fillcolor=red];
subgraph cluster_15 {
58 [label="Enter function getter" style="filled" fillcolor=red];
subgraph cluster_13 {
color=blue
48 [label="Enter function getter" style="filled" fillcolor=red];
50 [label="Exit local class <getter>"];
49 [label="Exit function getter" style="filled" fillcolor=red];
}
65 [label="Postponed enter to lambda"];
subgraph cluster_16 {
color=blue
20 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
22 [label="Exit local class <anonymous>"];
23 [label="Function call: R|java/lang/Exception.Exception|()"];
24 [label="Throw: throw R|java/lang/Exception.Exception|()"];
25 [label="Stub" style="filled" fillcolor=gray];
subgraph cluster_17 {
64 [label="Enter class GetterLocalClass" style="filled" fillcolor=red];
subgraph cluster_14 {
color=blue
26 [label="Enter function foo" style="filled" fillcolor=red];
28 [label="Const: Int(1)"];
29 [label="Const: Int(1)"];
30 [label="Function call: Int(1).R|kotlin/Int.plus|(...)"];
31 [label="Variable declaration: lval c: R|kotlin/Int|"];
32 [label="Function call: R|java/lang/Exception.Exception|()"];
33 [label="Throw: throw R|java/lang/Exception.Exception|()"];
34 [label="Stub" style="filled" fillcolor=gray];
27 [label="Exit function foo" style="filled" fillcolor=red];
60 [label="Enter block"];
61 [label="Exit local class <getter>"];
62 [label="Exit block"];
}
21 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_15 {
color=blue
65 [label="Enter init block" style="filled" fillcolor=red];
subgraph cluster_16 {
color=blue
67 [label="Enter block"];
68 [label="Function call: R|java/lang/Exception.Exception|()"];
69 [label="Throw: throw R|java/lang/Exception.Exception|()"];
70 [label="Stub" style="filled" fillcolor=gray];
71 [label="Exit block" style="filled" fillcolor=gray];
}
66 [label="Exit init block" style="filled" fillcolor=red];
}
63 [label="Exit class GetterLocalClass" style="filled" fillcolor=red];
}
66 [label="Postponed exit from lambda"];
67 [label="Function call: R|/run|(...)"];
64 [label="Exit property" style="filled" fillcolor=red];
59 [label="Exit function getter" style="filled" fillcolor=red];
}
63 -> {65};
65 -> {20};
65 -> {66} [color=red];
66 -> {67};
67 -> {64};
20 -> {21 22};
20 -> {26 35 38} [color=red];
21 -> {66} [color=green];
21 -> {20} [color=green style=dashed];
22 -> {23};
23 -> {24};
24 -> {64};
24 -> {25} [style=dotted];
25 -> {21} [style=dotted];
26 -> {28};
28 -> {29};
29 -> {30};
30 -> {31};
31 -> {32};
32 -> {33};
33 -> {27};
33 -> {34} [style=dotted];
34 -> {27} [style=dotted];
48 -> {50};
48 -> {51 54} [color=red];
50 -> {49};
58 -> {60};
60 -> {61};
60 -> {72 65} [color=red];
61 -> {62};
62 -> {59};
64 -> {65} [color=green];
65 -> {67};
66 -> {63} [color=green];
67 -> {68};
68 -> {69};
69 -> {66};
69 -> {70} [style=dotted];
70 -> {71} [style=dotted];
71 -> {66} [style=dotted];
subgraph cluster_17 {
color=red
72 [label="Enter function <init>" style="filled" fillcolor=red];
74 [label="Delegated constructor call: super<R|kotlin/Any|>()"];
73 [label="Exit function <init>" style="filled" fillcolor=red];
}
72 -> {74};
74 -> {73};
subgraph cluster_18 {
color=red
70 [label="Enter property" style="filled" fillcolor=red];
75 [label="Enter property" style="filled" fillcolor=red];
subgraph cluster_19 {
color=blue
68 [label="Enter function getter" style="filled" fillcolor=red];
69 [label="Exit function getter" style="filled" fillcolor=red];
}
subgraph cluster_20 {
color=blue
72 [label="Try expression enter"];
subgraph cluster_21 {
35 [label="Enter class InitializerLocalClass" style="filled" fillcolor=red];
77 [label="Postponed enter to lambda"];
subgraph cluster_20 {
color=blue
74 [label="Try main block enter"];
26 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_21 {
color=blue
28 [label="Enter block"];
29 [label="Exit local class <anonymous>"];
30 [label="Function call: R|java/lang/Exception.Exception|()"];
31 [label="Throw: throw R|java/lang/Exception.Exception|()"];
32 [label="Stub" style="filled" fillcolor=gray];
33 [label="Exit block" style="filled" fillcolor=gray];
}
subgraph cluster_22 {
color=blue
77 [label="Enter block"];
78 [label="Const: Int(1)"];
79 [label="Exit block"];
36 [label="Enter init block" style="filled" fillcolor=red];
subgraph cluster_23 {
color=blue
38 [label="Enter block"];
39 [label="Function call: R|java/lang/Exception.Exception|()"];
40 [label="Throw: throw R|java/lang/Exception.Exception|()"];
41 [label="Stub" style="filled" fillcolor=gray];
42 [label="Const: Int(1)" style="filled" fillcolor=gray];
43 [label="Exit block" style="filled" fillcolor=gray];
}
37 [label="Exit init block" style="filled" fillcolor=red];
}
80 [label="Try main block exit"];
34 [label="Exit class InitializerLocalClass" style="filled" fillcolor=red];
}
subgraph cluster_23 {
color=blue
76 [label="Enter finally"];
subgraph cluster_24 {
color=blue
85 [label="Enter block"];
86 [label="Const: Int(0)"];
87 [label="Exit block"];
}
88 [label="Exit finally"];
}
subgraph cluster_25 {
color=blue
75 [label="Catch enter"];
subgraph cluster_26 {
color=blue
81 [label="Enter block"];
82 [label="Const: Int(2)"];
83 [label="Exit block"];
}
84 [label="Catch exit"];
}
73 [label="Try expression exit"];
27 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
71 [label="Exit property" style="filled" fillcolor=red];
78 [label="Postponed exit from lambda"];
79 [label="Function call: R|/run|(...)"];
76 [label="Exit property" style="filled" fillcolor=red];
}
70 -> {72};
72 -> {74};
73 -> {71};
74 -> {71 75 76 77};
75 -> {71 81};
76 -> {85};
77 -> {78};
75 -> {77};
77 -> {26};
77 -> {78} [color=red];
78 -> {79};
79 -> {80};
80 -> {73};
81 -> {82};
82 -> {83};
83 -> {84};
84 -> {73};
85 -> {86};
86 -> {87};
87 -> {88};
88 -> {73};
68 -> {69};
79 -> {76};
26 -> {27 28};
27 -> {78} [color=green];
27 -> {26} [color=green style=dashed];
28 -> {29};
28 -> {44 55 36} [color=red];
29 -> {30};
30 -> {31};
31 -> {27};
31 -> {32} [style=dotted];
32 -> {33} [style=dotted];
33 -> {27} [style=dotted];
35 -> {36} [color=green];
36 -> {38};
37 -> {34} [color=green];
38 -> {39};
39 -> {40};
40 -> {37};
40 -> {41} [style=dotted];
41 -> {42} [style=dotted];
42 -> {43} [style=dotted];
43 -> {37} [style=dotted];
subgraph cluster_24 {
color=red
80 [label="Enter function getter" style="filled" fillcolor=red];
81 [label="Exit function getter" style="filled" fillcolor=red];
}
80 -> {81};
subgraph cluster_25 {
color=red
82 [label="Enter property" style="filled" fillcolor=red];
subgraph cluster_26 {
color=blue
84 [label="Try expression enter"];
subgraph cluster_27 {
color=blue
86 [label="Try main block enter"];
subgraph cluster_28 {
color=blue
89 [label="Enter block"];
90 [label="Const: Int(1)"];
91 [label="Exit block"];
}
92 [label="Try main block exit"];
}
subgraph cluster_29 {
color=blue
88 [label="Enter finally"];
subgraph cluster_30 {
color=blue
97 [label="Enter block"];
98 [label="Const: Int(0)"];
99 [label="Exit block"];
}
100 [label="Exit finally"];
}
subgraph cluster_31 {
color=blue
87 [label="Catch enter"];
subgraph cluster_32 {
color=blue
93 [label="Enter block"];
94 [label="Const: Int(2)"];
95 [label="Exit block"];
}
96 [label="Catch exit"];
}
85 [label="Try expression exit"];
}
83 [label="Exit property" style="filled" fillcolor=red];
}
82 -> {84};
84 -> {86};
85 -> {83};
86 -> {83 87 88 89};
87 -> {83 93};
88 -> {97};
89 -> {90};
90 -> {91};
91 -> {92};
92 -> {85};
93 -> {94};
94 -> {95};
95 -> {96};
96 -> {85};
97 -> {98};
98 -> {99};
99 -> {100};
100 -> {85};
}