Do not restore stack in default handler for try-finally
It never terminates, so the corresponding value on stack can't be used. However, if this happens in an inlined lambda argument, the inliner is unable to remove the corresponding ALOAD instruction (because default handler never terminates, and thus corresponding ALOAD is not used for lambda invocation). KT-17573 try-finally expression in inlined function parameter argument fails with VerifyError
This commit is contained in:
+6
@@ -0,0 +1,6 @@
|
||||
fun zap(s: String) = s
|
||||
|
||||
inline fun tryZap(string: String, fn: (String) -> String) =
|
||||
fn(try { zap(string) } finally {})
|
||||
|
||||
fun box(): String = tryZap("OK") { it }
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
fun zap(s: String) = s
|
||||
|
||||
inline fun tryZap1(string: String, fn: (String) -> String) =
|
||||
fn(
|
||||
try { zap(string) } finally {
|
||||
try { zap(string) } finally { }
|
||||
}
|
||||
)
|
||||
|
||||
inline fun tryZap2(string: String, fn: (String) -> String) =
|
||||
fn(
|
||||
try { zap(string) } finally {
|
||||
try { zap(string) } catch (e: Exception) { }
|
||||
}
|
||||
)
|
||||
|
||||
fun box(): String = tryZap1("O") { it } + tryZap2("K") { it }
|
||||
Reference in New Issue
Block a user