diff options
author | Michal Strehovský <MichalStrehovsky@users.noreply.github.com> | 2022-09-29 17:17:23 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-29 17:17:23 +0300 |
commit | e5d2c3e7fe8576c6904c9cc4e47acd9c97817f87 (patch) | |
tree | eaed0b27b45385b956a77f8da24e92cb56bc3411 /src | |
parent | ed9afa880165ac1176f9eb8b2ab3276215ba6b8e (diff) |
Generate single interface dispatch map per canonical form (#76362)
The dispatch maps are identical because canonically-equivalent types have the same vtable layouts.
Diffstat (limited to 'src')
3 files changed, 5 insertions, 2 deletions
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ConstructedEETypeNode.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ConstructedEETypeNode.cs index 01205d68e86..6d734d92ee6 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ConstructedEETypeNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ConstructedEETypeNode.cs @@ -38,7 +38,8 @@ namespace ILCompiler.DependencyAnalysis if (MightHaveInterfaceDispatchMap(factory)) { - dependencyList.Add(factory.InterfaceDispatchMap(_type), "Interface dispatch map"); + TypeDesc canonType = _type.ConvertToCanonForm(CanonicalFormKind.Specific); + dependencyList.Add(factory.InterfaceDispatchMap(canonType), "Interface dispatch map"); } if (_type.IsArray) diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/EETypeNode.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/EETypeNode.cs index 3395c4882ad..e159318beca 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/EETypeNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/EETypeNode.cs @@ -1056,7 +1056,8 @@ namespace ILCompiler.DependencyAnalysis { if (!relocsOnly && MightHaveInterfaceDispatchMap(factory)) { - _optionalFieldsBuilder.SetFieldValue(EETypeOptionalFieldTag.DispatchMap, checked((uint)factory.InterfaceDispatchMapIndirection(Type).IndexFromBeginningOfArray)); + TypeDesc canonType = _type.ConvertToCanonForm(CanonicalFormKind.Specific); + _optionalFieldsBuilder.SetFieldValue(EETypeOptionalFieldTag.DispatchMap, checked((uint)factory.InterfaceDispatchMapIndirection(canonType).IndexFromBeginningOfArray)); } ComputeRareFlags(factory, relocsOnly); diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/InterfaceDispatchMapNode.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/InterfaceDispatchMapNode.cs index 4390f46cfa9..08fc5523091 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/InterfaceDispatchMapNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/InterfaceDispatchMapNode.cs @@ -22,6 +22,7 @@ namespace ILCompiler.DependencyAnalysis // Pointer arrays also follow the same path Debug.Assert(!type.IsArrayTypeWithoutGenericInterfaces()); Debug.Assert(MightHaveInterfaceDispatchMap(type, factory)); + Debug.Assert(type.ConvertToCanonForm(CanonicalFormKind.Specific) == type); _type = type; } |