Pseudocode: Generate fake values for Unit/Nothing-typed expressions

This commit is contained in:
Alexey Sedunov
2014-07-23 12:56:21 +04:00
parent 2d3ac9109b
commit 77bbf8f73b
72 changed files with 851 additions and 592 deletions
@@ -6,15 +6,16 @@ fun foo() {
L0:
1 <START>
2 mark({ return ?: null })
ret L1 NEXT:[<END>]
- mark(return ?: null) PREV:[]
- jt(L2) NEXT:[r(null) -> <v0>, <END>] PREV:[]
- r(null) -> <v0> PREV:[]
L1:
ret L1 NEXT:[<END>]
- mark(return ?: null) PREV:[]
- jt(L2) NEXT:[r(null) -> <v0>, merge(return ?: null|!<v1>, <v0>) -> <v2>] PREV:[]
- r(null) -> <v0> PREV:[]
L2:
1 <END> NEXT:[<SINK>] PREV:[ret L1]
- merge(return ?: null|!<v1>, <v0>) -> <v2> PREV:[]
L1:
1 <END> NEXT:[<SINK>] PREV:[ret L1]
error:
<ERROR> PREV:[]
<ERROR> PREV:[]
sink:
<SINK> PREV:[<ERROR>, <END>]
<SINK> PREV:[<ERROR>, <END>]
=====================
@@ -3,7 +3,8 @@ fun foo() {
return ?: null
}
---------------------
null <v0>: * NEW: r(null) -> <v0>
return ?: null <v0>: * COPY
{ return ?: null } <v0>: * COPY
return !<v1>: *
null <v0>: * NEW: r(null) -> <v0>
return ?: null <v2>: * NEW: merge(return ?: null|!<v1>, <v0>) -> <v2>
{ return ?: null } <v2>: * COPY
=====================
@@ -10,13 +10,13 @@ L0:
mark(throw Exception())
mark(Exception())
call(Exception(), <init>) -> <v0>
throw (throw Exception()|<v0>) NEXT:[<ERROR>]
- r(1) -> <v1> PREV:[]
- magic[STRING_TEMPLATE]("${throw Exception()} ${1}"|<v1>) -> <v2> PREV:[]
throw (throw Exception()|<v0>) NEXT:[<ERROR>]
- r(1) -> <v1> PREV:[]
- magic[STRING_TEMPLATE]("${throw Exception()} ${1}"|!<v2>, <v1>) -> <v3> PREV:[]
L1:
1 <END> NEXT:[<SINK>] PREV:[]
1 <END> NEXT:[<SINK>] PREV:[]
error:
<ERROR> PREV:[throw (throw Exception()|<v0>)]
<ERROR> PREV:[throw (throw Exception()|<v0>)]
sink:
<SINK> PREV:[<ERROR>, <END>]
<SINK> PREV:[<ERROR>, <END>]
=====================
@@ -3,8 +3,9 @@ fun test() {
"${throw Exception()} ${1}"
}
---------------------
Exception() <v0>: {<: Throwable} NEW: call(Exception(), <init>) -> <v0>
1 <v1>: * NEW: r(1) -> <v1>
"${throw Exception()} ${1}" <v2>: * NEW: magic[STRING_TEMPLATE]("${throw Exception()} ${1}"|<v1>) -> <v2>
{ "${throw Exception()} ${1}" } <v2>: * COPY
Exception() <v0>: {<: Throwable} NEW: call(Exception(), <init>) -> <v0>
throw Exception() !<v2>: *
1 <v1>: * NEW: r(1) -> <v1>
"${throw Exception()} ${1}" <v3>: * NEW: magic[STRING_TEMPLATE]("${throw Exception()} ${1}"|!<v2>, <v1>) -> <v3>
{ "${throw Exception()} ${1}" } <v3>: * COPY
=====================