FIR CFA: add control flow between default parameter values

function enter -> default 1 -> default 2 -> rest of function
                   \----------^ \----------^

This probably has no effect (in non-stupid code, at least), but it makes
graph construction more architecturally correct (now value parameters'
subgraphs get attached to a node).
This commit is contained in:
pyos
2022-12-09 13:48:15 +01:00
committed by Dmitriy Novozhilov
parent 74758278d7
commit 5d4fb3ead8
9 changed files with 656 additions and 599 deletions
@@ -22,26 +22,28 @@ digraph lambdaInWhenBranch_kt {
subgraph cluster_2 {
color=red
18 [label="Enter class SubClass1" style="filled" fillcolor=red];
19 [label="Part of class initialization"];
20 [label="Enter class SubClass1" style="filled" fillcolor=red];
21 [label="Part of class initialization"];
subgraph cluster_3 {
color=blue
8 [label="Enter property" style="filled" fillcolor=red];
9 [label="Access variable R|<local>/t|"];
10 [label="Exit property" style="filled" fillcolor=red];
}
20 [label="Exit class SubClass1" style="filled" fillcolor=red];
22 [label="Exit class SubClass1" style="filled" fillcolor=red];
}
subgraph cluster_4 {
color=blue
13 [label="Enter function copy" style="filled" fillcolor=red];
14 [label="Exit function copy" style="filled" fillcolor=red];
}
subgraph cluster_5 {
color=blue
15 [label="Enter default value of t" style="filled" fillcolor=red];
16 [label="Access variable R|/SubClass1.t|"];
17 [label="Exit default value of t" style="filled" fillcolor=red];
14 [label="Enter default value of t"];
subgraph cluster_5 {
color=blue
17 [label="Enter default value of t" style="filled" fillcolor=red];
18 [label="Access variable R|/SubClass1.t|"];
19 [label="Exit default value of t" style="filled" fillcolor=red];
}
15 [label="Exit default value of t"];
16 [label="Exit function copy" style="filled" fillcolor=red];
}
subgraph cluster_6 {
color=blue
@@ -54,174 +56,175 @@ digraph lambdaInWhenBranch_kt {
6 [label="Delegated constructor call: super<R|Sealed|>()" style="filled" fillcolor=yellow];
7 [label="Exit function <init>" style="filled" fillcolor=red];
}
18 -> {19} [color=green];
19 -> {8} [color=green];
19 -> {20} [style=dotted];
19 -> {8} [style=dashed];
20 -> {5 11 13} [color=green];
20 -> {5 11 13} [style=dashed];
20 -> {21} [color=green];
21 -> {8} [color=green];
21 -> {22} [style=dotted];
21 -> {8} [style=dashed];
22 -> {5 11 13} [color=green];
22 -> {5 11 13} [style=dashed];
8 -> {9};
9 -> {10};
10 -> {20} [color=green];
10 -> {22} [color=green];
5 -> {6};
6 -> {7};
11 -> {12};
13 -> {14 15};
13 -> {14};
14 -> {15 17};
14 -> {17 17} [style=dashed];
15 -> {16};
15 -> {15} [style=dashed];
16 -> {17};
17 -> {18};
18 -> {19};
19 -> {15};
subgraph cluster_8 {
color=red
26 [label="Enter class SubClass2" style="filled" fillcolor=red];
27 [label="Exit class SubClass2" style="filled" fillcolor=red];
28 [label="Enter class SubClass2" style="filled" fillcolor=red];
29 [label="Exit class SubClass2" style="filled" fillcolor=red];
}
subgraph cluster_9 {
color=blue
24 [label="Enter function copy" style="filled" fillcolor=red];
25 [label="Exit function copy" style="filled" fillcolor=red];
26 [label="Enter function copy" style="filled" fillcolor=red];
27 [label="Exit function copy" style="filled" fillcolor=red];
}
subgraph cluster_10 {
color=blue
21 [label="Enter function <init>" style="filled" fillcolor=red];
22 [label="Delegated constructor call: super<R|Sealed|>()" style="filled" fillcolor=yellow];
23 [label="Exit function <init>" style="filled" fillcolor=red];
23 [label="Enter function <init>" style="filled" fillcolor=red];
24 [label="Delegated constructor call: super<R|Sealed|>()" style="filled" fillcolor=yellow];
25 [label="Exit function <init>" style="filled" fillcolor=red];
}
26 -> {27} [color=green];
27 -> {21 24} [color=green];
27 -> {21 24} [style=dashed];
21 -> {22};
22 -> {23};
28 -> {29} [color=green];
29 -> {23 26} [color=green];
29 -> {23 26} [style=dashed];
23 -> {24};
24 -> {25};
26 -> {27};
subgraph cluster_11 {
color=red
28 [label="Enter function foo" style="filled" fillcolor=red];
30 [label="Enter function foo" style="filled" fillcolor=red];
subgraph cluster_12 {
color=blue
29 [label="Enter block"];
31 [label="Enter block"];
subgraph cluster_13 {
color=blue
30 [label="Enter when"];
31 [label="Access variable R|<local>/p|"];
32 [label="Enter when"];
33 [label="Access variable R|<local>/p|"];
subgraph cluster_14 {
color=blue
32 [label="Enter when branch condition "];
33 [label="Exit $subj"];
34 [label="Type operator: ($subj$ is R|SubClass1|)"];
35 [label="Exit when branch condition"];
34 [label="Enter when branch condition "];
35 [label="Exit $subj"];
36 [label="Type operator: ($subj$ is R|SubClass1|)"];
37 [label="Exit when branch condition"];
}
subgraph cluster_15 {
color=blue
36 [label="Enter when branch condition "];
37 [label="Exit $subj"];
38 [label="Type operator: ($subj$ is R|SubClass2|)"];
39 [label="Exit when branch condition"];
38 [label="Enter when branch condition "];
39 [label="Exit $subj"];
40 [label="Type operator: ($subj$ is R|SubClass2|)"];
41 [label="Exit when branch condition"];
}
40 [label="Enter when branch result"];
42 [label="Enter when branch result"];
subgraph cluster_16 {
color=blue
41 [label="Enter block"];
42 [label="Const: String()"];
43 [label="Exit block"];
43 [label="Enter block"];
44 [label="Const: String()"];
45 [label="Exit block"];
}
44 [label="Exit when branch result"];
45 [label="Enter when branch result"];
46 [label="Exit when branch result"];
47 [label="Enter when branch result"];
subgraph cluster_17 {
color=blue
46 [label="Enter block"];
47 [label="Const: String()"];
48 [label="Postponed enter to lambda"];
48 [label="Enter block"];
49 [label="Const: String()"];
50 [label="Postponed enter to lambda"];
subgraph cluster_18 {
color=blue
82 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
84 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
subgraph cluster_19 {
color=blue
83 [label="Enter block"];
84 [label="Access variable R|<local>/it|"];
85 [label="Exit block"];
85 [label="Enter block"];
86 [label="Access variable R|<local>/it|"];
87 [label="Exit block"];
}
86 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
88 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
49 [label="Postponed exit from lambda"];
50 [label="Function call: String().R|kotlin/let|<R|kotlin/String|, R|kotlin/String|>(...)" style="filled" fillcolor=yellow];
51 [label="Exit block"];
51 [label="Postponed exit from lambda"];
52 [label="Function call: String().R|kotlin/let|<R|kotlin/String|, R|kotlin/String|>(...)" style="filled" fillcolor=yellow];
53 [label="Exit block"];
}
52 [label="Exit when branch result"];
53 [label="Exit when"];
54 [label="Exit when branch result"];
55 [label="Exit when"];
}
54 [label="Access variable R|<local>/p|"];
55 [label="Access variable <Unresolved name: t>#"];
56 [label="Access variable R|<local>/p|"];
57 [label="Access variable <Unresolved name: t>#"];
subgraph cluster_20 {
color=blue
56 [label="Enter when"];
57 [label="Access variable R|<local>/p|"];
58 [label="Enter when"];
59 [label="Access variable R|<local>/p|"];
subgraph cluster_21 {
color=blue
58 [label="Enter when branch condition "];
59 [label="Exit $subj"];
60 [label="Type operator: ($subj$ is R|SubClass1|)"];
61 [label="Exit when branch condition"];
60 [label="Enter when branch condition "];
61 [label="Exit $subj"];
62 [label="Type operator: ($subj$ is R|SubClass1|)"];
63 [label="Exit when branch condition"];
}
subgraph cluster_22 {
color=blue
62 [label="Enter when branch condition "];
63 [label="Exit $subj"];
64 [label="Type operator: ($subj$ is R|SubClass2|)"];
65 [label="Exit when branch condition"];
64 [label="Enter when branch condition "];
65 [label="Exit $subj"];
66 [label="Type operator: ($subj$ is R|SubClass2|)"];
67 [label="Exit when branch condition"];
}
66 [label="Enter when branch result"];
68 [label="Enter when branch result"];
subgraph cluster_23 {
color=blue
67 [label="Enter block"];
68 [label="Const: String(2)"];
69 [label="Exit block"];
69 [label="Enter block"];
70 [label="Const: String(2)"];
71 [label="Exit block"];
}
70 [label="Exit when branch result"];
71 [label="Enter when branch result"];
72 [label="Exit when branch result"];
73 [label="Enter when branch result"];
subgraph cluster_24 {
color=blue
72 [label="Enter block"];
73 [label="Access variable R|<local>/p|"];
74 [label="Smart cast: R|<local>/p|"];
75 [label="Access variable R|/SubClass1.t|"];
76 [label="Exit block"];
74 [label="Enter block"];
75 [label="Access variable R|<local>/p|"];
76 [label="Smart cast: R|<local>/p|"];
77 [label="Access variable R|/SubClass1.t|"];
78 [label="Exit block"];
}
77 [label="Exit when branch result"];
78 [label="Exit when"];
79 [label="Exit when branch result"];
80 [label="Exit when"];
}
79 [label="Access variable R|kotlin/String.length|"];
80 [label="Exit block"];
81 [label="Access variable R|kotlin/String.length|"];
82 [label="Exit block"];
}
81 [label="Exit function foo" style="filled" fillcolor=red];
83 [label="Exit function foo" style="filled" fillcolor=red];
}
28 -> {29};
29 -> {30};
30 -> {31};
31 -> {32};
32 -> {33};
33 -> {34};
34 -> {35};
35 -> {36 45};
35 -> {36};
36 -> {37};
37 -> {38};
37 -> {38 47};
38 -> {39};
39 -> {40};
40 -> {41};
41 -> {42};
42 -> {43};
43 -> {44};
44 -> {53};
44 -> {45};
45 -> {46};
46 -> {47};
46 -> {55};
47 -> {48};
48 -> {50 82};
48 -> {49} [style=dotted];
48 -> {82} [style=dashed];
49 -> {50} [color=green];
49 -> {53} [color=red];
50 -> {51};
51 -> {52};
48 -> {49};
49 -> {50};
50 -> {52 84};
50 -> {51} [style=dotted];
50 -> {84} [style=dashed];
51 -> {52} [color=green];
51 -> {55} [color=red];
52 -> {53};
53 -> {54};
54 -> {55};
@@ -231,18 +234,18 @@ digraph lambdaInWhenBranch_kt {
58 -> {59};
59 -> {60};
60 -> {61};
61 -> {62 71};
61 -> {62};
62 -> {63};
63 -> {64};
63 -> {64 73};
64 -> {65};
65 -> {66};
66 -> {67};
67 -> {68};
68 -> {69};
69 -> {70};
70 -> {78};
70 -> {71};
71 -> {72};
72 -> {73};
72 -> {80};
73 -> {74};
74 -> {75};
75 -> {76};
@@ -251,10 +254,12 @@ digraph lambdaInWhenBranch_kt {
78 -> {79};
79 -> {80};
80 -> {81};
81 -> {82};
82 -> {83};
83 -> {84};
84 -> {85};
85 -> {86};
86 -> {49};
86 -> {87};
87 -> {88};
88 -> {51};
}