Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFadi Hanna <fadim@microsoft.com>2018-06-29 21:22:22 +0300
committerFadi Hanna <fadim@microsoft.com>2018-06-29 21:22:22 +0300
commit053011069037aeccf11408fdacc79ddbb7f06780 (patch)
tree627c17c910a1c35e522cad3cbcad453a38fd245a /src/ILCompiler.Compiler
parent25e1613eb2ae283990292472fa67d30ecd8f80b9 (diff)
Fixing CoreRT git mirroring break.
The issue here is that the code enumerates the slots of a VTable node of a runtime determined interface instantiation (declType.GetTypeDefinition().RuntimeInterfaces), and in CoreRT the vtable slots are only produced when used by the code. Given that nothing uses these method definitions, we end up empty vtables, and end up with missing entries in the dispatch map and sealed vtable. I'm rewriting the code to enumerate methods on the fully instantiated VTable, [tfs-changeset: 1706049]
Diffstat (limited to 'src/ILCompiler.Compiler')
-rw-r--r--src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/InterfaceDispatchMapNode.cs6
-rw-r--r--src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/SealedVTableNode.cs6
2 files changed, 10 insertions, 2 deletions
diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/InterfaceDispatchMapNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/InterfaceDispatchMapNode.cs
index 57c4299af..fb72c8a7c 100644
--- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/InterfaceDispatchMapNode.cs
+++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/InterfaceDispatchMapNode.cs
@@ -117,7 +117,8 @@ namespace ILCompiler.DependencyAnalysis
for (int interfaceIndex = 0; interfaceIndex < declType.RuntimeInterfaces.Length; interfaceIndex++)
{
- var interfaceType = declType.GetTypeDefinition().RuntimeInterfaces[interfaceIndex];
+ var interfaceType = declType.RuntimeInterfaces[interfaceIndex];
+ var interfaceDefinitionType = declType.GetTypeDefinition().RuntimeInterfaces[interfaceIndex];
Debug.Assert(interfaceType.IsInterface);
IReadOnlyList<MethodDesc> virtualSlots = factory.VTable(interfaceType).Slots;
@@ -125,6 +126,9 @@ namespace ILCompiler.DependencyAnalysis
for (int interfaceMethodSlot = 0; interfaceMethodSlot < virtualSlots.Count; interfaceMethodSlot++)
{
MethodDesc declMethod = virtualSlots[interfaceMethodSlot];
+ if(!interfaceType.IsTypeDefinition)
+ declMethod = factory.TypeSystemContext.GetMethodForInstantiatedType(declMethod.GetTypicalMethodDefinition(), (InstantiatedType)interfaceDefinitionType);
+
var implMethod = declType.GetTypeDefinition().ResolveInterfaceMethodToVirtualMethodOnType(declMethod);
// Interface methods first implemented by a base type in the hierarchy will return null for the implMethod (runtime interface
diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/SealedVTableNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/SealedVTableNode.cs
index c2a792246..80d67a9bd 100644
--- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/SealedVTableNode.cs
+++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/SealedVTableNode.cs
@@ -109,13 +109,17 @@ namespace ILCompiler.DependencyAnalysis
for (int interfaceIndex = 0; interfaceIndex < declType.RuntimeInterfaces.Length; interfaceIndex++)
{
- var interfaceType = declType.GetTypeDefinition().RuntimeInterfaces[interfaceIndex];
+ var interfaceType = declType.RuntimeInterfaces[interfaceIndex];
+ var interfaceDefinitionType = declType.GetTypeDefinition().RuntimeInterfaces[interfaceIndex];
virtualSlots = factory.VTable(interfaceType).Slots;
for (int interfaceMethodSlot = 0; interfaceMethodSlot < virtualSlots.Count; interfaceMethodSlot++)
{
MethodDesc declMethod = virtualSlots[interfaceMethodSlot];
+ if (!interfaceType.IsTypeDefinition)
+ declMethod = factory.TypeSystemContext.GetMethodForInstantiatedType(declMethod.GetTypicalMethodDefinition(), (InstantiatedType)interfaceDefinitionType);
+
var implMethod = declType.GetTypeDefinition().ResolveInterfaceMethodToVirtualMethodOnType(declMethod);
// Interface methods first implemented by a base type in the hierarchy will return null for the implMethod (runtime interface