JVM IR: initialize enum entries without invokedynamic
#KT-57316 Fixed
This commit is contained in:
committed by
Space Team
parent
9c2c11f7e9
commit
562b27db4e
-2
@@ -13,8 +13,6 @@ public class foo/Kotlin : java/lang/Enum {
|
||||
|
||||
public final static foo.Kotlin A
|
||||
|
||||
private final static foo.Kotlin[] $entries()
|
||||
|
||||
private final static foo.Kotlin[] $values()
|
||||
|
||||
static void <clinit>()
|
||||
|
||||
-1
@@ -11,7 +11,6 @@ public final enum class E {
|
||||
private synthetic final static field $ENTRIES: kotlin.enums.EnumEntries
|
||||
private synthetic final static field $VALUES: E[]
|
||||
public final enum static field X: E
|
||||
private synthetic final static method $entries(): E[]
|
||||
private synthetic final static method $values(): E[]
|
||||
static method <clinit>(): void
|
||||
private method <init>(p0: java.lang.String, p1: int): void
|
||||
|
||||
-1
@@ -11,7 +11,6 @@ public final enum class E {
|
||||
private synthetic final static field $ENTRIES: kotlin.enums.EnumEntries
|
||||
private synthetic final static field $VALUES: E[]
|
||||
public final enum static field X: E
|
||||
private synthetic final static method $entries(): E[]
|
||||
private synthetic final static method $values(): E[]
|
||||
static method <clinit>(): void
|
||||
private method <init>(p0: java.lang.String, p1: int): void
|
||||
|
||||
-1
@@ -16,7 +16,6 @@ public final enum class E {
|
||||
private synthetic final static field $VALUES: E[]
|
||||
public final enum static field NOT_OK: E
|
||||
public final enum static field OK: E
|
||||
private synthetic final static method $entries(): E[]
|
||||
private synthetic final static method $values(): E[]
|
||||
static method <clinit>(): void
|
||||
private method <init>(p0: java.lang.String, p1: int): void
|
||||
|
||||
Vendored
-1
@@ -25,7 +25,6 @@ public final enum class E {
|
||||
private synthetic final static field $VALUES: E[]
|
||||
public final enum static field NOT_OK: E
|
||||
public final enum static field OK: E
|
||||
private synthetic final static method $entries(): E[]
|
||||
private synthetic final static method $values(): E[]
|
||||
static method <clinit>(): void
|
||||
private method <init>(p0: java.lang.String, p1: int): void
|
||||
|
||||
Vendored
-1
@@ -13,7 +13,6 @@ public final enum class E {
|
||||
private synthetic final static field $VALUES: E[]
|
||||
public final static @org.jetbrains.annotations.NotNull field Companion: E$Companion
|
||||
public final enum static field X: E
|
||||
private synthetic final static method $entries(): E[]
|
||||
private synthetic final static method $values(): E[]
|
||||
static method <clinit>(): void
|
||||
private method <init>(p0: java.lang.String, p1: int): void
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
|
||||
// CHECK_BYTECODE_TEXT
|
||||
// JVM_IR_TEMPLATES
|
||||
// 2 java/lang/invoke/LambdaMetafactory
|
||||
// 1 java/lang/invoke/LambdaMetafactory
|
||||
|
||||
// FILE: enumValues.kt
|
||||
enum class ABC(val x: String = "") {
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
|
||||
// CHECK_BYTECODE_TEXT
|
||||
// JVM_IR_TEMPLATES
|
||||
// 2 java/lang/invoke/LambdaMetafactory
|
||||
// 1 java/lang/invoke/LambdaMetafactory
|
||||
|
||||
// FILE: enumValues.kt
|
||||
enum class ABC(val x: String = "") {
|
||||
|
||||
-1
@@ -6,7 +6,6 @@ public final enum class Test {
|
||||
public deprecated final enum static @kotlin.Deprecated(message="") field ENTRY1: Test
|
||||
public final enum static field ENTRY2: Test
|
||||
public deprecated final enum static @kotlin.Deprecated(message="") field ENTRY3: Test
|
||||
private synthetic final static method $entries(): Test[]
|
||||
private synthetic final static method $values(): Test[]
|
||||
static method <clinit>(): void
|
||||
private method <init>(p0: java.lang.String, p1: int): void
|
||||
|
||||
@@ -12,7 +12,6 @@ public final enum class SimpleEnum {
|
||||
public final enum static field A: SimpleEnum
|
||||
public final enum static field B: SimpleEnum
|
||||
public final enum static field C: SimpleEnum
|
||||
private synthetic final static method $entries(): SimpleEnum[]
|
||||
private synthetic final static method $values(): SimpleEnum[]
|
||||
static method <clinit>(): void
|
||||
private method <init>(p0: java.lang.String, p1: int): void
|
||||
@@ -28,7 +27,6 @@ public final enum class WithAnnotations {
|
||||
private synthetic final static field $VALUES: WithAnnotations[]
|
||||
public final enum static @Ann field A: WithAnnotations
|
||||
public final enum static @Ann field B: WithAnnotations
|
||||
private synthetic final static method $entries(): WithAnnotations[]
|
||||
private synthetic final static method $values(): WithAnnotations[]
|
||||
static method <clinit>(): void
|
||||
private method <init>(p0: java.lang.String, p1: int): void
|
||||
@@ -46,7 +44,6 @@ public final enum class WithConstructor {
|
||||
public final enum static field B: WithConstructor
|
||||
public final enum static field C: WithConstructor
|
||||
private final @org.jetbrains.annotations.NotNull field x: java.lang.String
|
||||
private synthetic final static method $entries(): WithConstructor[]
|
||||
private synthetic final static method $values(): WithConstructor[]
|
||||
static method <clinit>(): void
|
||||
private method <init>(p0: java.lang.String, p1: int, p2: java.lang.String): void
|
||||
@@ -71,7 +68,6 @@ public abstract enum class WithEntryClass {
|
||||
private synthetic final static field $VALUES: WithEntryClass[]
|
||||
public final enum static field A: WithEntryClass
|
||||
final inner class WithEntryClass$A
|
||||
private synthetic final static method $entries(): WithEntryClass[]
|
||||
private synthetic final static method $values(): WithEntryClass[]
|
||||
static method <clinit>(): void
|
||||
private method <init>(p0: java.lang.String, p1: int): void
|
||||
|
||||
@@ -12,7 +12,6 @@ public final enum class SimpleEnum {
|
||||
public final enum static field A: SimpleEnum
|
||||
public final enum static field B: SimpleEnum
|
||||
public final enum static field C: SimpleEnum
|
||||
private synthetic final static method $entries(): SimpleEnum[]
|
||||
private synthetic final static method $values(): SimpleEnum[]
|
||||
static method <clinit>(): void
|
||||
private method <init>(p0: java.lang.String, p1: int): void
|
||||
@@ -28,7 +27,6 @@ public final enum class WithAnnotations {
|
||||
private synthetic final static field $VALUES: WithAnnotations[]
|
||||
public final enum static @Ann field A: WithAnnotations
|
||||
public final enum static @Ann field B: WithAnnotations
|
||||
private synthetic final static method $entries(): WithAnnotations[]
|
||||
private synthetic final static method $values(): WithAnnotations[]
|
||||
static method <clinit>(): void
|
||||
private method <init>(p0: java.lang.String, p1: int): void
|
||||
@@ -46,7 +44,6 @@ public final enum class WithConstructor {
|
||||
public final enum static field B: WithConstructor
|
||||
public final enum static field C: WithConstructor
|
||||
private final @org.jetbrains.annotations.NotNull field x: java.lang.String
|
||||
private synthetic final static method $entries(): WithConstructor[]
|
||||
private synthetic final static method $values(): WithConstructor[]
|
||||
static method <clinit>(): void
|
||||
private method <init>(p0: java.lang.String, p1: int, p2: java.lang.String): void
|
||||
@@ -71,7 +68,6 @@ public abstract enum class WithEntryClass {
|
||||
private synthetic final static field $VALUES: WithEntryClass[]
|
||||
public final enum static field A: WithEntryClass
|
||||
final inner class WithEntryClass$A
|
||||
private synthetic final static method $entries(): WithEntryClass[]
|
||||
private synthetic final static method $values(): WithEntryClass[]
|
||||
static method <clinit>(): void
|
||||
private method <init>(p0: java.lang.String, p1: int): void
|
||||
|
||||
-1
@@ -34,7 +34,6 @@ public final enum class TestEnum {
|
||||
private synthetic final static field $VALUES: TestEnum[]
|
||||
public final enum static field ANSWER: TestEnum
|
||||
private final field z: int
|
||||
private synthetic final static method $entries(): TestEnum[]
|
||||
private synthetic final static method $values(): TestEnum[]
|
||||
static method <clinit>(): void
|
||||
private method <init>(p0: java.lang.String, p1: int, p2: int): void
|
||||
|
||||
@@ -13,7 +13,6 @@ public final enum class A$B$C {
|
||||
public static method valueOf(p0: java.lang.String): A$B$C
|
||||
public static @org.jetbrains.annotations.NotNull method getEntries(): kotlin.enums.EnumEntries
|
||||
private synthetic final static method $values(): A$B$C[]
|
||||
private synthetic final static method $entries(): A$B$C[]
|
||||
static method <clinit>(): void
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user