當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。