Pseudocode: Generate pseudo-values for implicit receivers

This commit is contained in:
Alexey Sedunov
2014-06-10 13:49:56 +04:00
parent 4e4675d24a
commit 45bd3a520e
21 changed files with 330 additions and 296 deletions
@@ -7,15 +7,16 @@ class A {
}
---------------------
L0:
1 <START> INIT: in: {} out: {}
1 <START> INIT: in: {} out: {}
2 mark({ x = 1 })
r(1) -> <v0> USE: in: {x=ONLY_WRITTEN_NEVER_READ} out: {x=ONLY_WRITTEN_NEVER_READ}
w(x|<v0>) INIT: in: {} out: {x=I} USE: in: {} out: {x=ONLY_WRITTEN_NEVER_READ}
1 v(val x: Int) INIT: in: {x=I} out: {x=ID}
magic(x) -> <v0>
r(1) -> <v1> USE: in: {x=ONLY_WRITTEN_NEVER_READ} out: {x=ONLY_WRITTEN_NEVER_READ}
w(x|<v0>, <v1>) INIT: in: {} out: {x=I} USE: in: {} out: {x=ONLY_WRITTEN_NEVER_READ}
1 v(val x: Int) INIT: in: {x=I} out: {x=ID}
L1:
<END> INIT: in: {x=ID} out: {x=ID}
<END> INIT: in: {x=ID} out: {x=ID}
error:
<ERROR> INIT: in: {} out: {}
<ERROR> INIT: in: {} out: {}
sink:
<SINK> INIT: in: {x=ID} out: {x=ID} USE: in: {} out: {}
<SINK> INIT: in: {x=ID} out: {x=ID} USE: in: {} out: {}
=====================
@@ -6,5 +6,5 @@ class A {
val x: Int
}
---------------------
1 <v0> NEW()
1 <v1> NEW()
=====================
@@ -39,9 +39,9 @@ L0:
mark(foo.c)
r(foo) -> <v1> USE: in: {c=READ, foo=READ} out: {c=READ, foo=READ}
r(c|<v1>) -> <v2> USE: in: {c=ONLY_WRITTEN_NEVER_READ, foo=READ} out: {c=READ, foo=READ}
r(2) -> <v3> USE: in: {c=ONLY_WRITTEN_NEVER_READ, foo=READ} out: {c=ONLY_WRITTEN_NEVER_READ, foo=READ}
r(foo) -> <v4> USE: in: {c=ONLY_WRITTEN_NEVER_READ} out: {c=ONLY_WRITTEN_NEVER_READ, foo=READ}
w(foo.c|<v4>, <v3>) INIT: in: {foo=ID} out: {c=I, foo=ID} USE: in: {} out: {c=ONLY_WRITTEN_NEVER_READ}
r(foo) -> <v3> USE: in: {c=ONLY_WRITTEN_NEVER_READ} out: {c=ONLY_WRITTEN_NEVER_READ, foo=READ}
r(2) -> <v4> USE: in: {c=ONLY_WRITTEN_NEVER_READ} out: {c=ONLY_WRITTEN_NEVER_READ}
w(foo.c|<v3>, <v4>) INIT: in: {foo=ID} out: {c=I, foo=ID} USE: in: {} out: {c=ONLY_WRITTEN_NEVER_READ}
r(42) -> <v5> INIT: in: {c=I, foo=ID} out: {c=I, foo=ID}
L1:
1 <END>
@@ -21,8 +21,8 @@ fun bar(foo: Foo) {
foo <v1> NEW()
c <v2> NEW(<v1>)
foo.c <v2> COPY
foo <v4> NEW()
2 <v3> NEW()
foo <v3> NEW()
2 <v4> NEW()
42 <v5> NEW()
{ foo.c foo.c = 2 42 } <v5> COPY
=====================