Generate 'nop' instruction on lambda call when everything on line is going to be eliminated by inliner (KT-6477)
(cherry picked from commit 462bdb2) #KT-6477 Fixed
This commit is contained in:
committed by
Nikolay Krasko
parent
708a0e3b5d
commit
87b628a3f7
+1
-1
@@ -23,4 +23,4 @@ fun simpleFunVoid(f: () -> Unit): Unit {
|
||||
return f()
|
||||
}
|
||||
|
||||
// 3 NOP
|
||||
// 5 NOP
|
||||
|
||||
Vendored
+14
@@ -0,0 +1,14 @@
|
||||
fun box() {
|
||||
lookAtMe {
|
||||
12
|
||||
}
|
||||
}
|
||||
|
||||
inline fun lookAtMe(f: () -> Int): Int {
|
||||
val a = 42
|
||||
a + f() // Even this line already has meaningful instraction nop is still generated
|
||||
return 13
|
||||
}
|
||||
|
||||
// TODO: Less NOPs is better
|
||||
// 2 NOP
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
fun box() {
|
||||
lookAtMe {
|
||||
val c = "c"
|
||||
}
|
||||
}
|
||||
|
||||
inline fun lookAtMe(f: (String) -> Unit) {
|
||||
val a = "a"
|
||||
f(a) // Should be no unneeded nops on this line, that might be generated for zero-parameters lambda
|
||||
}
|
||||
|
||||
// 2 NOP
|
||||
Reference in New Issue
Block a user