Fix of getCorrespondingLoop for complex loop / try-finally trees #KT-8246 Fixed
This commit is contained in:
+137
@@ -0,0 +1,137 @@
|
||||
== foo ==
|
||||
fun foo() {
|
||||
outer@while (true) {
|
||||
try {
|
||||
while (true) {
|
||||
continue@outer
|
||||
}
|
||||
} finally {
|
||||
break
|
||||
}
|
||||
}
|
||||
println("OK")
|
||||
}
|
||||
---------------------
|
||||
L0:
|
||||
1 <START>
|
||||
2 mark({ outer@while (true) { try { while (true) { continue@outer } } finally { break } } println("OK") })
|
||||
mark(outer@while (true) { try { while (true) { continue@outer } } finally { break } })
|
||||
L2 [loop entry point]:
|
||||
L6 [condition entry point]:
|
||||
r(true) -> <v0>
|
||||
mark(while (true) { try { while (true) { continue@outer } } finally { break } })
|
||||
magic[VALUE_CONSUMER](true|<v0>) -> <v1>
|
||||
L4 [body entry point]:
|
||||
3 mark({ try { while (true) { continue@outer } } finally { break } })
|
||||
mark(try { while (true) { continue@outer } } finally { break })
|
||||
jmp?(L7) NEXT:[mark({ break }), mark({ while (true) { continue@outer } })]
|
||||
4 mark({ while (true) { continue@outer } })
|
||||
L8 [loop entry point]:
|
||||
L12 [condition entry point]:
|
||||
r(true) -> <v2>
|
||||
mark(while (true) { continue@outer })
|
||||
magic[VALUE_CONSUMER](true|<v2>) -> <v3>
|
||||
L10 [body entry point]:
|
||||
5 mark({ continue@outer })
|
||||
L13 [start finally]:
|
||||
6 mark({ break })
|
||||
jmp(L3) NEXT:[read (Unit)]
|
||||
L14 [finish finally]:
|
||||
- 5 jmp(L6) NEXT:[r(true) -> <v0>] PREV:[]
|
||||
- 4 jmp(L8) NEXT:[r(true) -> <v2>] PREV:[]
|
||||
L9 [loop exit point]:
|
||||
L11 [body exit point]:
|
||||
- read (Unit) PREV:[]
|
||||
- 3 jmp(L15) NEXT:[mark({ break })] PREV:[]
|
||||
L7 [onExceptionToFinallyBlock]:
|
||||
6 mark({ break }) PREV:[jmp?(L7)]
|
||||
jmp(L3) NEXT:[read (Unit)]
|
||||
- 3 jmp(error) NEXT:[<ERROR>] PREV:[]
|
||||
L15 [skipFinallyToErrorBlock]:
|
||||
- 6 mark({ break }) PREV:[]
|
||||
- jmp(L3) NEXT:[read (Unit)] PREV:[]
|
||||
- 3 merge(try { while (true) { continue@outer } } finally { break }|!<v6>) -> <v7> PREV:[]
|
||||
- 2 jmp(L2) NEXT:[r(true) -> <v0>] PREV:[]
|
||||
L3 [loop exit point]:
|
||||
L5 [body exit point]:
|
||||
read (Unit) PREV:[jmp(L3), jmp(L3)]
|
||||
mark("OK")
|
||||
r("OK") -> <v9>
|
||||
mark(println("OK"))
|
||||
magic[UNRESOLVED_CALL](println("OK")|<v9>, !<v10>) -> <v11>
|
||||
L1:
|
||||
1 <END> NEXT:[<SINK>]
|
||||
error:
|
||||
<ERROR> PREV:[]
|
||||
sink:
|
||||
<SINK> PREV:[<ERROR>, <END>]
|
||||
=====================
|
||||
== bar ==
|
||||
fun bar(): String {
|
||||
outer@while (true) {
|
||||
try {
|
||||
while (true) {
|
||||
continue@outer
|
||||
}
|
||||
} finally {
|
||||
return "OK"
|
||||
}
|
||||
}
|
||||
}
|
||||
---------------------
|
||||
L0:
|
||||
1 <START>
|
||||
2 mark({ outer@while (true) { try { while (true) { continue@outer } } finally { return "OK" } } })
|
||||
mark(outer@while (true) { try { while (true) { continue@outer } } finally { return "OK" } })
|
||||
L2 [loop entry point]:
|
||||
L6 [condition entry point]:
|
||||
r(true) -> <v0>
|
||||
mark(while (true) { try { while (true) { continue@outer } } finally { return "OK" } })
|
||||
magic[VALUE_CONSUMER](true|<v0>) -> <v1>
|
||||
L4 [body entry point]:
|
||||
3 mark({ try { while (true) { continue@outer } } finally { return "OK" } })
|
||||
mark(try { while (true) { continue@outer } } finally { return "OK" })
|
||||
jmp?(L7) NEXT:[mark({ return "OK" }), mark({ while (true) { continue@outer } })]
|
||||
4 mark({ while (true) { continue@outer } })
|
||||
L8 [loop entry point]:
|
||||
L12 [condition entry point]:
|
||||
r(true) -> <v2>
|
||||
mark(while (true) { continue@outer })
|
||||
magic[VALUE_CONSUMER](true|<v2>) -> <v3>
|
||||
L10 [body entry point]:
|
||||
5 mark({ continue@outer })
|
||||
L13 [start finally]:
|
||||
6 mark({ return "OK" })
|
||||
mark("OK")
|
||||
r("OK") -> <v4>
|
||||
ret(*|<v4>) L1 NEXT:[<END>]
|
||||
L14 [finish finally]:
|
||||
- 5 jmp(L6) NEXT:[r(true) -> <v0>] PREV:[]
|
||||
- 4 jmp(L8) NEXT:[r(true) -> <v2>] PREV:[]
|
||||
L9 [loop exit point]:
|
||||
L11 [body exit point]:
|
||||
- read (Unit) PREV:[]
|
||||
- 3 jmp(L15) NEXT:[mark({ return "OK" })] PREV:[]
|
||||
L7 [onExceptionToFinallyBlock]:
|
||||
6 mark({ return "OK" }) PREV:[jmp?(L7)]
|
||||
mark("OK")
|
||||
r("OK") -> <v4>
|
||||
ret(*|<v4>) L1 NEXT:[<END>]
|
||||
- 3 jmp(error) NEXT:[<ERROR>] PREV:[]
|
||||
L15 [skipFinallyToErrorBlock]:
|
||||
- 6 mark({ return "OK" }) PREV:[]
|
||||
- mark("OK") PREV:[]
|
||||
- r("OK") -> <v4> PREV:[]
|
||||
- ret(*|<v4>) L1 NEXT:[<END>] PREV:[]
|
||||
- 3 merge(try { while (true) { continue@outer } } finally { return "OK" }|!<v7>) -> <v8> PREV:[]
|
||||
- 2 jmp(L2) NEXT:[r(true) -> <v0>] PREV:[]
|
||||
L3 [loop exit point]:
|
||||
L5 [body exit point]:
|
||||
- read (Unit) PREV:[]
|
||||
L1:
|
||||
1 <END> NEXT:[<SINK>] PREV:[ret(*|<v4>) L1, ret(*|<v4>) L1]
|
||||
error:
|
||||
<ERROR> PREV:[]
|
||||
sink:
|
||||
<SINK> PREV:[<ERROR>, <END>]
|
||||
=====================
|
||||
Reference in New Issue
Block a user