JVM_IR KT-45103 optimize direct invoke for lambdas and callable refs

This commit is contained in:
Dmitry Petrov
2021-04-26 17:17:25 +03:00
committed by teamcityserver
parent bfb1a06f3d
commit 851980e36f
124 changed files with 1340 additions and 324 deletions
@@ -1,6 +1,7 @@
class A {
fun <T> eval(f: () -> T) = f()
private var foo = 1;
class A {
private var foo = 1
fun `access$getFoo$p`(a: A): Int = 1
fun `access$setFoo$p`(a: A, d: Int) {}
@@ -21,10 +22,10 @@ class A {
get() = field
fun test() {
{
foo = 2;
eval {
foo = 2
foo
}()
}
}
fun `access$getFoo$p`(p: A.Companion): Int = 1
@@ -32,9 +33,9 @@ class A {
}
fun test() {
{
eval {
foo = 2;
foo + bar
}()
}
}
}
@@ -1,39 +1,39 @@
compiler/testData/cli/jvm/syntheticAccessorForPropertiesSignatureClash.kt:1:7: error: platform declaration clash: The following declarations have the same JVM signature (access$getFoo$p(LA;)I):
compiler/testData/cli/jvm/syntheticAccessorForPropertiesSignatureClash.kt:3:7: error: platform declaration clash: The following declarations have the same JVM signature (access$getFoo$p(LA;)I):
fun `access$getFoo$p`(`$this`: A): Int defined in A
fun `access$getFoo$p`(a: A): Int defined in A
class A {
^
compiler/testData/cli/jvm/syntheticAccessorForPropertiesSignatureClash.kt:1:7: error: platform declaration clash: The following declarations have the same JVM signature (access$setFoo$p(LA;I)V):
compiler/testData/cli/jvm/syntheticAccessorForPropertiesSignatureClash.kt:3:7: error: platform declaration clash: The following declarations have the same JVM signature (access$setFoo$p(LA;I)V):
fun `access$setFoo$p`(`$this`: A, `<set-?>`: Int): Unit defined in A
fun `access$setFoo$p`(a: A, d: Int): Unit defined in A
class A {
^
compiler/testData/cli/jvm/syntheticAccessorForPropertiesSignatureClash.kt:1:7: error: platform declaration clash: The following declarations have the same JVM signature (access$getFoo$cp()I):
compiler/testData/cli/jvm/syntheticAccessorForPropertiesSignatureClash.kt:3:7: error: platform declaration clash: The following declarations have the same JVM signature (access$getFoo$cp()I):
fun `access$getFoo$cp`(): Int defined in A
fun `access$getFoo$cp`(): Int defined in A
class A {
^
compiler/testData/cli/jvm/syntheticAccessorForPropertiesSignatureClash.kt:1:7: error: platform declaration clash: The following declarations have the same JVM signature (access$setFoo$cp(I)V):
compiler/testData/cli/jvm/syntheticAccessorForPropertiesSignatureClash.kt:3:7: error: platform declaration clash: The following declarations have the same JVM signature (access$setFoo$cp(I)V):
fun `access$setFoo$cp`(`<set-?>`: Int): Unit defined in A
fun `access$setFoo$cp`(d: Int): Unit defined in A
class A {
^
compiler/testData/cli/jvm/syntheticAccessorForPropertiesSignatureClash.kt:5:5: error: platform declaration clash: The following declarations have the same JVM signature (access$getFoo$p(LA;)I):
compiler/testData/cli/jvm/syntheticAccessorForPropertiesSignatureClash.kt:6:5: error: platform declaration clash: The following declarations have the same JVM signature (access$getFoo$p(LA;)I):
fun `access$getFoo$p`(`$this`: A): Int defined in A
fun `access$getFoo$p`(a: A): Int defined in A
fun `access$getFoo$p`(a: A): Int = 1
^
compiler/testData/cli/jvm/syntheticAccessorForPropertiesSignatureClash.kt:6:5: error: platform declaration clash: The following declarations have the same JVM signature (access$setFoo$p(LA;I)V):
compiler/testData/cli/jvm/syntheticAccessorForPropertiesSignatureClash.kt:7:5: error: platform declaration clash: The following declarations have the same JVM signature (access$setFoo$p(LA;I)V):
fun `access$setFoo$p`(`$this`: A, `<set-?>`: Int): Unit defined in A
fun `access$setFoo$p`(a: A, d: Int): Unit defined in A
fun `access$setFoo$p`(a: A, d: Int) {}
^
compiler/testData/cli/jvm/syntheticAccessorForPropertiesSignatureClash.kt:9:5: error: platform declaration clash: The following declarations have the same JVM signature (access$getFoo$cp()I):
compiler/testData/cli/jvm/syntheticAccessorForPropertiesSignatureClash.kt:10:5: error: platform declaration clash: The following declarations have the same JVM signature (access$getFoo$cp()I):
fun `access$getFoo$cp`(): Int defined in A
fun `access$getFoo$cp`(): Int defined in A
fun `access$getFoo$cp`(): Int = 1
^
compiler/testData/cli/jvm/syntheticAccessorForPropertiesSignatureClash.kt:10:5: error: platform declaration clash: The following declarations have the same JVM signature (access$setFoo$cp(I)V):
compiler/testData/cli/jvm/syntheticAccessorForPropertiesSignatureClash.kt:11:5: error: platform declaration clash: The following declarations have the same JVM signature (access$setFoo$cp(I)V):
fun `access$setFoo$cp`(`<set-?>`: Int): Unit defined in A
fun `access$setFoo$cp`(d: Int): Unit defined in A
fun `access$setFoo$cp`(d: Int) {}
@@ -1,25 +1,25 @@
class A {
fun <T> eval(f: () -> T) = f()
private var foo = 1;
class A {
private var foo = 1
fun `access$getFoo$p`(a: A): Int = 1
fun `access$setFoo$p`(a: A, d: Int) {}
private fun getFoo() = 1;
private fun getFoo() = 1
private fun setFoo(i: Int) {}
fun `access$getFoo`(a: A): Int = 1
fun `access$setFoo`(a: A, d: Int) {}
fun test() {
{
foo = 2;
eval {
foo = 2
foo
}();
{
}
eval {
setFoo(2)
getFoo();
}()
getFoo()
}
}
}
@@ -1,39 +1,39 @@
compiler/testData/cli/jvm/syntheticAccessorPropertyAndFunSignatureClash.kt:1:7: error: platform declaration clash: The following declarations have the same JVM signature (access$getFoo$p(LA;)I):
compiler/testData/cli/jvm/syntheticAccessorPropertyAndFunSignatureClash.kt:3:7: error: platform declaration clash: The following declarations have the same JVM signature (access$getFoo$p(LA;)I):
fun `access$getFoo$p`(`$this`: A): Int defined in A
fun `access$getFoo$p`(a: A): Int defined in A
class A {
^
compiler/testData/cli/jvm/syntheticAccessorPropertyAndFunSignatureClash.kt:1:7: error: platform declaration clash: The following declarations have the same JVM signature (access$setFoo$p(LA;I)V):
compiler/testData/cli/jvm/syntheticAccessorPropertyAndFunSignatureClash.kt:3:7: error: platform declaration clash: The following declarations have the same JVM signature (access$setFoo$p(LA;I)V):
fun `access$setFoo$p`(`$this`: A, `<set-?>`: Int): Unit defined in A
fun `access$setFoo$p`(a: A, d: Int): Unit defined in A
class A {
^
compiler/testData/cli/jvm/syntheticAccessorPropertyAndFunSignatureClash.kt:1:7: error: platform declaration clash: The following declarations have the same JVM signature (access$getFoo(LA;)I):
compiler/testData/cli/jvm/syntheticAccessorPropertyAndFunSignatureClash.kt:3:7: error: platform declaration clash: The following declarations have the same JVM signature (access$getFoo(LA;)I):
fun `access$getFoo`(`$this`: A): Int defined in A
fun `access$getFoo`(a: A): Int defined in A
class A {
^
compiler/testData/cli/jvm/syntheticAccessorPropertyAndFunSignatureClash.kt:1:7: error: platform declaration clash: The following declarations have the same JVM signature (access$setFoo(LA;I)V):
compiler/testData/cli/jvm/syntheticAccessorPropertyAndFunSignatureClash.kt:3:7: error: platform declaration clash: The following declarations have the same JVM signature (access$setFoo(LA;I)V):
fun `access$setFoo`(`$this`: A, i: Int): Unit defined in A
fun `access$setFoo`(a: A, d: Int): Unit defined in A
class A {
^
compiler/testData/cli/jvm/syntheticAccessorPropertyAndFunSignatureClash.kt:5:5: error: platform declaration clash: The following declarations have the same JVM signature (access$getFoo$p(LA;)I):
compiler/testData/cli/jvm/syntheticAccessorPropertyAndFunSignatureClash.kt:6:5: error: platform declaration clash: The following declarations have the same JVM signature (access$getFoo$p(LA;)I):
fun `access$getFoo$p`(`$this`: A): Int defined in A
fun `access$getFoo$p`(a: A): Int defined in A
fun `access$getFoo$p`(a: A): Int = 1
^
compiler/testData/cli/jvm/syntheticAccessorPropertyAndFunSignatureClash.kt:6:5: error: platform declaration clash: The following declarations have the same JVM signature (access$setFoo$p(LA;I)V):
compiler/testData/cli/jvm/syntheticAccessorPropertyAndFunSignatureClash.kt:7:5: error: platform declaration clash: The following declarations have the same JVM signature (access$setFoo$p(LA;I)V):
fun `access$setFoo$p`(`$this`: A, `<set-?>`: Int): Unit defined in A
fun `access$setFoo$p`(a: A, d: Int): Unit defined in A
fun `access$setFoo$p`(a: A, d: Int) {}
^
compiler/testData/cli/jvm/syntheticAccessorPropertyAndFunSignatureClash.kt:11:5: error: platform declaration clash: The following declarations have the same JVM signature (access$getFoo(LA;)I):
compiler/testData/cli/jvm/syntheticAccessorPropertyAndFunSignatureClash.kt:12:5: error: platform declaration clash: The following declarations have the same JVM signature (access$getFoo(LA;)I):
fun `access$getFoo`(`$this`: A): Int defined in A
fun `access$getFoo`(a: A): Int defined in A
fun `access$getFoo`(a: A): Int = 1
^
compiler/testData/cli/jvm/syntheticAccessorPropertyAndFunSignatureClash.kt:12:5: error: platform declaration clash: The following declarations have the same JVM signature (access$setFoo(LA;I)V):
compiler/testData/cli/jvm/syntheticAccessorPropertyAndFunSignatureClash.kt:13:5: error: platform declaration clash: The following declarations have the same JVM signature (access$setFoo(LA;I)V):
fun `access$setFoo`(`$this`: A, i: Int): Unit defined in A
fun `access$setFoo`(a: A, d: Int): Unit defined in A
fun `access$setFoo`(a: A, d: Int) {}