本文整理汇总了C#中Internal.TypeSystem.MetadataType类的典型用法代码示例。如果您正苦于以下问题:C# MetadataType类的具体用法?C# MetadataType怎么用?C# MetadataType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MetadataType类属于Internal.TypeSystem命名空间,在下文中一共展示了MetadataType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: IsBlocked
public bool IsBlocked(MetadataType typeDef)
{
if (typeDef.Name == "ICastable")
return true;
return false;
}
开发者ID:noahfalk,项目名称:corert,代码行数:7,代码来源:SingleFileMetadataPolicy.cs
示例2: NonGCStaticsNode
public NonGCStaticsNode(MetadataType type)
{
_type = type;
if (HasClassConstructorContext)
{
_classConstructorContext = new ObjectAndOffsetSymbolNode(this, 0,
"__CCtorContext_" + NodeFactory.NameMangler.GetMangledTypeName(_type));
}
}
开发者ID:noahfalk,项目名称:corert,代码行数:10,代码来源:NonGCStaticsNode.cs
示例3: IsBlocked
public bool IsBlocked(MetadataType typeDef)
{
if (typeDef.Name == "ICastable")
return true;
if (typeDef.HasCustomAttribute("System.Runtime.CompilerServices", "__BlockReflectionAttribute"))
return true;
return false;
}
开发者ID:tijoytom,项目名称:corert,代码行数:10,代码来源:SingleFileMetadataPolicy.cs
示例4: NonGCStaticsNode
public NonGCStaticsNode(MetadataType type, NodeFactory factory)
{
_type = type;
if (factory.TypeInitializationManager.HasLazyStaticConstructor(type))
{
// Class constructor context is a small struct prepended to type's non-GC static data region
// that keeps track of whether the .cctor executed and holds the pointer to the .cctor method.
_classConstructorContext = new ObjectAndOffsetSymbolNode(this, 0,
"__CCtorContext_" + NodeFactory.NameMangler.GetMangledTypeName(_type));
}
}
开发者ID:schellap,项目名称:corert,代码行数:12,代码来源:NonGCStaticsNode.cs
示例5: GetModuleOfType
public ModuleDesc GetModuleOfType(MetadataType typeDef)
{
if (_explicitScopePolicyMixin == null)
{
lock (s_lazyInitThreadSafetyLock)
{
if (_explicitScopePolicyMixin == null)
_explicitScopePolicyMixin = new ExplicitScopeAssemblyPolicyMixin();
}
}
return _explicitScopePolicyMixin.GetModuleOfType(typeDef);
}
开发者ID:tijoytom,项目名称:corert,代码行数:13,代码来源:SingleFileMetadataPolicy.cs
示例6: ComputeRuntimeInterfacesForNonInstantiatedMetadataType
/// <summary>
/// Metadata based computation of interfaces.
/// </summary>
private DefType[] ComputeRuntimeInterfacesForNonInstantiatedMetadataType(MetadataType type)
{
DefType[] explicitInterfaces = type.ExplicitlyImplementedInterfaces;
DefType[] baseTypeInterfaces = (type.BaseType != null) ? (type.BaseType.RuntimeInterfaces) : Array.Empty<DefType>();
// Optimized case for no interfaces newly defined.
if (explicitInterfaces.Length == 0)
return baseTypeInterfaces;
ArrayBuilder<DefType> interfacesArray = new ArrayBuilder<DefType>();
interfacesArray.Append(baseTypeInterfaces);
foreach (DefType iface in explicitInterfaces)
{
BuildPostOrderInterfaceList(iface, ref interfacesArray);
}
return interfacesArray.ToArray();
}
开发者ID:tijoytom,项目名称:corert,代码行数:22,代码来源:MetadataRuntimeInterfacesAlgorithm.cs
示例7: ComputeSequentialFieldLayout
private static ComputedInstanceFieldLayout ComputeSequentialFieldLayout(MetadataType type, int numInstanceFields)
{
var offsets = new FieldAndOffset[numInstanceFields];
// For types inheriting from another type, field offsets continue on from where they left off
int cumulativeInstanceFieldPos = ComputeBytesUsedInParentType(type);
int largestAlignmentRequirement = 1;
int fieldOrdinal = 0;
int packingSize = ComputePackingSize(type);
foreach (var field in type.GetFields())
{
if (field.IsStatic)
continue;
var fieldSizeAndAlignment = ComputeFieldSizeAndAlignment(field.FieldType, packingSize);
if (fieldSizeAndAlignment.Alignment > largestAlignmentRequirement)
largestAlignmentRequirement = fieldSizeAndAlignment.Alignment;
cumulativeInstanceFieldPos = AlignmentHelper.AlignUp(cumulativeInstanceFieldPos, fieldSizeAndAlignment.Alignment);
offsets[fieldOrdinal] = new FieldAndOffset(field, cumulativeInstanceFieldPos);
cumulativeInstanceFieldPos = checked(cumulativeInstanceFieldPos + fieldSizeAndAlignment.Size);
fieldOrdinal++;
}
if (type.IsValueType)
{
var layoutMetadata = type.GetClassLayout();
cumulativeInstanceFieldPos = Math.Max(cumulativeInstanceFieldPos, layoutMetadata.Size);
}
SizeAndAlignment instanceByteSizeAndAlignment;
var instanceSizeAndAlignment = ComputeInstanceSize(type, cumulativeInstanceFieldPos, largestAlignmentRequirement, out instanceByteSizeAndAlignment);
ComputedInstanceFieldLayout computedLayout = new ComputedInstanceFieldLayout();
computedLayout.FieldAlignment = instanceSizeAndAlignment.Alignment;
computedLayout.FieldSize = instanceSizeAndAlignment.Size;
computedLayout.ByteCountUnaligned = instanceByteSizeAndAlignment.Size;
computedLayout.ByteCountAlignment = instanceByteSizeAndAlignment.Alignment;
computedLayout.Offsets = offsets;
return computedLayout;
}
开发者ID:nguerrera,项目名称:corert,代码行数:46,代码来源:MetadataFieldLayoutAlgorithm.cs
示例8: ComputeExplicitFieldLayout
private static ComputedInstanceFieldLayout ComputeExplicitFieldLayout(MetadataType type, int numInstanceFields)
{
// Instance slice size is the total size of instance not including the base type.
// It is calculated as the field whose offset and size add to the greatest value.
int cumulativeInstanceFieldPos =
type.HasBaseType && !type.IsValueType ? type.BaseType.InstanceByteCount : 0;
int instanceSize = cumulativeInstanceFieldPos;
var layoutMetadata = type.GetClassLayout();
int packingSize = ComputePackingSize(type);
int largestAlignmentRequired = 1;
var offsets = new FieldAndOffset[numInstanceFields];
int fieldOrdinal = 0;
foreach (var fieldAndOffset in layoutMetadata.Offsets)
{
var fieldSizeAndAlignment = ComputeFieldSizeAndAlignment(fieldAndOffset.Field.FieldType, packingSize);
if (fieldSizeAndAlignment.Alignment > largestAlignmentRequired)
largestAlignmentRequired = fieldSizeAndAlignment.Alignment;
if (fieldAndOffset.Offset == FieldAndOffset.InvalidOffset)
throw new TypeLoadException();
int computedOffset = checked(fieldAndOffset.Offset + cumulativeInstanceFieldPos);
switch (fieldAndOffset.Field.FieldType.Category)
{
case TypeFlags.Array:
case TypeFlags.Class:
{
int offsetModulo = computedOffset % type.Context.Target.PointerSize;
if (offsetModulo != 0)
{
// GC pointers MUST be aligned.
if (offsetModulo == 4)
{
// We must be attempting to compile a 32bit app targeting a 64 bit platform.
throw new TypeLoadException();
}
else
{
// Its just wrong
throw new TypeLoadException();
}
}
break;
}
}
offsets[fieldOrdinal] = new FieldAndOffset(fieldAndOffset.Field, computedOffset);
int fieldExtent = checked(computedOffset + fieldSizeAndAlignment.Size);
if (fieldExtent > instanceSize)
{
instanceSize = fieldExtent;
}
fieldOrdinal++;
}
if (type.IsValueType && layoutMetadata.Size > instanceSize)
{
instanceSize = layoutMetadata.Size;
}
SizeAndAlignment instanceByteSizeAndAlignment;
var instanceSizeAndAlignment = ComputeInstanceSize(type, instanceSize, largestAlignmentRequired, out instanceByteSizeAndAlignment);
ComputedInstanceFieldLayout computedLayout = new ComputedInstanceFieldLayout();
computedLayout.FieldAlignment = instanceSizeAndAlignment.Alignment;
computedLayout.FieldSize = instanceSizeAndAlignment.Size;
computedLayout.ByteCountUnaligned = instanceByteSizeAndAlignment.Size;
computedLayout.ByteCountAlignment = instanceByteSizeAndAlignment.Alignment;
computedLayout.Offsets = offsets;
return computedLayout;
}
开发者ID:nguerrera,项目名称:corert,代码行数:80,代码来源:MetadataFieldLayoutAlgorithm.cs
示例9: GetRuntimeInterfacesAlgorithmForMetadataType
public override RuntimeInterfacesAlgorithm GetRuntimeInterfacesAlgorithmForMetadataType(MetadataType type)
{
return _metadataRuntimeInterfacesAlgorithm;
}
开发者ID:noahfalk,项目名称:corert,代码行数:4,代码来源:TestTypeSystemContext.cs
示例10: GeneratesMetadata
public bool GeneratesMetadata(MetadataType typeDef)
{
return _modules.Contains(typeDef.Module);
}
开发者ID:tijoytom,项目名称:corert,代码行数:4,代码来源:MultifileMetadataPolicy.cs
示例11: GetRuntimeInterfacesAlgorithmForMetadataType
public override RuntimeInterfacesAlgorithm GetRuntimeInterfacesAlgorithmForMetadataType(MetadataType type)
{
throw new NotImplementedException();
}
开发者ID:pootow,项目名称:corert,代码行数:4,代码来源:TestTypeSystemContext.cs
示例12: ArrayOfTRuntimeInterfacesAlgorithm
/// <summary>
/// RuntimeInterfaces algorithm for for array types which are similar to a generic type
/// </summary>
/// <param name="arrayOfTType">Open type to instantiate to get the interfaces associated with an array.</param>
public ArrayOfTRuntimeInterfacesAlgorithm(MetadataType arrayOfTType)
{
_arrayOfTType = arrayOfTType;
Debug.Assert(!(arrayOfTType is InstantiatedType));
}
开发者ID:tijoytom,项目名称:corert,代码行数:9,代码来源:ArrayOfTRuntimeInterfacesAlgorithm.cs
示例13: ThreadStaticsNode
public ThreadStaticsNode(MetadataType type, NodeFactory factory)
{
_type = type;
}
开发者ID:noahfalk,项目名称:corert,代码行数:4,代码来源:ThreadStaticsNode.cs
示例14: GCStaticsNode
public GCStaticsNode(MetadataType type)
{
_type = type;
}
开发者ID:shahid-pk,项目名称:corert,代码行数:4,代码来源:GCStaticsNode.cs
示例15: GeneratesMetadata
public bool GeneratesMetadata(MetadataType typeDef)
{
return true;
}
开发者ID:noahfalk,项目名称:corert,代码行数:4,代码来源:SingleFileMetadataPolicy.cs
示例16: TypeGCStaticBaseGenericLookupResult
public TypeGCStaticBaseGenericLookupResult(TypeDesc type)
{
Debug.Assert(type.IsRuntimeDeterminedSubtype, "Concrete static base in a generic dictionary?");
Debug.Assert(type is MetadataType);
_type = (MetadataType)type;
}
开发者ID:justinvp,项目名称:corert,代码行数:6,代码来源:GenericLookupResult.cs
示例17: IsBlocked
public bool IsBlocked(MetadataType typeDef)
{
if (_isBlockedType != null)
return _isBlockedType(typeDef);
return false;
}
开发者ID:tijoytom,项目名称:corert,代码行数:6,代码来源:MockPolicy.cs
示例18: GeneratesMetadata
public bool GeneratesMetadata(MetadataType typeDef)
{
return _typeGeneratesMetadata(typeDef);
}
开发者ID:tijoytom,项目名称:corert,代码行数:4,代码来源:MockPolicy.cs
示例19: ComputePackingSize
private static int ComputePackingSize(MetadataType type)
{
var layoutMetadata = type.GetClassLayout();
// If a type contains pointers then the metadata specified packing size is ignored (On desktop this is disqualification from ManagedSequential)
if (layoutMetadata.PackingSize == 0 || type.ContainsPointers)
return type.Context.Target.DefaultPackingSize;
else
return layoutMetadata.PackingSize;
}
开发者ID:nguerrera,项目名称:corert,代码行数:10,代码来源:MetadataFieldLayoutAlgorithm.cs
示例20: GCStaticsNode
public GCStaticsNode(MetadataType type)
{
Debug.Assert(!type.IsCanonicalSubtype(CanonicalFormKind.Specific));
_type = type;
}
开发者ID:nattress,项目名称:corert,代码行数:5,代码来源:GCStaticsNode.cs
注:本文中的Internal.TypeSystem.MetadataType类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论