本文整理汇总了C#中ILCompiler.DependencyAnalysis.ObjectDataBuilder.EmitZeros方法的典型用法代码示例。如果您正苦于以下问题:C# ObjectDataBuilder.EmitZeros方法的具体用法?C# ObjectDataBuilder.EmitZeros怎么用?C# ObjectDataBuilder.EmitZeros使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ILCompiler.DependencyAnalysis.ObjectDataBuilder
的用法示例。
在下文中一共展示了ObjectDataBuilder.EmitZeros方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetData
public override ObjectData GetData(NodeFactory factory, bool relocsOnly)
{
ObjectDataBuilder builder = new ObjectDataBuilder(factory);
// If the type has a class constructor, it's non-GC statics section is prefixed
// by System.Runtime.CompilerServices.StaticClassConstructionContext struct.
if (HasClassConstructorContext)
{
int alignmentRequired = Math.Max(_type.NonGCStaticFieldAlignment, ClassConstructorContextAlignment);
builder.RequireAlignment(alignmentRequired);
Debug.Assert(((ISymbolNode)this).Offset >= ClassConstructorContextSize);
// Add padding before the context if alignment forces us to do so
builder.EmitZeros(((ISymbolNode)this).Offset - ClassConstructorContextSize);
// Emit the actual StaticClassConstructionContext
var cctorMethod = _type.GetStaticConstructor();
builder.EmitPointerReloc(factory.MethodEntrypoint(cctorMethod));
builder.EmitZeroPointer();
builder.DefinedSymbols.Add(_classConstructorContext);
}
else
{
builder.RequireAlignment(_type.NonGCStaticFieldAlignment);
}
builder.EmitZeros(_type.NonGCStaticFieldSize);
builder.DefinedSymbols.Add(this);
return builder.ToObjectData();
}
示例2: GetData
public override ObjectData GetData(NodeFactory factory, bool relocsOnly)
{
ObjectDataBuilder builder = new ObjectDataBuilder(factory);
// If the type has a class constructor, its non-GC statics section is prefixed
// by System.Runtime.CompilerServices.StaticClassConstructionContext struct.
if (factory.TypeSystemContext.HasLazyStaticConstructor(_type))
{
int alignmentRequired = Math.Max(_type.NonGCStaticFieldAlignment, GetClassConstructorContextAlignment(_type.Context.Target));
int classConstructorContextStorageSize = GetClassConstructorContextStorageSize(factory.Target, _type);
builder.RequireAlignment(alignmentRequired);
Debug.Assert(classConstructorContextStorageSize >= GetClassConstructorContextSize(_type.Context.Target));
// Add padding before the context if alignment forces us to do so
builder.EmitZeros(classConstructorContextStorageSize - GetClassConstructorContextSize(_type.Context.Target));
// Emit the actual StaticClassConstructionContext
MethodDesc cctorMethod = _type.GetStaticConstructor();
MethodDesc canonCctorMethod = cctorMethod.GetCanonMethodTarget(CanonicalFormKind.Specific);
if (cctorMethod != canonCctorMethod)
builder.EmitPointerReloc(factory.FatFunctionPointer(cctorMethod), FatFunctionPointerConstants.Offset);
else
builder.EmitPointerReloc(factory.MethodEntrypoint(cctorMethod));
builder.EmitZeroPointer();
}
else
{
builder.RequireAlignment(_type.NonGCStaticFieldAlignment);
}
builder.EmitZeros(_type.NonGCStaticFieldSize);
builder.DefinedSymbols.Add(this);
return builder.ToObjectData();
}