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
@@ -15,29 +15,3 @@ MODULE lib
[]
K2
[kotlin/script/templates/standard/ScriptTemplateWithArgs]
MODULE main
CLASS TestKt.class
Annotation: class.invisibleAnnotations
K1
@Lkotlin/jvm/internal/SourceDebugExtension;( value: #{ SMAP
test.kt
Kotlin
*S Kotlin
*F
+ 1 test.kt
TestKt
+ 2 ArrayIntrinsics.kt
kotlin/ArrayIntrinsicsKt
*L
1#1,29:1
26#2:30
*S KotlinDebug
*F
+ 1 test.kt
TestKt
*L
22#1:30
*E
} )
K2
---
@@ -3,7 +3,7 @@
// IGNORE_LIGHT_ANALYSIS
// !LANGUAGE: -SkipStandaloneScriptsInSourceRoots
// WITH_STDLIB
// JVM_ABI_K1_K2_DIFF: KT-63963, KT-63960, KT-62465
// JVM_ABI_K1_K2_DIFF: KT-63963, KT-63960
// Although this test works in K1 just fine, it is named with the suffix K2 to show that the demonstrated method is the only one
// available so far to call a script from another module.
@@ -1,29 +1,4 @@
MODULE main
CLASS MainKt.class
Annotation: class.invisibleAnnotations
K1
@Lkotlin/jvm/internal/SourceDebugExtension;( value: #{ SMAP
main.kt
Kotlin
*S Kotlin
*F
+ 1 main.kt
MainKt
+ 2 ArrayIntrinsics.kt
kotlin/ArrayIntrinsicsKt
*L
1#1,50:1
26#2:51
*S KotlinDebug
*F
+ 1 main.kt
MainKt
*L
42#1:51
*E
} )
K2
---
CLASS Script.class
CLASS METADATA
K1
@@ -1,6 +1,6 @@
// TARGET_BACKEND: JVM_IR
// IGNORE_LIGHT_ANALYSIS
// JVM_ABI_K1_K2_DIFF: KT-62465, KT-63960
// JVM_ABI_K1_K2_DIFF: KT-63960
// LANGUAGE: +ReferencesToSyntheticJavaProperties
// LANGUAGE: -SkipStandaloneScriptsInSourceRoots
// WITH_STDLIB