02b40326cc
If all the suspension calls in a suspend function were "hidden" under the for-convention (iterator/next/hasNext) calls, control-flow didn't find them, thus supposing that there is no suspension points and there is no need to generate a coroutine state machine The solution is to add relevant calls to CFG #KT-15824 Fixed
61 lines
1.6 KiB
Plaintext
Vendored
61 lines
1.6 KiB
Plaintext
Vendored
== t1 ==
|
|
fun t1() {
|
|
for (i in 1..2) {
|
|
doSmth(i)
|
|
}
|
|
}
|
|
---------------------
|
|
L0:
|
|
1 <START>
|
|
2 mark({ for (i in 1..2) { doSmth(i) } })
|
|
3 r(1) -> <v0>
|
|
r(2) -> <v1>
|
|
mark(1..2)
|
|
call(1..2, rangeTo|<v0>, <v1>) -> <v2>
|
|
mark(1..2)
|
|
call(1..2, iterator|<v2>) -> <v3>
|
|
v(i)
|
|
L2 [loop entry point]:
|
|
L6 [condition entry point]:
|
|
mark(1..2) PREV:[v(i), jmp(L2)]
|
|
call(1..2, hasNext) -> <v4>
|
|
jmp?(L3) NEXT:[read (Unit), mark(1..2)]
|
|
mark(1..2)
|
|
call(1..2, next) -> <v5>
|
|
magic[LOOP_RANGE_ITERATION](1..2|<v5>) -> <v6>
|
|
w(i|<v6>)
|
|
mark(for (i in 1..2) { doSmth(i) })
|
|
L4 [body entry point]:
|
|
4 mark({ doSmth(i) })
|
|
r(i) -> <v7>
|
|
mark(doSmth(i))
|
|
call(doSmth(i), doSmth|<v7>) -> <v8>
|
|
3 jmp(L2) NEXT:[mark(1..2)]
|
|
L3 [loop exit point]:
|
|
L5 [body exit point]:
|
|
read (Unit) PREV:[jmp?(L3)]
|
|
L1:
|
|
1 <END> NEXT:[<SINK>]
|
|
error:
|
|
<ERROR> PREV:[]
|
|
sink:
|
|
<SINK> PREV:[<ERROR>, <END>]
|
|
=====================
|
|
== doSmth ==
|
|
fun doSmth(i: Int) {}
|
|
---------------------
|
|
L0:
|
|
1 <START>
|
|
v(i: Int)
|
|
magic[FAKE_INITIALIZER](i: Int) -> <v0>
|
|
w(i|<v0>)
|
|
2 mark({})
|
|
read (Unit)
|
|
L1:
|
|
1 <END> NEXT:[<SINK>]
|
|
error:
|
|
<ERROR> PREV:[]
|
|
sink:
|
|
<SINK> PREV:[<ERROR>, <END>]
|
|
=====================
|