JVM IR: Produce correct generic signatures for special bridge methods

This commit is contained in:
Steven Schäfer
2020-07-02 10:58:03 +02:00
committed by Alexander Udalov
parent c16b548dff
commit 9d63412b3e
12 changed files with 308 additions and 89 deletions
@@ -90,18 +90,33 @@ fun box(
}
/*
16 INVOKEVIRTUAL A[0-9]+.removeAt \(I\) -> calls in bridges with signature `public final bridge remove\(I\)` + 7 calls from `public synthetic bridge remove\(I\)Ljava/lang/Object;`
9 INVOKEVIRTUAL A[0-9]+\.remove \(I\) -> calls to A1-A9.removeAt
1 INVOKEINTERFACE A9\.remove \(I\) -> call A9.removeAt
1 INVOKEINTERFACE A9\.remove \(Ljava/lang/Object;\) -> call A9.remove
On the JVM backend we have:
16 INVOKEVIRTUAL A[0-9]+.removeAt \(I\) -> calls in bridges with signature `public final bridge remove\(I\)` + 7 calls from `public synthetic bridge remove\(I\)Ljava/lang/Object;`
9 INVOKEVIRTUAL A[0-9]+\.remove \(I\) -> calls to A1-A9.removeAt
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;`
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.
*/
// 16 INVOKEVIRTUAL A[0-9]+.removeAt \(I\)
// 9 INVOKEVIRTUAL A[0-9]+\.remove \(I\)
// 1 INVOKEINTERFACE A9\.remove \(I\)
// 1 INVOKEINTERFACE A9\.remove \(Ljava/lang/Object;\)
// 1 INVOKEVIRTUAL A10\.remove \(I\)
// 2 INVOKEINTERFACE java\/util\/List.remove \(I\)
// 2 INVOKEINTERFACE java\/util\/List.remove \(Ljava/lang/Object;\)
// JVM_TEMPLATES:
// 16 INVOKEVIRTUAL A[0-9]+.removeAt \(I\)
// 9 INVOKEVIRTUAL A[0-9]+\.remove \(I\)
// 1 INVOKEVIRTUAL A10\.remove \(I\)
// JVM_IR_TEMPLATES:
// 9 INVOKEVIRTUAL A[0-9]+.removeAt \(I\)
// 17 INVOKEVIRTUAL A[0-9]+\.remove \(I\)
// 2 INVOKEVIRTUAL A10\.remove \(I\)
@@ -27,4 +27,14 @@ public class TestMap<K, V> implements Map<K, V> {
class MyMap: TestMap<String, String>()
// The Kotlin version of getOrDefault, which redirects to the default implementation in java.util.Map
// 1 public bridge getOrDefault\(Ljava/lang/String;Ljava/lang/String;\)Ljava/lang/String;
// Test expectations differ between JVM and JVM IR backends, because of KT-40277. This should be revisited once KT-40277 is resolved.
// JVM_TEMPLATES:
// 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;