JVM_IR more precise check for special bridges in super class

KT-41123
This commit is contained in:
Dmitry Petrov
2020-10-01 17:54:07 +03:00
parent cf5bd38bec
commit e018f2bd3e
19 changed files with 156 additions and 118 deletions
@@ -1,3 +1,5 @@
// IGNORE_BACKEND_FIR: JVM_IR
abstract class A1<T> : MutableList<T> {
override fun remove(x: T): Boolean = true
override fun removeAt(index: Int): T = null!!
@@ -99,8 +101,8 @@ On the JVM backend we have:
1 INVOKEVIRTUAL A10\.remove \(I\) -> one call in 'box' function
On the JVM IR backend we have:
9 INVOKEVIRTUAL A[0-9]+.removeAt \(I\) -> calls in non-synthetic bridges with signature `public final bridge remove(I)`
17 INVOKEVIRTUAL A[0-9]+\.remove \(I\) -> calls to A1-A9.removeAt + calls in synthetic bridges with signature `public synthetic bridge remove(I)Ljava/lang/Object;`
10 INVOKEVIRTUAL A[0-9]+.removeAt \(I\) -> calls in bridges with signature `public final bridge remove(I)`
15 INVOKEVIRTUAL A[0-9]+\.remove \(I\) -> calls to A1-A9.removeAt + calls in synthetic bridges with signature `public synthetic bridge remove(I)Ljava/lang/Object;`
2 INVOKEVIRTUAL A10\.remove \(I\) -> one call in 'box' function + call from synthetic `remove(I)` bridge
This currently differs because of KT-40277, and the test expectations should be revised once KT-40277 is resolved.
@@ -117,6 +119,21 @@ This currently differs because of KT-40277, and the test expectations should be
// 1 INVOKEVIRTUAL A10\.remove \(I\)
// JVM_IR_TEMPLATES:
// 9 INVOKEVIRTUAL A[0-9]+.removeAt \(I\)
// 17 INVOKEVIRTUAL A[0-9]+\.remove \(I\)
// 1 INVOKEVIRTUAL A1\.removeAt \(I\)
// 1 INVOKEVIRTUAL A2\.removeAt \(I\)
// 1 INVOKEVIRTUAL A3\.removeAt \(I\)
// 1 INVOKEVIRTUAL A4\.removeAt \(I\)
// 1 INVOKEVIRTUAL A5\.removeAt \(I\)
// 1 INVOKEVIRTUAL A6\.removeAt \(I\)
// 1 INVOKEVIRTUAL A8\.removeAt \(I\)
// 1 INVOKEVIRTUAL A10\.removeAt \(I\)
// 2 INVOKEVIRTUAL A7\.removeAt \(I\)
// ^ in:
// public final bridge remove(I)Ljava/lang/String;
// public synthetic bridge remove(I)Ljava/lang/Object;
// 10 INVOKEVIRTUAL A[0-9]+\.removeAt \(I\)
// 15 INVOKEVIRTUAL A[0-9]+\.remove \(I\)
// 2 INVOKEVIRTUAL A10\.remove \(I\)
+2 -2
View File
@@ -37,5 +37,5 @@ class MyMap: TestMap<String, String>()
// 1 public final bridge getOrDefault\(Ljava/lang/Object;Ljava/lang/Object;\)Ljava/lang/Object;
// JVM_IR_TEMPLATES:
// 1 public final bridge getOrDefault\(Ljava/lang/Object;Ljava/lang/String;\)Ljava/lang/String;
// 1 public synthetic bridge getOrDefault\(Ljava/lang/Object;Ljava/lang/Object;\)Ljava/lang/Object;
// 1 public bridge getOrDefault\(Ljava/lang/String;Ljava/lang/String;\)Ljava/lang/String;
// 1 public final bridge getOrDefault\(Ljava/lang/Object;Ljava/lang/String;\)Ljava/lang/String;