Detecting tail calls through CFA
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
== foo ==
|
||||
tailRecursive fun foo() {
|
||||
try {
|
||||
return foo()
|
||||
}
|
||||
catch (e: Throwable) {
|
||||
}
|
||||
}
|
||||
---------------------
|
||||
L0:
|
||||
<START>
|
||||
mark({ try { return foo() } catch (e: Throwable) { } })
|
||||
mark(try { return foo() } catch (e: Throwable) { })
|
||||
jmp?(L2 [onException]) NEXT:[v(e: Throwable), mark({ return foo() })]
|
||||
mark({ return foo() })
|
||||
mark(foo())
|
||||
call(foo, foo)
|
||||
ret(*) L1 NEXT:[<END>]
|
||||
- jmp(L3 [afterCatches]) NEXT:[<END>] PREV:[]
|
||||
L2 [onException]:
|
||||
v(e: Throwable) PREV:[jmp?(L2 [onException])]
|
||||
w(e)
|
||||
mark({ })
|
||||
read (Unit)
|
||||
jmp(L3 [afterCatches])
|
||||
L1:
|
||||
L3 [afterCatches]:
|
||||
<END> NEXT:[<SINK>] PREV:[ret(*) L1, jmp(L3 [afterCatches])]
|
||||
error:
|
||||
<ERROR> PREV:[]
|
||||
sink:
|
||||
<SINK> PREV:[<ERROR>, <END>]
|
||||
=====================
|
||||
Reference in New Issue
Block a user