本文整理汇总了C#中ILCompiler.DependencyAnalysis.NodeFactory.ReadyToRunHelper方法的典型用法代码示例。如果您正苦于以下问题:C# NodeFactory.ReadyToRunHelper方法的具体用法?C# NodeFactory.ReadyToRunHelper怎么用?C# NodeFactory.ReadyToRunHelper使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ILCompiler.DependencyAnalysis.NodeFactory
的用法示例。
在下文中一共展示了NodeFactory.ReadyToRunHelper方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetConditionalStaticDependencies
public override IEnumerable<CombinedDependencyListEntry> GetConditionalStaticDependencies(NodeFactory factory)
{
DefType defType = _type.GetClosestDefType();
foreach (MethodDesc decl in defType.EnumAllVirtualSlots())
{
MethodDesc impl = defType.FindVirtualFunctionTargetMethodOnObjectType(decl);
if (impl.OwningType == defType && !impl.IsAbstract)
{
MethodDesc canonImpl = impl.GetCanonMethodTarget(CanonicalFormKind.Specific);
yield return new CombinedDependencyListEntry(factory.MethodEntrypoint(canonImpl, _type.IsValueType), factory.VirtualMethodUse(decl), "Virtual method");
}
}
Debug.Assert(
_type == defType ||
((System.Collections.IStructuralEquatable)defType.RuntimeInterfaces).Equals(_type.RuntimeInterfaces,
EqualityComparer<DefType>.Default));
// 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.RuntimeInterfaces)
{
Debug.Assert(interfaceType.IsInterface);
foreach (MethodDesc interfaceMethod in interfaceType.GetAllMethods())
{
if (interfaceMethod.Signature.IsStatic)
continue;
MethodDesc implMethod = defType.ResolveInterfaceMethodToVirtualMethodOnType(interfaceMethod);
if (implMethod != null)
{
yield return new CombinedDependencyListEntry(factory.VirtualMethodUse(implMethod), factory.ReadyToRunHelper(ReadyToRunHelperId.VirtualCall, interfaceMethod), "Interface method");
yield return new CombinedDependencyListEntry(factory.VirtualMethodUse(implMethod), factory.ReadyToRunHelper(ReadyToRunHelperId.ResolveVirtualFunction, interfaceMethod), "Interface method address");
}
}
}
}
示例2: GetTarget
public override ISymbolNode GetTarget(NodeFactory factory, Instantiation typeInstantiation, Instantiation methodInstantiation)
{
MethodDesc instantiatedMethod = _method.InstantiateSignature(typeInstantiation, methodInstantiation);
// https://github.com/dotnet/corert/issues/2342 - we put a pointer to the virtual call helper into the dictionary
// but this should be something that will let us compute the target of the dipatch (e.g. interface dispatch cell).
return factory.ReadyToRunHelper(ReadyToRunHelperId.VirtualCall, instantiatedMethod);
}
示例3: GetConditionalStaticDependencies
public override IEnumerable<CombinedDependencyListEntry> GetConditionalStaticDependencies(NodeFactory factory)
{
if (_type is MetadataType)
{
foreach (MethodDesc decl in VirtualFunctionResolution.EnumAllVirtualSlots((MetadataType)_type))
{
MethodDesc impl = VirtualFunctionResolution.FindVirtualFunctionTargetMethodOnObjectType(decl, (MetadataType)_type);
if (impl.OwningType == _type && !impl.IsAbstract)
{
yield return new DependencyNodeCore<NodeFactory>.CombinedDependencyListEntry(factory.MethodEntrypoint(impl), factory.VirtualMethodUse(decl), "Virtual method");
}
}
// 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 _type.RuntimeInterfaces)
{
Debug.Assert(interfaceType.IsInterface);
foreach (MethodDesc interfaceMethod in interfaceType.GetMethods())
{
Debug.Assert(interfaceMethod.IsVirtual);
MethodDesc implMethod = VirtualFunctionResolution.ResolveInterfaceMethodToVirtualMethodOnType(interfaceMethod, _type.GetClosestMetadataType());
if (implMethod != null)
{
yield return new DependencyNodeCore<NodeFactory>.CombinedDependencyListEntry(factory.VirtualMethodUse(implMethod), factory.ReadyToRunHelper(ReadyToRunHelperId.InterfaceDispatch, interfaceMethod), "Interface method");
}
}
}
}
}