JVM IR: initialize enum entries without invokedynamic

#KT-57316 Fixed
This commit is contained in:
Alexander Udalov
2023-03-21 01:13:41 +01:00
committed by Space Team
parent 9c2c11f7e9
commit 562b27db4e
21 changed files with 31 additions and 95 deletions
@@ -3,5 +3,10 @@ enum class Foo {
open fun result() = "Fail"
}
// JVM_TEMPLATES
// There are two CHECKCASTs, one in Foo.valueOf and one in Foo.values
// 2 CHECKCAST
// JVM_IR_TEMPLATES
// For JVM IR, there's an additional checkcast of `$ENTRIES` to `[Ljava/lang/Enum;` in the static initializer.
// 3 CHECKCAST
+1 -1
View File
@@ -5,7 +5,7 @@ enum class MyEnum {
E
}
// 1 INVOKEDYNAMIC
// 0 INVOKEDYNAMIC
// 1 kotlin.enums.EnumEntries<MyEnum> getEntries\(\)
// 1 private final static synthetic Lkotlin/enums/EnumEntries; \$ENTRIES
// 1 public static getEntries\(\)Lkotlin/enums/EnumEntries;