[K/N] Make instance a property not a field
This enables inlining machinery, and allows to avoid frame in simple cases.
This commit is contained in:
committed by
Space Team
parent
d3adfec2fb
commit
68f78f1e5f
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
object A {
|
||||
const val x = 5
|
||||
}
|
||||
|
||||
class B(val z:Int) {
|
||||
companion object {
|
||||
const val y = 7
|
||||
}
|
||||
}
|
||||
|
||||
object C {
|
||||
val x = listOf(1, 2, 3)
|
||||
}
|
||||
|
||||
// CHECK-LABEL: define i32 @"kfun:#f(){}kotlin.Int"()
|
||||
// CHECK-NOT: EnterFrame
|
||||
fun f() = A.x + B.y
|
||||
// CHECK: {{^}}epilogue:
|
||||
|
||||
// test that assumption on how EnterFrame looks like is not broken
|
||||
// CHECK-LABEL: define void @"kfun:#g(){}"()
|
||||
// CHECK: EnterFrame
|
||||
fun g() {
|
||||
val x = C.x
|
||||
}
|
||||
// CHECK: {{^}}epilogue:
|
||||
|
||||
|
||||
fun main() {
|
||||
f()
|
||||
g()
|
||||
}
|
||||
Reference in New Issue
Block a user