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
55 lines
2.0 KiB
Plaintext
Vendored
55 lines
2.0 KiB
Plaintext
Vendored
== test ==
|
|
fun test(b: Boolean) {
|
|
for (i in 1..10) {
|
|
if (b) break;
|
|
continue;
|
|
}
|
|
}
|
|
---------------------
|
|
L0:
|
|
1 <START>
|
|
v(b: Boolean)
|
|
magic[FAKE_INITIALIZER](b: Boolean) -> <v0>
|
|
w(b|<v0>)
|
|
2 mark({ for (i in 1..10) { if (b) break; continue; } })
|
|
3 r(1) -> <v1>
|
|
r(10) -> <v2>
|
|
mark(1..10)
|
|
call(1..10, rangeTo|<v1>, <v2>) -> <v3>
|
|
mark(1..10)
|
|
call(1..10, iterator|<v3>) -> <v4>
|
|
v(i)
|
|
L2 [loop entry point]:
|
|
L6 [condition entry point]:
|
|
mark(1..10) PREV:[v(i), jmp(L6)]
|
|
call(1..10, hasNext) -> <v5>
|
|
jmp?(L3) NEXT:[read (Unit), mark(1..10)]
|
|
mark(1..10)
|
|
call(1..10, next) -> <v6>
|
|
magic[LOOP_RANGE_ITERATION](1..10|<v6>) -> <v7>
|
|
w(i|<v7>)
|
|
mark(for (i in 1..10) { if (b) break; continue; })
|
|
L4 [body entry point]:
|
|
4 mark({ if (b) break; continue; })
|
|
mark(if (b) break)
|
|
r(b) -> <v8>
|
|
jf(L7|<v8>) NEXT:[read (Unit), jmp(L3)]
|
|
jmp(L3) NEXT:[read (Unit)]
|
|
- jmp(L8) NEXT:[merge(if (b) break|!<v9>) -> <v10>] PREV:[]
|
|
L7 [else branch]:
|
|
read (Unit) PREV:[jf(L7|<v8>)]
|
|
L8 ['if' expression result]:
|
|
merge(if (b) break|!<v9>) -> <v10>
|
|
jmp(L6) NEXT:[mark(1..10)]
|
|
- 3 jmp(L2) NEXT:[mark(1..10)] PREV:[]
|
|
L3 [loop exit point]:
|
|
L5 [body exit point]:
|
|
read (Unit) PREV:[jmp?(L3), jmp(L3)]
|
|
L1:
|
|
1 <END> NEXT:[<SINK>]
|
|
error:
|
|
<ERROR> PREV:[]
|
|
sink:
|
|
<SINK> PREV:[<ERROR>, <END>]
|
|
=====================
|