本文整理汇总了C#中Internal.TypeSystem.MethodDesc.GetCanonMethodTarget方法的典型用法代码示例。如果您正苦于以下问题:C# MethodDesc.GetCanonMethodTarget方法的具体用法?C# MethodDesc.GetCanonMethodTarget怎么用?C# MethodDesc.GetCanonMethodTarget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Internal.TypeSystem.MethodDesc
的用法示例。
在下文中一共展示了MethodDesc.GetCanonMethodTarget方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FatFunctionPointerNode
public FatFunctionPointerNode(MethodDesc methodRepresented)
{
// We should not create these for methods that don't have a canonical method body
Debug.Assert(methodRepresented.GetCanonMethodTarget(CanonicalFormKind.Specific) != methodRepresented);
Method = methodRepresented;
}
示例2: MethodCodeNode
public MethodCodeNode(MethodDesc method)
{
Debug.Assert(!method.IsAbstract);
Debug.Assert(method.GetCanonMethodTarget(CanonicalFormKind.Specific) == method);
_method = method;
}
示例3: TryGetMetadataNativeLayout
/// <summary>
/// Get the NativeLayout for a method from a ReadyToRun image.
/// </summary>
public bool TryGetMetadataNativeLayout(MethodDesc concreteMethod, out IntPtr nativeLayoutInfoModule, out uint nativeLayoutInfoToken)
{
nativeLayoutInfoModule = default(IntPtr);
nativeLayoutInfoToken = 0;
#if SUPPORTS_NATIVE_METADATA_TYPE_LOADING
var nativeMetadataType = concreteMethod.GetTypicalMethodDefinition() as TypeSystem.NativeFormat.NativeFormatMethod;
if (nativeMetadataType == null)
return false;
var canonForm = concreteMethod.GetCanonMethodTarget(CanonicalFormKind.Specific);
var hashCode = canonForm.GetHashCode();
var loadedModulesCount = RuntimeAugments.GetLoadedModules(null);
var loadedModuleHandles = new IntPtr[loadedModulesCount];
var loadedModules = RuntimeAugments.GetLoadedModules(loadedModuleHandles);
Debug.Assert(loadedModulesCount == loadedModules);
#if SUPPORTS_R2R_LOADING
foreach (var moduleHandle in loadedModuleHandles)
{
ExternalReferencesTable externalFixupsTable;
NativeHashtable methodTemplatesHashtable = LoadHashtable(moduleHandle, ReflectionMapBlob.MetadataBasedGenericMethodsTemplateMap, out externalFixupsTable);
if (methodTemplatesHashtable.IsNull)
continue;
var enumerator = methodTemplatesHashtable.Lookup(hashCode);
var nativeMetadataUnit = nativeMetadataType.Context.ResolveMetadataUnit(moduleHandle);
NativeParser entryParser;
while (!(entryParser = enumerator.GetNext()).IsNull)
{
var entryTypeHandle = entryParser.GetUnsigned().AsHandle();
MethodDesc methodDesc = nativeMetadataUnit.GetMethod(entryTypeHandle, null);
Debug.Assert(methodDesc != null);
if (methodDesc == canonForm)
{
TypeLoaderLogger.WriteLine("Found metadata template for method " + concreteMethod.ToString() + ": " + methodDesc.ToString());
nativeLayoutInfoToken = (uint)externalFixupsTable.GetRvaFromIndex(entryParser.GetUnsigned());
if (nativeLayoutInfoToken == BadTokenFixupValue)
{
throw new BadImageFormatException();
}
nativeLayoutInfoModule = moduleHandle;
return true;
}
}
}
#endif
#endif
return false;
}