[Wasm] Improve interface method dispatch
- Use typed Wasm tables for each interface method to avoid runtime function type check - Use linear search by implemented interface rather than by individual virtual function signature
This commit is contained in:
+3
@@ -1,3 +1,6 @@
|
||||
// DONT_TARGET_EXACT_BACKEND: WASM
|
||||
// WASM_MUTE_REASON: IMPLICIT_INTERFACE_METHOD_IMPL
|
||||
|
||||
interface Named {
|
||||
val name: String
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// DONT_TARGET_EXACT_BACKEND: WASM
|
||||
// WASM_MUTE_REASON: SAM_CONVERSIONS
|
||||
// !LANGUAGE: +NewInference +FunctionalInterfaceConversion +SamConversionPerArgument +SamConversionForKotlinFunctions
|
||||
|
||||
fun interface Foo {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// DONT_TARGET_EXACT_BACKEND: WASM
|
||||
// WASM_MUTE_REASON: SAM_CONVERSIONS
|
||||
// !LANGUAGE: +NewInference +FunctionalInterfaceConversion +SamConversionPerArgument
|
||||
|
||||
fun interface MyRunnable {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// DONT_TARGET_EXACT_BACKEND: WASM
|
||||
// WASM_MUTE_REASON: SAM_CONVERSIONS
|
||||
// KOTLIN_CONFIGURATION_FLAGS: +JVM.NO_OPTIMIZED_CALLABLE_REFERENCES
|
||||
|
||||
fun interface P {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// DONT_TARGET_EXACT_BACKEND: WASM
|
||||
// WASM_MUTE_REASON: SAM_CONVERSIONS
|
||||
// !LANGUAGE: +NewInference +FunctionalInterfaceConversion +SamConversionPerArgument +SamConversionForKotlinFunctions
|
||||
// WITH_RUNTIME
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// DONT_TARGET_EXACT_BACKEND: WASM
|
||||
// WASM_MUTE_REASON: SAM_CONVERSIONS
|
||||
// !LANGUAGE: +NewInference +FunctionalInterfaceConversion +SamConversionPerArgument +SamConversionForKotlinFunctions
|
||||
|
||||
// This test should check argument coercion between the SAM and the lambda.
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// DONT_TARGET_EXACT_BACKEND: WASM
|
||||
// WASM_MUTE_REASON: SAM_CONVERSIONS
|
||||
// !LANGUAGE: +NewInference +FunctionalInterfaceConversion +SamConversionPerArgument +SamConversionForKotlinFunctions
|
||||
// WITH_RUNTIME
|
||||
|
||||
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
// DONT_TARGET_EXACT_BACKEND: WASM
|
||||
// WASM_MUTE_REASON: SAM_CONVERSIONS
|
||||
// !LANGUAGE: +FunctionalInterfaceConversion
|
||||
|
||||
fun interface S {
|
||||
|
||||
+3
@@ -1,3 +1,6 @@
|
||||
// DONT_TARGET_EXACT_BACKEND: WASM
|
||||
// WASM_MUTE_REASON: SAM_CONVERSIONS
|
||||
|
||||
fun interface FunIFace<T, R> {
|
||||
fun call(ic: T): R
|
||||
}
|
||||
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
// DONT_TARGET_EXACT_BACKEND: WASM
|
||||
// WASM_MUTE_REASON: SAM_CONVERSIONS
|
||||
// !LANGUAGE: +InlineClasses
|
||||
|
||||
fun <T> underlying(a: IC): T = bar(a) {
|
||||
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
// DONT_TARGET_EXACT_BACKEND: WASM
|
||||
// WASM_MUTE_REASON: SAM_CONVERSIONS
|
||||
// !LANGUAGE: +InlineClasses
|
||||
|
||||
fun <T> underlying(a: IC): T = bar(a) {
|
||||
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
// DONT_TARGET_EXACT_BACKEND: WASM
|
||||
// WASM_MUTE_REASON: SAM_CONVERSIONS
|
||||
// !LANGUAGE: +InlineClasses
|
||||
|
||||
fun <T> underlying(a: IC): T = bar(a) {
|
||||
|
||||
Vendored
+2
@@ -1,3 +1,5 @@
|
||||
// DONT_TARGET_EXACT_BACKEND: WASM
|
||||
// WASM_MUTE_REASON: SAM_CONVERSIONS
|
||||
// !LANGUAGE: +InlineClasses
|
||||
|
||||
fun <T> underlying(a: IC): T = bar(a) {
|
||||
|
||||
Vendored
+2
@@ -1,3 +1,5 @@
|
||||
// DONT_TARGET_EXACT_BACKEND: WASM
|
||||
// WASM_MUTE_REASON: SAM_CONVERSIONS
|
||||
// !LANGUAGE: +InlineClasses
|
||||
|
||||
fun <T> underlying(a: IC): T = bar(a) {
|
||||
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
// DONT_TARGET_EXACT_BACKEND: WASM
|
||||
// WASM_MUTE_REASON: SAM_CONVERSIONS
|
||||
// !LANGUAGE: +InlineClasses
|
||||
// WITH_RUNTIME
|
||||
|
||||
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
// DONT_TARGET_EXACT_BACKEND: WASM
|
||||
// WASM_MUTE_REASON: SAM_CONVERSIONS
|
||||
// !LANGUAGE: +InlineClasses
|
||||
|
||||
fun <T> underlying(a: IC): T = bar(a) {
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// DONT_TARGET_EXACT_BACKEND: WASM
|
||||
// WASM_MUTE_REASON: IMPLICIT_INTERFACE_METHOD_IMPL
|
||||
|
||||
open class B {
|
||||
val name: String
|
||||
get() = "OK"
|
||||
|
||||
Reference in New Issue
Block a user