c922484758
The current backend uses direct field access to the backing field
instead of calling the companion object accessor, which calls
an accessibility bridge, which then gets the field for code such as:
```
class A {
companion object {
val s: String = "OK"
}
// f uses direct access to the A.s backing field.
fun f() = s
}
```
This change does the same for the IR backend.
23 lines
475 B
Kotlin
Vendored
23 lines
475 B
Kotlin
Vendored
class A {
|
|
companion object {
|
|
val s: String
|
|
get() = "Ok"
|
|
var v : String
|
|
get() = "NOT OK"
|
|
set(value) {}
|
|
}
|
|
|
|
inline fun f(): String = s
|
|
|
|
inline fun g() {
|
|
v = "OK"
|
|
}
|
|
}
|
|
|
|
// No backing field on A and all accesses call the getter/setter.
|
|
// 0 GETSTATIC A.s
|
|
// 0 PUTSTATIC A.v
|
|
|
|
// One `getS` call in `f` and one `setV` call in `g`
|
|
// 1 INVOKEVIRTUAL A\$Companion.getS
|
|
// 1 INVOKEVIRTUAL A\$Companion.setV |