restructured control flow tests
This commit is contained in:
@@ -0,0 +1,335 @@
|
||||
== doSmth ==
|
||||
fun doSmth() {}
|
||||
---------------------
|
||||
L0:
|
||||
<START>
|
||||
mark({})
|
||||
read (Unit)
|
||||
L1:
|
||||
<END> NEXT:[<SINK>]
|
||||
error:
|
||||
<ERROR> PREV:[]
|
||||
sink:
|
||||
<SINK> PREV:[<ERROR>, <END>]
|
||||
=====================
|
||||
== doSmth1 ==
|
||||
fun doSmth1() {}
|
||||
---------------------
|
||||
L0:
|
||||
<START>
|
||||
mark({})
|
||||
read (Unit)
|
||||
L1:
|
||||
<END> NEXT:[<SINK>]
|
||||
error:
|
||||
<ERROR> PREV:[]
|
||||
sink:
|
||||
<SINK> PREV:[<ERROR>, <END>]
|
||||
=====================
|
||||
== doSmth2 ==
|
||||
fun doSmth2() {}
|
||||
---------------------
|
||||
L0:
|
||||
<START>
|
||||
mark({})
|
||||
read (Unit)
|
||||
L1:
|
||||
<END> NEXT:[<SINK>]
|
||||
error:
|
||||
<ERROR> PREV:[]
|
||||
sink:
|
||||
<SINK> PREV:[<ERROR>, <END>]
|
||||
=====================
|
||||
== cond ==
|
||||
fun cond() {}
|
||||
---------------------
|
||||
L0:
|
||||
<START>
|
||||
mark({})
|
||||
read (Unit)
|
||||
L1:
|
||||
<END> NEXT:[<SINK>]
|
||||
error:
|
||||
<ERROR> PREV:[]
|
||||
sink:
|
||||
<SINK> PREV:[<ERROR>, <END>]
|
||||
=====================
|
||||
== testCopy1 ==
|
||||
fun testCopy1() : Int {
|
||||
try {
|
||||
doSmth()
|
||||
}
|
||||
catch (e: NullPointerException) {
|
||||
doSmth1()
|
||||
}
|
||||
catch (e: Exception) {
|
||||
doSmth2()
|
||||
}
|
||||
finally {
|
||||
return 1
|
||||
}
|
||||
}
|
||||
---------------------
|
||||
L0:
|
||||
<START>
|
||||
mark({ try { doSmth() } catch (e: NullPointerException) { doSmth1() } catch (e: Exception) { doSmth2() } finally { return 1 } })
|
||||
mark(try { doSmth() } catch (e: NullPointerException) { doSmth1() } catch (e: Exception) { doSmth2() } finally { return 1 })
|
||||
jmp?(L2 [onException]) NEXT:[jmp?(L5 [catch 0]), jmp?(L3 [onExceptionToFinallyBlock])]
|
||||
jmp?(L3 [onExceptionToFinallyBlock]) NEXT:[mark({ return 1 }), mark({ doSmth() })]
|
||||
mark({ doSmth() })
|
||||
mark(doSmth())
|
||||
call(doSmth, doSmth)
|
||||
jmp(L4 [afterCatches]) NEXT:[jmp(L6 [skipFinallyToErrorBlock])]
|
||||
L2 [onException]:
|
||||
jmp?(L5 [catch 0]) NEXT:[v(e: Exception), v(e: NullPointerException)] PREV:[jmp?(L2 [onException])]
|
||||
v(e: NullPointerException)
|
||||
w(e)
|
||||
mark({ doSmth1() })
|
||||
mark(doSmth1())
|
||||
call(doSmth1, doSmth1)
|
||||
jmp(L4 [afterCatches]) NEXT:[jmp(L6 [skipFinallyToErrorBlock])]
|
||||
L5 [catch 0]:
|
||||
v(e: Exception) PREV:[jmp?(L5 [catch 0])]
|
||||
w(e)
|
||||
mark({ doSmth2() })
|
||||
mark(doSmth2())
|
||||
call(doSmth2, doSmth2)
|
||||
jmp(L4 [afterCatches])
|
||||
L4 [afterCatches]:
|
||||
jmp(L6 [skipFinallyToErrorBlock]) NEXT:[mark({ return 1 })] PREV:[jmp(L4 [afterCatches]), jmp(L4 [afterCatches]), jmp(L4 [afterCatches])]
|
||||
L3 [onExceptionToFinallyBlock]:
|
||||
L7 [start finally]:
|
||||
mark({ return 1 }) PREV:[jmp?(L3 [onExceptionToFinallyBlock])]
|
||||
r(1)
|
||||
ret(*) L1 NEXT:[<END>]
|
||||
L8 [finish finally]:
|
||||
- jmp(error) NEXT:[<ERROR>] PREV:[]
|
||||
L6 [skipFinallyToErrorBlock]:
|
||||
mark({ return 1 }) PREV:[jmp(L6 [skipFinallyToErrorBlock])]
|
||||
r(1)
|
||||
ret(*) L1
|
||||
L1:
|
||||
<END> NEXT:[<SINK>] PREV:[ret(*) L1, ret(*) L1]
|
||||
error:
|
||||
<ERROR> PREV:[]
|
||||
sink:
|
||||
<SINK> PREV:[<ERROR>, <END>]
|
||||
=====================
|
||||
== testCopy2 ==
|
||||
fun testCopy2() {
|
||||
while (cond()) {
|
||||
try {
|
||||
doSmth()
|
||||
}
|
||||
catch (e: NullPointerException) {
|
||||
doSmth1()
|
||||
}
|
||||
catch (e: Exception) {
|
||||
doSmth2()
|
||||
}
|
||||
finally {
|
||||
if (cond()) return
|
||||
else continue
|
||||
}
|
||||
}
|
||||
}
|
||||
---------------------
|
||||
L0:
|
||||
<START>
|
||||
mark({ while (cond()) { try { doSmth() } catch (e: NullPointerException) { doSmth1() } catch (e: Exception) { doSmth2() } finally { if (cond()) return else continue } } })
|
||||
mark(while (cond()) { try { doSmth() } catch (e: NullPointerException) { doSmth1() } catch (e: Exception) { doSmth2() } finally { if (cond()) return else continue } })
|
||||
L2 [loop entry point]:
|
||||
L5 [condition entry point]:
|
||||
mark(cond()) PREV:[mark(while (cond()) { try { doSmth() } catch (e: NullPointerException) { doSmth1() } catch (e: Exception) { doSmth2() } finally { if (cond()) return else continue } }), jmp(L2 [loop entry point]), jmp(L2 [loop entry point])]
|
||||
call(cond, cond)
|
||||
jf(L3 [loop exit point]) NEXT:[read (Unit), mark({ try { doSmth() } catch (e: NullPointerException) { doSmth1() } catch (e: Exception) { doSmth2() } finally { if (cond()) return else continue } })]
|
||||
L4 [body entry point]:
|
||||
mark({ try { doSmth() } catch (e: NullPointerException) { doSmth1() } catch (e: Exception) { doSmth2() } finally { if (cond()) return else continue } })
|
||||
mark(try { doSmth() } catch (e: NullPointerException) { doSmth1() } catch (e: Exception) { doSmth2() } finally { if (cond()) return else continue })
|
||||
jmp?(L6 [onException]) NEXT:[jmp?(L9 [catch 0]), jmp?(L7 [onExceptionToFinallyBlock])]
|
||||
jmp?(L7 [onExceptionToFinallyBlock]) NEXT:[mark({ if (cond()) return else continue }), mark({ doSmth() })]
|
||||
mark({ doSmth() })
|
||||
mark(doSmth())
|
||||
call(doSmth, doSmth)
|
||||
jmp(L8 [afterCatches]) NEXT:[jmp(L10 [skipFinallyToErrorBlock])]
|
||||
L6 [onException]:
|
||||
jmp?(L9 [catch 0]) NEXT:[v(e: Exception), v(e: NullPointerException)] PREV:[jmp?(L6 [onException])]
|
||||
v(e: NullPointerException)
|
||||
w(e)
|
||||
mark({ doSmth1() })
|
||||
mark(doSmth1())
|
||||
call(doSmth1, doSmth1)
|
||||
jmp(L8 [afterCatches]) NEXT:[jmp(L10 [skipFinallyToErrorBlock])]
|
||||
L9 [catch 0]:
|
||||
v(e: Exception) PREV:[jmp?(L9 [catch 0])]
|
||||
w(e)
|
||||
mark({ doSmth2() })
|
||||
mark(doSmth2())
|
||||
call(doSmth2, doSmth2)
|
||||
jmp(L8 [afterCatches])
|
||||
L8 [afterCatches]:
|
||||
jmp(L10 [skipFinallyToErrorBlock]) NEXT:[mark({ if (cond()) return else continue })] PREV:[jmp(L8 [afterCatches]), jmp(L8 [afterCatches]), jmp(L8 [afterCatches])]
|
||||
L7 [onExceptionToFinallyBlock]:
|
||||
L11 [start finally]:
|
||||
mark({ if (cond()) return else continue }) PREV:[jmp?(L7 [onExceptionToFinallyBlock])]
|
||||
mark(if (cond()) return else continue)
|
||||
mark(cond())
|
||||
call(cond, cond)
|
||||
jf(L12) NEXT:[jmp(L2 [loop entry point]), ret L1]
|
||||
ret L1 NEXT:[<END>]
|
||||
- jmp(L13) NEXT:[jmp(error)] PREV:[]
|
||||
L12:
|
||||
jmp(L2 [loop entry point]) NEXT:[mark(cond())] PREV:[jf(L12)]
|
||||
L13:
|
||||
L14 [finish finally]:
|
||||
- jmp(error) NEXT:[<ERROR>] PREV:[]
|
||||
L10 [skipFinallyToErrorBlock]:
|
||||
mark({ if (cond()) return else continue }) PREV:[jmp(L10 [skipFinallyToErrorBlock])]
|
||||
mark(if (cond()) return else continue)
|
||||
mark(cond())
|
||||
call(cond, cond)
|
||||
jf(copy L12) NEXT:[jmp(L2 [loop entry point]), ret L1]
|
||||
ret L1 NEXT:[<END>]
|
||||
- jmp(copy L13) NEXT:[jmp(L2 [loop entry point])] PREV:[]
|
||||
jmp(L2 [loop entry point]) NEXT:[mark(cond())] PREV:[jf(copy L12)]
|
||||
- jmp(L2 [loop entry point]) NEXT:[mark(cond())] PREV:[]
|
||||
L3 [loop exit point]:
|
||||
read (Unit) PREV:[jf(L3 [loop exit point])]
|
||||
L1:
|
||||
<END> NEXT:[<SINK>] PREV:[ret L1, ret L1, read (Unit)]
|
||||
error:
|
||||
<ERROR> PREV:[]
|
||||
sink:
|
||||
<SINK> PREV:[<ERROR>, <END>]
|
||||
=====================
|
||||
== testCopy3 ==
|
||||
fun testCopy3() {
|
||||
try {
|
||||
doSmth()
|
||||
}
|
||||
catch (e: NullPointerException) {
|
||||
doSmth1()
|
||||
}
|
||||
catch (e: Exception) {
|
||||
doSmth2()
|
||||
}
|
||||
finally {
|
||||
while (cond());
|
||||
}
|
||||
}
|
||||
---------------------
|
||||
L0:
|
||||
<START>
|
||||
mark({ try { doSmth() } catch (e: NullPointerException) { doSmth1() } catch (e: Exception) { doSmth2() } finally { while (cond()); } })
|
||||
mark(try { doSmth() } catch (e: NullPointerException) { doSmth1() } catch (e: Exception) { doSmth2() } finally { while (cond()); })
|
||||
jmp?(L2 [onException]) NEXT:[jmp?(L5 [catch 0]), jmp?(L3 [onExceptionToFinallyBlock])]
|
||||
jmp?(L3 [onExceptionToFinallyBlock]) NEXT:[mark({ while (cond()); }), mark({ doSmth() })]
|
||||
mark({ doSmth() })
|
||||
mark(doSmth())
|
||||
call(doSmth, doSmth)
|
||||
jmp(L4 [afterCatches]) NEXT:[jmp(L6 [skipFinallyToErrorBlock])]
|
||||
L2 [onException]:
|
||||
jmp?(L5 [catch 0]) NEXT:[v(e: Exception), v(e: NullPointerException)] PREV:[jmp?(L2 [onException])]
|
||||
v(e: NullPointerException)
|
||||
w(e)
|
||||
mark({ doSmth1() })
|
||||
mark(doSmth1())
|
||||
call(doSmth1, doSmth1)
|
||||
jmp(L4 [afterCatches]) NEXT:[jmp(L6 [skipFinallyToErrorBlock])]
|
||||
L5 [catch 0]:
|
||||
v(e: Exception) PREV:[jmp?(L5 [catch 0])]
|
||||
w(e)
|
||||
mark({ doSmth2() })
|
||||
mark(doSmth2())
|
||||
call(doSmth2, doSmth2)
|
||||
jmp(L4 [afterCatches])
|
||||
L4 [afterCatches]:
|
||||
jmp(L6 [skipFinallyToErrorBlock]) NEXT:[mark({ while (cond()); })] PREV:[jmp(L4 [afterCatches]), jmp(L4 [afterCatches]), jmp(L4 [afterCatches])]
|
||||
L3 [onExceptionToFinallyBlock]:
|
||||
L7 [start finally]:
|
||||
mark({ while (cond()); }) PREV:[jmp?(L3 [onExceptionToFinallyBlock])]
|
||||
mark(while (cond()))
|
||||
L8 [loop entry point]:
|
||||
L11 [condition entry point]:
|
||||
mark(cond()) PREV:[mark(while (cond())), jmp(L8 [loop entry point])]
|
||||
call(cond, cond)
|
||||
jf(L9 [loop exit point]) NEXT:[read (Unit), jmp(L8 [loop entry point])]
|
||||
L10 [body entry point]:
|
||||
jmp(L8 [loop entry point]) NEXT:[mark(cond())]
|
||||
L9 [loop exit point]:
|
||||
read (Unit) PREV:[jf(L9 [loop exit point])]
|
||||
L12 [finish finally]:
|
||||
jmp(error) NEXT:[<ERROR>]
|
||||
L6 [skipFinallyToErrorBlock]:
|
||||
mark({ while (cond()); }) PREV:[jmp(L6 [skipFinallyToErrorBlock])]
|
||||
mark(while (cond()))
|
||||
mark(cond()) PREV:[mark(while (cond())), jmp(copy L8 [loop entry point])]
|
||||
call(cond, cond)
|
||||
jf(copy L9 [loop exit point]) NEXT:[read (Unit), jmp(copy L8 [loop entry point])]
|
||||
jmp(copy L8 [loop entry point]) NEXT:[mark(cond())]
|
||||
read (Unit) PREV:[jf(copy L9 [loop exit point])]
|
||||
L1:
|
||||
<END> NEXT:[<SINK>]
|
||||
error:
|
||||
<ERROR> PREV:[jmp(error)]
|
||||
sink:
|
||||
<SINK> PREV:[<ERROR>, <END>]
|
||||
=====================
|
||||
== doTestCopy4 ==
|
||||
fun doTestCopy4(list: List<String>?) : Int {
|
||||
try {
|
||||
doSmth()
|
||||
}
|
||||
finally {
|
||||
if(list != null) {
|
||||
}
|
||||
}
|
||||
}
|
||||
---------------------
|
||||
L0:
|
||||
<START>
|
||||
v(list: List<String>?)
|
||||
w(list)
|
||||
mark({ try { doSmth() } finally { if(list != null) { } } })
|
||||
mark(try { doSmth() } finally { if(list != null) { } })
|
||||
jmp?(L2 [onExceptionToFinallyBlock]) NEXT:[mark({ if(list != null) { } }), mark({ doSmth() })]
|
||||
mark({ doSmth() })
|
||||
mark(doSmth())
|
||||
call(doSmth, doSmth)
|
||||
jmp(L3 [skipFinallyToErrorBlock]) NEXT:[mark({ if(list != null) { } })]
|
||||
L2 [onExceptionToFinallyBlock]:
|
||||
L4 [start finally]:
|
||||
mark({ if(list != null) { } }) PREV:[jmp?(L2 [onExceptionToFinallyBlock])]
|
||||
mark(if(list != null) { })
|
||||
mark(list != null)
|
||||
r(list)
|
||||
r(null)
|
||||
call(!=, equals)
|
||||
jf(L5) NEXT:[read (Unit), mark({ })]
|
||||
mark({ })
|
||||
read (Unit)
|
||||
jmp(L6) NEXT:[jmp(error)]
|
||||
L5:
|
||||
read (Unit) PREV:[jf(L5)]
|
||||
L6:
|
||||
L7 [finish finally]:
|
||||
jmp(error) NEXT:[<ERROR>] PREV:[jmp(L6), read (Unit)]
|
||||
L3 [skipFinallyToErrorBlock]:
|
||||
mark({ if(list != null) { } }) PREV:[jmp(L3 [skipFinallyToErrorBlock])]
|
||||
mark(if(list != null) { })
|
||||
mark(list != null)
|
||||
r(list)
|
||||
r(null)
|
||||
call(!=, equals)
|
||||
jf(copy L5) NEXT:[read (Unit), mark({ })]
|
||||
mark({ })
|
||||
read (Unit)
|
||||
jmp(copy L6) NEXT:[<END>]
|
||||
read (Unit) PREV:[jf(copy L5)]
|
||||
L1:
|
||||
<END> NEXT:[<SINK>] PREV:[jmp(copy L6), read (Unit)]
|
||||
error:
|
||||
<ERROR> PREV:[jmp(error)]
|
||||
sink:
|
||||
<SINK> PREV:[<ERROR>, <END>]
|
||||
=====================
|
||||
Reference in New Issue
Block a user