[JVM_IR] Use direct field access to backing fields on current class.
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.
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
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
|
||||
Reference in New Issue
Block a user