More accurate CFG for local class constructors (now they are not considered unconditionally executed) #KT-10042 Fixed

This commit is contained in:
Mikhail Glukhikh
2016-03-21 17:35:53 +03:00
parent 8756cba2f5
commit b975b7d26e
15 changed files with 155 additions and 36 deletions
@@ -14,11 +14,13 @@ fun f() {
L0:
1 <START>
2 mark({ class LocalClass() { fun f() { val x = "" fun loc() { val x3 = "" } } } })
jmp?(L2) NEXT:[<END>, d(fun f() { val x = "" fun loc() { val x3 = "" } })]
jmp?(L2) NEXT:[<END>, jmp?(L3)]
jmp?(L3) NEXT:[<END>, d(fun f() { val x = "" fun loc() { val x3 = "" } })]
d(fun f() { val x = "" fun loc() { val x3 = "" } }) NEXT:[<SINK>]
L1:
L2 [after local declaration]:
1 <END> NEXT:[<SINK>] PREV:[jmp?(L2)]
L2 [after local class]:
L3 [after local declaration]:
1 <END> NEXT:[<SINK>] PREV:[jmp?(L2), jmp?(L3)]
error:
<ERROR> PREV:[]
sink:
@@ -33,18 +35,18 @@ fun f() {
}
}
---------------------
L3:
L4:
3 <START>
4 mark({ val x = "" fun loc() { val x3 = "" } })
v(val x = "")
mark("")
r("") -> <v0>
w(x|<v0>)
jmp?(L5) NEXT:[<END>, d(fun loc() { val x3 = "" })]
jmp?(L6) NEXT:[<END>, d(fun loc() { val x3 = "" })]
d(fun loc() { val x3 = "" }) NEXT:[<SINK>]
L4:
L5 [after local declaration]:
3 <END> NEXT:[<SINK>] PREV:[jmp?(L5)]
L5:
L6 [after local declaration]:
3 <END> NEXT:[<SINK>] PREV:[jmp?(L6)]
error:
<ERROR> PREV:[]
sink:
@@ -55,17 +57,17 @@ fun loc() {
val x3 = ""
}
---------------------
L6:
L7:
5 <START>
6 mark({ val x3 = "" })
v(val x3 = "")
mark("")
r("") -> <v0>
w(x3|<v0>)
L7:
L8:
5 <END> NEXT:[<SINK>]
error:
<ERROR> PREV:[]
sink:
<SINK> PREV:[<ERROR>, <END>]
=====================
=====================
@@ -12,12 +12,14 @@ fun foo() {
L0:
1 <START>
2 mark({ class B { val a: Int get() { val b: Int return b } } })
jmp?(L2) NEXT:[<END>, v(val a: Int get() { val b: Int return b })]
v(val a: Int get() { val b: Int return b })
jmp?(L2) NEXT:[<END>, d(get() { val b: Int return b })]
jmp?(L3) NEXT:[<END>, d(get() { val b: Int return b })]
d(get() { val b: Int return b }) NEXT:[<SINK>]
L1:
L2 [after local declaration]:
1 <END> NEXT:[<SINK>] PREV:[jmp?(L2)]
L2 [after local class]:
L3 [after local declaration]:
1 <END> NEXT:[<SINK>] PREV:[jmp?(L2), jmp?(L3)]
error:
<ERROR> PREV:[]
sink:
@@ -29,16 +31,16 @@ get() {
return b
}
---------------------
L3:
L4:
3 <START>
4 mark({ val b: Int return b })
v(val b: Int)
r(b) -> <v0>
ret(*|<v0>) L4
L4:
ret(*|<v0>) L5
L5:
3 <END> NEXT:[<SINK>]
error:
<ERROR> PREV:[]
sink:
<SINK> PREV:[<ERROR>, <END>]
=====================
=====================