[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:
Svyatoslav Kuzmich
2020-12-13 20:55:40 +03:00
parent e7dc199ad7
commit b6ad1584c9
33 changed files with 318 additions and 172 deletions
@@ -1631,11 +1631,6 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
runTest("compiler/testData/codegen/box/callableReference/function/local/constructorWithInitializer.kt");
}
@TestMetadata("enumExtendsTrait.kt")
public void testEnumExtendsTrait() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/function/local/enumExtendsTrait.kt");
}
@TestMetadata("extension.kt")
public void testExtension() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/function/local/extension.kt");
@@ -5217,46 +5212,6 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
runTest("compiler/testData/codegen/box/funInterface/basicFunInterface.kt");
}
@TestMetadata("basicFunInterfaceConversion.kt")
public void testBasicFunInterfaceConversion() throws Exception {
runTest("compiler/testData/codegen/box/funInterface/basicFunInterfaceConversion.kt");
}
@TestMetadata("funConversionInVararg.kt")
public void testFunConversionInVararg() throws Exception {
runTest("compiler/testData/codegen/box/funInterface/funConversionInVararg.kt");
}
@TestMetadata("noOptimizedCallableReferences.kt")
public void testNoOptimizedCallableReferences() throws Exception {
runTest("compiler/testData/codegen/box/funInterface/noOptimizedCallableReferences.kt");
}
@TestMetadata("partialSam.kt")
public void testPartialSam() throws Exception {
runTest("compiler/testData/codegen/box/funInterface/partialSam.kt");
}
@TestMetadata("primitiveConversions.kt")
public void testPrimitiveConversions() throws Exception {
runTest("compiler/testData/codegen/box/funInterface/primitiveConversions.kt");
}
@TestMetadata("receiverEvaluatedOnce.kt")
public void testReceiverEvaluatedOnce() throws Exception {
runTest("compiler/testData/codegen/box/funInterface/receiverEvaluatedOnce.kt");
}
@TestMetadata("samConstructorExplicitInvocation.kt")
public void testSamConstructorExplicitInvocation() throws Exception {
runTest("compiler/testData/codegen/box/funInterface/samConstructorExplicitInvocation.kt");
}
@TestMetadata("samConversionToGenericInterfaceInGenericFun.kt")
public void testSamConversionToGenericInterfaceInGenericFun() throws Exception {
runTest("compiler/testData/codegen/box/funInterface/samConversionToGenericInterfaceInGenericFun.kt");
}
@TestMetadata("compiler/testData/codegen/box/funInterface/equality")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -7562,41 +7517,6 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
public void testAllFilesPresentInFunInterface() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true);
}
@TestMetadata("any.kt")
public void testAny() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/any.kt");
}
@TestMetadata("anyN.kt")
public void testAnyN() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/anyN.kt");
}
@TestMetadata("iface.kt")
public void testIface() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/iface.kt");
}
@TestMetadata("ifaceChild.kt")
public void testIfaceChild() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/ifaceChild.kt");
}
@TestMetadata("primitive.kt")
public void testPrimitive() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/primitive.kt");
}
@TestMetadata("result.kt")
public void testResult() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/result.kt");
}
@TestMetadata("string.kt")
public void testString() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/string.kt");
}
}
@TestMetadata("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda")
@@ -12815,11 +12735,6 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
runTest("compiler/testData/codegen/box/regressions/kt39088.kt");
}
@TestMetadata("kt4142.kt")
public void testKt4142() throws Exception {
runTest("compiler/testData/codegen/box/regressions/kt4142.kt");
}
@TestMetadata("kt4281.kt")
public void testKt4281() throws Exception {
runTest("compiler/testData/codegen/box/regressions/kt4281.kt");