Skip to content
This repository has been archived by the owner on Nov 1, 2020. It is now read-only.

Commit

Permalink
Merge pull request #5259 from dotnet/nmirror
Browse files Browse the repository at this point in the history
Merge nmirror to master
MichalStrehovsky authored Jan 18, 2018
2 parents 576f997 + e30bb54 commit dd3cf33
Showing 3 changed files with 9 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -243,7 +243,7 @@ public sealed override IEnumerable<CombinedDependencyListEntry> GetConditionalSt
// Add conditional dependencies for interface methods the type implements. For example, if the type T implements
// interface IFoo which has a method M1, add a dependency on T.M1 dependent on IFoo.M1 being called, since it's
// possible for any IFoo object to actually be an instance of T.
foreach (DefType interfaceType in defType.NormalizedRuntimeInterfaces())
foreach (DefType interfaceType in defType.RuntimeInterfaces)
{
Debug.Assert(interfaceType.IsInterface);

@@ -259,7 +259,7 @@ public sealed override IEnumerable<CombinedDependencyListEntry> GetConditionalSt
MethodDesc implMethod = defType.ResolveInterfaceMethodToVirtualMethodOnType(interfaceMethod);
if (implMethod != null)
{
yield return new CombinedDependencyListEntry(factory.VirtualMethodUse(implMethod), factory.VirtualMethodUse(interfaceMethod), "Interface method");
yield return new CombinedDependencyListEntry(factory.VirtualMethodUse(implMethod.Normalize()), factory.VirtualMethodUse(interfaceMethod.Normalize()), "Interface method");
}
}
}
@@ -277,7 +277,7 @@ private void AddVirtualMethodUseDependencies(DependencyList dependencyList, Node

if (_type.RuntimeInterfaces.Length > 0 && !factory.VTable(closestDefType).HasFixedSlots)
{
foreach (var implementedInterface in _type.NormalizedRuntimeInterfaces())
foreach (var implementedInterface in _type.RuntimeInterfaces)
{
// If the type implements ICastable, the methods are implicitly necessary
if (implementedInterface == factory.ICastableInterface)
@@ -340,8 +340,8 @@ private void AddVirtualMethodUseDependencies(DependencyList dependencyList, Node
MethodDesc implMethod = closestDefType.ResolveInterfaceMethodToVirtualMethodOnType(interfaceMethod);
if (implMethod != null)
{
dependencyList.Add(factory.VirtualMethodUse(interfaceMethod), "Variant interface method");
dependencyList.Add(factory.VirtualMethodUse(implMethod), "Variant interface method");
dependencyList.Add(factory.VirtualMethodUse(interfaceMethod.Normalize()), "Variant interface method");
dependencyList.Add(factory.VirtualMethodUse(implMethod.Normalize()), "Variant interface method");
}
}
}
Original file line number Diff line number Diff line change
@@ -61,14 +61,14 @@ void EmitDispatchMap(ref ObjectDataBuilder builder, NodeFactory factory)
{
var entryCountReservation = builder.ReserveInt();
int entryCount = 0;
int interfaceIndex = 0;

foreach (var interfaceType in _type.NormalizedRuntimeInterfaces())

for (int interfaceIndex = 0; interfaceIndex < _type.RuntimeInterfaces.Length; interfaceIndex++)
{
var interfaceType = _type.RuntimeInterfaces[interfaceIndex];
Debug.Assert(interfaceType.IsInterface);

IReadOnlyList<MethodDesc> virtualSlots = factory.VTable(interfaceType).Slots;

for (int interfaceMethodSlot = 0; interfaceMethodSlot < virtualSlots.Count; interfaceMethodSlot++)
{
MethodDesc declMethod = virtualSlots[interfaceMethodSlot];
@@ -84,8 +84,6 @@ void EmitDispatchMap(ref ObjectDataBuilder builder, NodeFactory factory)
entryCount++;
}
}

interfaceIndex++;
}

builder.EmitInt(entryCountReservation, entryCount);
Original file line number Diff line number Diff line change
@@ -22,8 +22,6 @@ public abstract class VTableSliceNode : DependencyNodeCore<NodeFactory>
public VTableSliceNode(TypeDesc type)
{
Debug.Assert(!type.IsArray, "Wanted to call GetClosestDefType?");
Debug.Assert(!type.IsCanonicalSubtype(CanonicalFormKind.Any) ||
type.ConvertToCanonForm(CanonicalFormKind.Specific) == type);
_type = type;
}

0 comments on commit dd3cf33

Please sign in to comment.