FIR CFA: rewrite handling of try-catch-finally

The result is the same, but it should now be much clearer what the
shortcomings of the current implementation are.
This commit is contained in:
pyos
2022-11-27 21:27:37 +01:00
committed by Dmitriy Novozhilov
parent a079010fad
commit 069d99c5ea
10 changed files with 390 additions and 466 deletions
@@ -55,24 +55,24 @@ digraph endlessLoops_kt {
color=blue
20 [label="Enter block"];
21 [label="Jump: break@@@[Boolean(true)] "];
22 [label="Stub" style="filled" fillcolor=gray];
23 [label="Exit block" style="filled" fillcolor=gray];
28 [label="Stub" style="filled" fillcolor=gray];
29 [label="Exit block" style="filled" fillcolor=gray];
}
24 [label="Exit when branch result" style="filled" fillcolor=gray];
25 [label="Exit when"];
30 [label="Exit when branch result" style="filled" fillcolor=gray];
31 [label="Exit when"];
}
26 [label="Exit block"];
32 [label="Exit block"];
}
27 [label="Exit loop block"];
33 [label="Exit loop block"];
}
28 [label="Exit whileloop"];
22 [label="Exit whileloop"];
}
29 [label="Access variable R|<local>/x|"];
30 [label="Smart cast: R|<local>/x|"];
31 [label="Function call: R|<local>/x|.R|/A.foo|()" style="filled" fillcolor=yellow];
32 [label="Exit block"];
23 [label="Access variable R|<local>/x|"];
24 [label="Smart cast: R|<local>/x|"];
25 [label="Function call: R|<local>/x|.R|/A.foo|()" style="filled" fillcolor=yellow];
26 [label="Exit block"];
}
33 [label="Exit function test_1" style="filled" fillcolor=red];
27 [label="Exit function test_1" style="filled" fillcolor=red];
}
4 -> {5};
5 -> {6};
@@ -80,7 +80,7 @@ digraph endlessLoops_kt {
7 -> {8};
8 -> {9};
9 -> {10};
9 -> {28} [style=dotted];
9 -> {22} [style=dotted];
10 -> {11};
11 -> {12};
12 -> {13};
@@ -89,22 +89,22 @@ digraph endlessLoops_kt {
15 -> {16};
16 -> {17};
17 -> {18 19};
18 -> {25};
18 -> {31};
19 -> {20};
20 -> {21};
21 -> {28};
21 -> {22} [style=dotted];
22 -> {23} [style=dotted];
23 -> {24} [style=dotted];
24 -> {25} [style=dotted];
21 -> {22};
21 -> {28} [style=dotted];
22 -> {23};
23 -> {24};
24 -> {25};
25 -> {26};
26 -> {27};
27 -> {7} [color=green style=dashed];
28 -> {29};
29 -> {30};
30 -> {31};
28 -> {29} [style=dotted];
29 -> {30} [style=dotted];
30 -> {31} [style=dotted];
31 -> {32};
32 -> {33};
33 -> {7} [color=green style=dashed];
subgraph cluster_11 {
color=red
@@ -144,24 +144,24 @@ digraph endlessLoops_kt {
49 [label="Access variable R|<local>/x|"];
50 [label="Type operator: (R|<local>/x| as R|A|)"];
51 [label="Jump: break@@@[Boolean(true)] "];
52 [label="Stub" style="filled" fillcolor=gray];
53 [label="Exit block" style="filled" fillcolor=gray];
58 [label="Stub" style="filled" fillcolor=gray];
59 [label="Exit block" style="filled" fillcolor=gray];
}
54 [label="Exit when branch result" style="filled" fillcolor=gray];
55 [label="Exit when"];
60 [label="Exit when branch result" style="filled" fillcolor=gray];
61 [label="Exit when"];
}
56 [label="Exit block"];
62 [label="Exit block"];
}
57 [label="Exit loop block"];
63 [label="Exit loop block"];
}
58 [label="Exit whileloop"];
52 [label="Exit whileloop"];
}
59 [label="Access variable R|<local>/x|"];
60 [label="Smart cast: R|<local>/x|"];
61 [label="Function call: R|<local>/x|.R|/A.foo|()" style="filled" fillcolor=yellow];
62 [label="Exit block"];
53 [label="Access variable R|<local>/x|"];
54 [label="Smart cast: R|<local>/x|"];
55 [label="Function call: R|<local>/x|.R|/A.foo|()" style="filled" fillcolor=yellow];
56 [label="Exit block"];
}
63 [label="Exit function test_2" style="filled" fillcolor=red];
57 [label="Exit function test_2" style="filled" fillcolor=red];
}
34 -> {35};
35 -> {36};
@@ -169,31 +169,31 @@ digraph endlessLoops_kt {
37 -> {38};
38 -> {39};
39 -> {40};
39 -> {58} [style=dotted];
39 -> {52} [style=dotted];
40 -> {41};
41 -> {42};
42 -> {43};
43 -> {44};
44 -> {45};
45 -> {46 47};
46 -> {55};
46 -> {61};
47 -> {48};
48 -> {49};
49 -> {50};
50 -> {51};
51 -> {58};
51 -> {52} [style=dotted];
52 -> {53} [style=dotted];
53 -> {54} [style=dotted];
54 -> {55} [style=dotted];
51 -> {52};
51 -> {58} [style=dotted];
52 -> {53};
53 -> {54};
54 -> {55};
55 -> {56};
56 -> {57};
57 -> {37} [color=green style=dashed];
58 -> {59};
59 -> {60};
60 -> {61};
58 -> {59} [style=dotted];
59 -> {60} [style=dotted];
60 -> {61} [style=dotted];
61 -> {62};
62 -> {63};
63 -> {37} [color=green style=dashed];
subgraph cluster_20 {
color=red
@@ -254,24 +254,24 @@ digraph endlessLoops_kt {
color=blue
92 [label="Enter block"];
93 [label="Jump: break@@@[Boolean(true)] "];
94 [label="Stub" style="filled" fillcolor=gray];
95 [label="Exit block" style="filled" fillcolor=gray];
100 [label="Stub" style="filled" fillcolor=gray];
101 [label="Exit block" style="filled" fillcolor=gray];
}
96 [label="Exit when branch result" style="filled" fillcolor=gray];
97 [label="Exit when"];
102 [label="Exit when branch result" style="filled" fillcolor=gray];
103 [label="Exit when"];
}
98 [label="Exit block"];
104 [label="Exit block"];
}
99 [label="Exit loop block"];
105 [label="Exit loop block"];
}
100 [label="Exit whileloop"];
94 [label="Exit whileloop"];
}
101 [label="Access variable R|<local>/x|"];
102 [label="Smart cast: R|<local>/x|"];
103 [label="Function call: R|<local>/x|.R|/A.foo|()" style="filled" fillcolor=yellow];
104 [label="Exit block"];
95 [label="Access variable R|<local>/x|"];
96 [label="Smart cast: R|<local>/x|"];
97 [label="Function call: R|<local>/x|.R|/A.foo|()" style="filled" fillcolor=yellow];
98 [label="Exit block"];
}
105 [label="Exit function test_3" style="filled" fillcolor=red];
99 [label="Exit function test_3" style="filled" fillcolor=red];
}
64 -> {65};
65 -> {66};
@@ -279,7 +279,7 @@ digraph endlessLoops_kt {
67 -> {68};
68 -> {69};
69 -> {70};
69 -> {100} [style=dotted];
69 -> {94} [style=dotted];
70 -> {71};
71 -> {72};
72 -> {73};
@@ -291,7 +291,7 @@ digraph endlessLoops_kt {
78 -> {85};
79 -> {80};
80 -> {81};
81 -> {100};
81 -> {94};
81 -> {82} [style=dotted];
82 -> {83} [style=dotted];
83 -> {84} [style=dotted];
@@ -301,22 +301,22 @@ digraph endlessLoops_kt {
87 -> {88};
88 -> {89};
89 -> {90 91};
90 -> {97};
90 -> {103};
91 -> {92};
92 -> {93};
93 -> {100};
93 -> {94} [style=dotted];
94 -> {95} [style=dotted];
95 -> {96} [style=dotted];
96 -> {97} [style=dotted];
93 -> {94};
93 -> {100} [style=dotted];
94 -> {95};
95 -> {96};
96 -> {97};
97 -> {98};
98 -> {99};
99 -> {67} [color=green style=dashed];
100 -> {101};
101 -> {102};
102 -> {103};
100 -> {101} [style=dotted];
101 -> {102} [style=dotted];
102 -> {103} [style=dotted];
103 -> {104};
104 -> {105};
105 -> {67} [color=green style=dashed];
subgraph cluster_32 {
color=red
@@ -363,18 +363,18 @@ digraph endlessLoops_kt {
127 [label="Exit when"];
}
128 [label="Jump: break@@@[Boolean(true)] "];
129 [label="Stub" style="filled" fillcolor=gray];
130 [label="Exit block" style="filled" fillcolor=gray];
134 [label="Stub" style="filled" fillcolor=gray];
135 [label="Exit block" style="filled" fillcolor=gray];
}
131 [label="Exit loop block" style="filled" fillcolor=gray];
136 [label="Exit loop block" style="filled" fillcolor=gray];
}
132 [label="Exit whileloop"];
129 [label="Exit whileloop"];
}
133 [label="Access variable R|<local>/x|"];
134 [label="Function call: R|<local>/x|.<Unresolved name: foo>#()" style="filled" fillcolor=yellow];
135 [label="Exit block"];
130 [label="Access variable R|<local>/x|"];
131 [label="Function call: R|<local>/x|.<Unresolved name: foo>#()" style="filled" fillcolor=yellow];
132 [label="Exit block"];
}
136 [label="Exit function test_4" style="filled" fillcolor=red];
133 [label="Exit function test_4" style="filled" fillcolor=red];
}
106 -> {107};
107 -> {108};
@@ -382,7 +382,7 @@ digraph endlessLoops_kt {
109 -> {110};
110 -> {111};
111 -> {112};
111 -> {132} [style=dotted];
111 -> {129} [style=dotted];
112 -> {113};
113 -> {114};
114 -> {115};
@@ -394,21 +394,21 @@ digraph endlessLoops_kt {
120 -> {121};
121 -> {122};
122 -> {123};
123 -> {132};
123 -> {129};
123 -> {124} [style=dotted];
124 -> {125} [style=dotted];
125 -> {126} [style=dotted];
126 -> {127} [style=dotted];
127 -> {128};
128 -> {132};
128 -> {129} [style=dotted];
129 -> {130} [style=dotted];
130 -> {131} [style=dotted];
131 -> {109} [color=green style=dotted];
128 -> {129};
128 -> {134} [style=dotted];
129 -> {130};
130 -> {131};
131 -> {132};
132 -> {133};
133 -> {134};
134 -> {135};
135 -> {136};
134 -> {135} [style=dotted];
135 -> {136} [style=dotted];
136 -> {109} [color=green style=dotted];
subgraph cluster_41 {
color=red