Fix IrFunction.isEmptyArray implementation

The previous one was incorrect for K1 since parent of top-level function
is `IrClass`, not `IrPackageFragment`.

The change is non-functional, K1 still worked correctly, but had to do
some extra work when inlining `emptyArray` calls and produces less
performant bytecode.
This commit is contained in:
vladislav.grechko
2024-02-21 14:04:07 +01:00
committed by Space Team
parent 224a4e1e3c
commit f32367d2c2
26 changed files with 70 additions and 219 deletions
@@ -0,0 +1,12 @@
// WITH_STDLIB
// TARGET_BACKEND: JVM_IR
// Checks if emptyArray call has been lowered
fun box(): String {
emptyArray<String>()
return "OK"
}
// CHECK_BYTECODE_TEXT
// 0 ISTORE 0
@@ -1,26 +0,0 @@
MODULE main
CLASS Kt17134Kt.class
Annotation: class.invisibleAnnotations
K1
@Lkotlin/jvm/internal/SourceDebugExtension;( value: #{ SMAP
kt17134.kt
Kotlin
*S Kotlin
*F
+ 1 kt17134.kt
Kt17134Kt
+ 2 ArrayIntrinsics.kt
kotlin/ArrayIntrinsicsKt
*L
1#1,19:1
26#2:20
*S KotlinDebug
*F
+ 1 kt17134.kt
Kt17134Kt
*L
16#1:20
*E
} )
K2
---
-2
View File
@@ -1,8 +1,6 @@
// WITH_STDLIB
// TARGET_BACKEND: JVM
// JVM_ABI_K1_K2_DIFF: KT-62465
object A {
@JvmStatic fun main(args: Array<String>) {
val b = arrayOf(arrayOf(""))