本文整理汇总了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
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
示例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();
}
}