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


C# RuntimeTypeHandle.IsDynamicType方法代码示例

本文整理汇总了C#中System.RuntimeTypeHandle.IsDynamicType方法的典型用法代码示例。如果您正苦于以下问题:C# RuntimeTypeHandle.IsDynamicType方法的具体用法?C# RuntimeTypeHandle.IsDynamicType怎么用?C# RuntimeTypeHandle.IsDynamicType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.RuntimeTypeHandle的用法示例。


在下文中一共展示了RuntimeTypeHandle.IsDynamicType方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: IsPregeneratedOrTemplateRuntimeTypeHandle

        public unsafe static bool IsPregeneratedOrTemplateRuntimeTypeHandle(RuntimeTypeHandle rtth)
        {
#if SUPPORTS_NATIVE_METADATA_TYPE_LOADING
            if (!rtth.IsDynamicType())
                return true;

            if (rtth.ToEETypePtr()->DynamicModule == null)
                return true;

            return rtth.ToEETypePtr()->DynamicModule->DynamicTypeSlotDispatchResolve == IntPtr.Zero;
#else
            return true;
#endif
        }
开发者ID:nattress,项目名称:corert,代码行数:14,代码来源:TypeLoaderEnvironment.GVMResolution.cs

示例2: TryGetNonGcStaticFieldData

        /// <summary>
        /// Get a pointer to a pointer to the nongc static field data of a type. This function works for all generic types
        /// </summary>
        public IntPtr TryGetNonGcStaticFieldData(RuntimeTypeHandle runtimeTypeHandle)
        {
            unsafe
            {
                // Non-generic, non-dynamic static data is found via the FieldAccessMap
                EEType* typeAsEEType = runtimeTypeHandle.ToEETypePtr();
                // Non-generic, non-dynamic types need special handling.
                Debug.Assert(typeAsEEType->IsDynamicType || typeAsEEType->IsGeneric);
            }

            // Search hashtable for static entry
            ExternalReferencesTable staticInfoLookup;
            var parser = GetStaticInfo(runtimeTypeHandle, out staticInfoLookup);
            if (!parser.IsNull)
            {
                var index = parser.GetUnsignedForBagElementKind(BagElementKind.NonGcStaticData);

                return index.HasValue ? staticInfoLookup.GetIntPtrFromIndex(index.Value) : IntPtr.Zero;
            }

            // Not found in hashtable... must be a dynamically created type
            Debug.Assert(runtimeTypeHandle.IsDynamicType());
            return RuntimeAugments.GetNonGcStaticFieldData(runtimeTypeHandle);
        }
开发者ID:justinvp,项目名称:corert,代码行数:27,代码来源:TypeLoaderEnvironment.StaticsLookup.cs

示例3: TryGetTlsOffsetDictionaryCellForDynamicType

        private IntPtr TryGetTlsOffsetDictionaryCellForDynamicType(RuntimeTypeHandle runtimeTypeHandle)
        {
            Debug.Assert(runtimeTypeHandle.IsDynamicType());

            using (LockHolder.Hold(_threadStaticsLock))
            {
                uint offsetValue;
                if (_dynamicGenericsThreadStatics.TryGetValue(runtimeTypeHandle, out offsetValue))
                    return TryCreateDictionaryCellWithValue(offsetValue);
            }

            return IntPtr.Zero;
        }
开发者ID:justinvp,项目名称:corert,代码行数:13,代码来源:TypeLoaderEnvironment.StaticsLookup.cs

示例4: TryGetTlsIndexDictionaryCellForDynamicType

 private IntPtr TryGetTlsIndexDictionaryCellForDynamicType(RuntimeTypeHandle runtimeTypeHandle)
 {
     // Use TLS index of 0 for dynamic types (the index won't really be used)
     Debug.Assert(runtimeTypeHandle.IsDynamicType());
     return TryCreateDictionaryCellWithValue(0);
 }
开发者ID:justinvp,项目名称:corert,代码行数:6,代码来源:TypeLoaderEnvironment.StaticsLookup.cs

示例5: TryGetThreadStaticFieldOffsetCookieForTypeAndFieldOffset

        public unsafe IntPtr TryGetThreadStaticFieldOffsetCookieForTypeAndFieldOffset(RuntimeTypeHandle runtimeTypeHandle, uint fieldOffset)
        {
            var cookieData = new PermanentAllocatedMemoryBlobs.ThreadStaticFieldOffsets();

            if (runtimeTypeHandle.IsDynamicType())
            {
                cookieData.StartingOffsetInTlsBlock = 0;
                cookieData.FieldOffset = fieldOffset;
            }
            else
            {
                IntPtr ptrToTlsOffset = TryGetTlsOffsetDictionaryCellForStaticType(runtimeTypeHandle);
                if (ptrToTlsOffset == IntPtr.Zero)
                    return IntPtr.Zero;

                uint tlsOffset = *(uint*)ptrToTlsOffset;
                cookieData.StartingOffsetInTlsBlock = tlsOffset;
                cookieData.FieldOffset = fieldOffset;
            }

            return PermanentAllocatedMemoryBlobs.GetPointerToThreadStaticFieldOffsets(cookieData);
        }
开发者ID:justinvp,项目名称:corert,代码行数:22,代码来源:TypeLoaderEnvironment.StaticsLookup.cs

示例6: RegisterDynamicThreadStaticsInfo

        public void RegisterDynamicThreadStaticsInfo(RuntimeTypeHandle runtimeTypeHandle, uint offsetValue, int storageSize)
        {
            bool registered = false;
            Debug.Assert(offsetValue != 0 && storageSize > 0 && runtimeTypeHandle.IsDynamicType());

            _threadStaticsLock.Acquire();
            try
            {
                // Sanity check to make sure we do not register thread statics for the same type more than once
                uint temp;
                Debug.Assert(!_dynamicGenericsThreadStatics.TryGetValue(runtimeTypeHandle, out temp) && storageSize > 0);

                _dynamicGenericsThreadStatics.Add(runtimeTypeHandle, offsetValue);
                _dynamicGenericsThreadStaticSizes.Add(offsetValue, storageSize);
                registered = true;
            }
            finally
            {
                if (!registered)
                {
                    _dynamicGenericsThreadStatics.Remove(runtimeTypeHandle);
                    _dynamicGenericsThreadStaticSizes.Remove(offsetValue);
                }

                _threadStaticsLock.Release();
            }
        }
开发者ID:justinvp,项目名称:corert,代码行数:27,代码来源:TypeLoaderEnvironment.StaticsLookup.cs


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