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
@@ -17,6 +17,7 @@ L0:
2 mark({ "before" class A(val x: Int) { init { val a = x } fun foo() { val b = x } } "after" })
mark("before")
r("before") -> <v0>
jmp?(L2)
v(val x: Int) INIT: in: {} out: {x=D}
magic[FAKE_INITIALIZER](val x: Int) -> <v1> INIT: in: {x=D} out: {x=D}
w(x|<v1>) INIT: in: {x=D} out: {x=ID}
@@ -25,9 +26,10 @@ L0:
magic[IMPLICIT_RECEIVER](x) -> <v2> INIT: in: {a=D, x=ID} out: {a=D, x=ID}
r(x|<v2>) -> <v3>
w(a|<v3>) INIT: in: {a=D, x=ID} out: {a=ID, x=ID}
2 jmp?(L2) INIT: in: {x=ID} out: {x=ID}
2 jmp?(L3) INIT: in: {x=ID} out: {x=ID}
d(fun foo() { val b = x }) USE: in: {x=READ} out: {x=READ}
L2 [after local declaration]:
L2 [after local class]:
L3 [after local declaration]:
mark("after")
r("after") -> <v4>
L1:
@@ -42,14 +44,14 @@ fun foo() {
val b = x
}
---------------------
L3:
L4:
3 <START> INIT: in: {x=ID} out: {x=ID}
4 mark({ val b = x })
v(val b = x) INIT: in: {x=ID} out: {b=D, x=ID}
magic[IMPLICIT_RECEIVER](x) -> <v0> INIT: in: {b=D, x=ID} out: {b=D, x=ID} USE: in: {x=READ} out: {x=READ}
r(x|<v0>) -> <v1> USE: in: {} out: {x=READ}
w(b|<v1>) INIT: in: {b=D, x=ID} out: {b=ID, x=ID}
L4:
L5:
3 <END> INIT: in: {x=ID} out: {x=ID}
error:
<ERROR> INIT: in: {} out: {}