Files
kotlin-fork/compiler/testData/cfg/controlStructures/breakContinueInTryFinally.instructions
T
Mikhail Glukhikh f8039249c6 CFA: additional jumps to catch / finally generated in the end of try / before exits from try #KT-5469 Fixed
Also #KT-13612 Fixed
(cherry picked from commit 7c188b3)
2016-08-31 19:28:09 +03:00

210 lines
14 KiB
Plaintext
Vendored

== 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 })
jmp?(L7) NEXT:[mark({ break }), mark({ break })]
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?(L7) NEXT:[mark({ break }), jmp(L15)] PREV:[]
- jmp(L15) NEXT:[mark({ break })] PREV:[]
L7 [onExceptionToFinallyBlock]:
6 mark({ break }) PREV:[jmp?(L7), 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 })
jmp?(L7) NEXT:[mark({ return "OK" }), mark({ return "OK" })]
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?(L7) NEXT:[mark({ return "OK" }), jmp(L15)] PREV:[]
- jmp(L15) NEXT:[mark({ return "OK" })] PREV:[]
L7 [onExceptionToFinallyBlock]:
6 mark({ return "OK" }) PREV:[jmp?(L7), 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>]
=====================
== baz ==
fun baz(): String {
outer@while (true) {
try {
inner@while (true) {
continue@inner
}
} finally {
return "OK"
}
}
}
---------------------
L0:
1 <START>
2 mark({ outer@while (true) { try { inner@while (true) { continue@inner } } finally { return "OK" } } })
mark(outer@while (true) { try { inner@while (true) { continue@inner } } finally { return "OK" } })
L2 [loop entry point]:
L6 [condition entry point]:
r(true) -> <v0>
mark(while (true) { try { inner@while (true) { continue@inner } } finally { return "OK" } })
magic[VALUE_CONSUMER](true|<v0>) -> <v1>
L4 [body entry point]:
3 mark({ try { inner@while (true) { continue@inner } } finally { return "OK" } })
mark(try { inner@while (true) { continue@inner } } finally { return "OK" })
jmp?(L7) NEXT:[mark({ return "OK" }), mark({ inner@while (true) { continue@inner } })]
4 mark({ inner@while (true) { continue@inner } })
mark(inner@while (true) { continue@inner })
L8 [loop entry point]:
L12 [condition entry point]:
r(true) -> <v2> PREV:[mark(inner@while (true) { continue@inner }), jmp(L12)]
mark(while (true) { continue@inner })
magic[VALUE_CONSUMER](true|<v2>) -> <v3>
L10 [body entry point]:
5 mark({ continue@inner })
jmp(L12) NEXT:[r(true) -> <v2>]
- 4 jmp(L8) NEXT:[r(true) -> <v2>] PREV:[]
L9 [loop exit point]:
L11 [body exit point]:
- read (Unit) PREV:[]
- 3 jmp?(L7) NEXT:[mark({ return "OK" }), jmp(L13)] PREV:[]
- jmp(L13) NEXT:[mark({ return "OK" })] PREV:[]
L7 [onExceptionToFinallyBlock]:
L14 [start finally]:
4 mark({ return "OK" }) PREV:[jmp?(L7)]
mark("OK")
r("OK") -> <v6>
ret(*|<v6>) L1 NEXT:[<END>]
L15 [finish finally]:
- 3 jmp(error) NEXT:[<ERROR>] PREV:[]
L13 [skipFinallyToErrorBlock]:
L16 [copy of L7, onExceptionToFinallyBlock]:
- 4 mark({ return "OK" }) PREV:[]
- mark("OK") PREV:[]
- r("OK") -> <v6> PREV:[]
- ret(*|<v6>) L1 NEXT:[<END>] PREV:[]
- 3 merge(try { inner@while (true) { continue@inner } } finally { return "OK" }|!<v5>) -> <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(*|<v6>) L1]
error:
<ERROR> PREV:[]
sink:
<SINK> PREV:[<ERROR>, <END>]
=====================