JVM_IR: optimize property accesses in inline lambdas and private funs

This commit is contained in:
pyos
2021-07-07 14:37:02 +02:00
committed by Alexander Udalov
parent fc013c6b9f
commit e9d5d9da48
4 changed files with 179 additions and 187 deletions
+13
View File
@@ -33,9 +33,22 @@ class Example
b3 = 1
b4 = 1
b5 = 1
foo { a1 = 1 }
bar()
}
private inline fun bar() { a1 = 1 }
}
inline fun foo(x: () -> Unit) = x()
// Every property should be accessed directly in this example because they all are final class properties with default accessors
// 0 INVOKESPECIAL Example\.set
// JVM_TEMPLATES
// ...except the access in `private inline fun`.
// 2 INVOKEVIRTUAL Example\.set
// JVM_IR_TEMPLATES
// ...including the access in `private inline fun` which we know is only called from `init`.
// 0 INVOKEVIRTUAL Example\.set