本文整理汇总了C#中ILCompiler.DependencyAnalysis.NodeFactory.InterfaceDispatchMap方法的典型用法代码示例。如果您正苦于以下问题:C# NodeFactory.InterfaceDispatchMap方法的具体用法?C# NodeFactory.InterfaceDispatchMap怎么用?C# NodeFactory.InterfaceDispatchMap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ILCompiler.DependencyAnalysis.NodeFactory
的用法示例。
在下文中一共展示了NodeFactory.InterfaceDispatchMap方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ComputeNonRelocationBasedDependencies
protected override DependencyList ComputeNonRelocationBasedDependencies(NodeFactory factory)
{
DefType closestDefType = _type.GetClosestDefType();
DependencyList dependencyList = new DependencyList();
if (_type.RuntimeInterfaces.Length > 0)
{
dependencyList.Add(factory.InterfaceDispatchMap(_type), "Interface dispatch map");
// If any of the implemented interfaces have variance, calls against compatible interface methods
// could result in interface methods of this type being used (e.g. IEnumberable<object>.GetEnumerator()
// can dispatch to an implementation of IEnumerable<string>.GetEnumerator()).
// For now, we will not try to optimize this and we will pretend all interface methods are necessary.
foreach (var implementedInterface in _type.RuntimeInterfaces)
{
if (implementedInterface.HasVariance)
{
foreach (var interfaceMethod in implementedInterface.GetAllMethods())
{
if (interfaceMethod.Signature.IsStatic)
continue;
MethodDesc implMethod = closestDefType.ResolveInterfaceMethodToVirtualMethodOnType(interfaceMethod);
if (implMethod != null)
{
dependencyList.Add(factory.VirtualMethodUse(interfaceMethod), "Variant interface method");
dependencyList.Add(factory.VirtualMethodUse(implMethod), "Variant interface method");
}
}
}
}
}
if (_type.IsArray)
{
// Array EEType depends on System.Array's virtuals. Array EETypes don't point to
// their base type (i.e. there's no reloc based dependency making this "just work").
dependencyList.Add(factory.ConstructedTypeSymbol(_type.BaseType), "Array base type");
}
dependencyList.Add(factory.VTable(_type), "VTable");
if (closestDefType.HasGenericDictionarySlot())
{
// Generic dictionary pointer is part of the vtable and as such it gets only laid out
// at the final data emission phase. We need to report it as a non-relocation dependency.
dependencyList.Add(factory.TypeGenericDictionary(closestDefType), "Type generic dictionary");
}
// Include the optional fields by default. We don't know if optional fields will be needed until
// all of the interface usage has been stabilized. If we end up not needing it, the EEType node will not
// generate any relocs to it, and the optional fields node will instruct the object writer to skip
// emitting it.
dependencyList.Add(_optionalFieldsNode, "Optional fields");
return dependencyList;
}
示例2: ComputeNonRelocationBasedDependencies
protected override DependencyList ComputeNonRelocationBasedDependencies(NodeFactory factory)
{
DependencyList dependencyList = new DependencyList();
if (_type.RuntimeInterfaces.Length > 0)
{
dependencyList.Add(factory.InterfaceDispatchMap(_type), "Interface dispatch map");
// If any of the implemented interfaces have variance, calls against compatible interface methods
// could result in interface methods of this type being used (e.g. IEnumberable<object>.GetEnumerator()
// can dispatch to an implementation of IEnumerable<string>.GetEnumerator()).
// For now, we will not try to optimize this and we will pretend all interface methods are necessary.
DefType defType = _type.GetClosestDefType();
foreach (var implementedInterface in defType.RuntimeInterfaces)
{
if (implementedInterface.HasVariance)
{
foreach (var interfaceMethod in implementedInterface.GetAllVirtualMethods())
{
MethodDesc implMethod = defType.ResolveInterfaceMethodToVirtualMethodOnType(interfaceMethod);
if (implMethod != null)
{
dependencyList.Add(factory.VirtualMethodUse(interfaceMethod), "Variant interface method");
dependencyList.Add(factory.VirtualMethodUse(implMethod), "Variant interface method");
}
}
}
}
}
if (_type.IsArray)
{
// Array EEType depends on System.Array's virtuals. Array EETypes don't point to
// their base type (i.e. there's no reloc based dependency making this "just work").
dependencyList.Add(factory.ConstructedTypeSymbol(_type.BaseType), "Array base type");
}
dependencyList.Add(factory.VTable(_type), "VTable");
return dependencyList;
}
示例3: ComputeNonRelocationBasedDependencies
protected override DependencyList ComputeNonRelocationBasedDependencies(NodeFactory factory)
{
DependencyList dependencyList = new DependencyNodeCore<NodeFactory>.DependencyList();
if (_type is MetadataType && _constructed && _type.RuntimeInterfaces.Length > 0)
{
dependencyList.Add(factory.InterfaceDispatchMap(_type), "Interface dispatch map");
}
dependencyList.Add(factory.EETypeOptionalFields(_optionalFieldsBuilder), "EEType optional fields");
return dependencyList;
}
示例4: ComputeNonRelocationBasedDependencies
protected override DependencyList ComputeNonRelocationBasedDependencies(NodeFactory factory)
{
if (_constructed)
{
DependencyList dependencyList = new DependencyList();
if (_type.RuntimeInterfaces.Length > 0)
{
dependencyList.Add(factory.InterfaceDispatchMap(_type), "Interface dispatch map");
}
if (_type.IsArray)
{
// Array EEType depends on System.Array's virtuals. Array EETypes don't point to
// their base type (i.e. there's no reloc based dependency making this "just work").
dependencyList.Add(factory.ConstructedTypeSymbol(_type.BaseType), "Array base type");
}
return dependencyList;
}
return null;
}