当前位置: 首页>>代码示例>>C#>>正文


C# MethodDesc.GetCanonMethodTarget方法代码示例

本文整理汇总了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;
        }
开发者ID:nattress,项目名称:corert,代码行数:7,代码来源:FatFunctionPointerNode.cs

示例2: MethodCodeNode

 public MethodCodeNode(MethodDesc method)
 {
     Debug.Assert(!method.IsAbstract);
     Debug.Assert(method.GetCanonMethodTarget(CanonicalFormKind.Specific) == method);
     _method = method;
 }
开发者ID:nattress,项目名称:corert,代码行数:6,代码来源:MethodCodeNode.cs

示例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;
        }
开发者ID:nattress,项目名称:corert,代码行数:56,代码来源:TemplateLocator.cs


注:本文中的Internal.TypeSystem.MethodDesc.GetCanonMethodTarget方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。