private void EmitDataMember(ref FieldListInProgress fieldListInProgress, uint type, int offset, Utf8String name) { Debug.Assert((_blob.Size() % 4) == 0); bool isStaticField = (uint)offset == 0xFFFFFFFF; bool mustSkipEmission; uint recordSize = 8 + (isStaticField ? 0 : TypeRecordsBlob.NumericLeafSize(offset)) + DebugInfoBlob.StringLengthEncoded(name); ExtendFieldList(ref fieldListInProgress, recordSize, out mustSkipEmission); if (mustSkipEmission) { return; } _blob.WriteLeafKind(isStaticField ? LeafKind.LF_STATICMEMBER : LeafKind.LF_MEMBER); _blob.WriteCV_Visibility(CV_Visibility.Public); _blob.WriteDWORD(type); if (!isStaticField) { _blob.WriteNumericLeaf(offset); } _blob.WriteString(name); _blob.AlignToDWORD(); VerifyBlobEligibleToBeBetweenRecords(); }
private void EmitBaseClass(ref FieldListInProgress fieldListInProgress, uint baseClassIndex) { Debug.Assert((_blob.Size() % 4) == 0); bool mustSkipEmission; ExtendFieldList(ref fieldListInProgress, 8 + TypeRecordsBlob.NumericLeafSize(0), out mustSkipEmission); if (mustSkipEmission) { return; } _blob.WriteLeafKind(LeafKind.LF_BCLASS); _blob.WriteCV_Visibility(CV_Visibility.Public); _blob.WriteDWORD(baseClassIndex); _blob.WriteNumericLeaf(0); _blob.AlignToDWORD(); VerifyBlobEligibleToBeBetweenRecords(); }
private void EmitEnumerate(ref FieldListInProgress fieldListInProgress, ulong value, Utf8String name) { Debug.Assert((_blob.Size() % 4) == 0); bool mustSkipEmission; uint recordSize = 4 + TypeRecordsBlob.NumericLeafSize(value) + DebugInfoBlob.StringLengthEncoded(name); ExtendFieldList(ref fieldListInProgress, recordSize, out mustSkipEmission); if (mustSkipEmission) { return; } _blob.WriteLeafKind(LeafKind.LF_ENUMERATE); _blob.WriteCV_Visibility(CV_Visibility.Public); _blob.WriteNumericLeaf(value); _blob.WriteString(name); _blob.AlignToDWORD(); VerifyBlobEligibleToBeBetweenRecords(); }
public uint GetArrayTypeIndex(ClassTypeDescriptor classDescriptor, ArrayTypeDescriptor arrayTypeDescriptor, int targetPointerSize) { uint simpleArrayDebugType = GetSimpleArrayTypeIndex(arrayTypeDescriptor.ElementType, arrayTypeDescriptor.Size); FieldListInProgress fieldList = default(FieldListInProgress); fieldList = StartFieldList(); EmitBaseClass(ref fieldList, classDescriptor.BaseClassId); EmitDataMember(ref fieldList, (uint)PrimitiveTypeDescriptor.TYPE_ENUM.T_INT4, targetPointerSize, new Utf8String("count")); int nextOffset = targetPointerSize * 2; if (arrayTypeDescriptor.IsMultiDimensional != 0) { for (uint i = 0; i < arrayTypeDescriptor.Rank; i++) { EmitDataMember(ref fieldList, (uint)PrimitiveTypeDescriptor.TYPE_ENUM.T_INT4, nextOffset, new Utf8String("length" + i.ToStringInvariant())); nextOffset += 4; } for (uint i = 0; i < arrayTypeDescriptor.Rank; i++) { EmitDataMember(ref fieldList, (uint)PrimitiveTypeDescriptor.TYPE_ENUM.T_INT4, nextOffset, new Utf8String("bounds" + i.ToStringInvariant())); nextOffset += 4; } } EmitDataMember(ref fieldList, simpleArrayDebugType, nextOffset, new Utf8String("values")); FinalizeFieldList(fieldList); uint classTypeIndex = _blob.GetNextTypeIndex(); Utf8String name = new Utf8String(classDescriptor.Name); uint recordSize = 20 + DebugInfoBlob.StringLengthEncoded(name) + TypeRecordsBlob.NumericLeafSize(targetPointerSize) /*size of length */; _blob.WriteWORD(checked ((ushort)(_blob.DWORDAlignedSize(recordSize) - 2))); // don't include size of 'length' in 'length' _blob.WriteLeafKind(classDescriptor.IsStruct != 0 ? LeafKind.LF_STRUCTURE : LeafKind.LF_CLASS); _blob.WriteWORD(fieldList.FieldsCount); _blob.WriteLF_CLASS_Properties(LF_CLASS_Properties.None); _blob.WriteDWORD(fieldList.TypeIndexOfFieldList); _blob.WriteDWORD(0); // Derivation list is not filled in here _blob.WriteDWORD(_tiVTShapePointer); // No vtable shape _blob.WriteNumericLeaf(targetPointerSize); _blob.WriteString(name); _blob.AlignToDWORD(); VerifyBlobEligibleToBeBetweenRecords(); return(classTypeIndex); }
public uint GetCompleteClassTypeIndex(ClassTypeDescriptor classTypeDescriptor, ClassFieldsTypeDescriptor classFieldsTypeDescriptior, DataFieldDescriptor[] fields) { FieldListInProgress fieldList = default(FieldListInProgress); if ((classTypeDescriptor.BaseClassId != 0) || (fields != null && fields.Length > 0) || (classTypeDescriptor.IsStruct == 0)) { fieldList = StartFieldList(); if (classTypeDescriptor.BaseClassId != 0) { EmitBaseClass(ref fieldList, classTypeDescriptor.BaseClassId); } if (classTypeDescriptor.IsStruct == 0) { EmitVFuncTab(ref fieldList); } if (fields != null) { foreach (DataFieldDescriptor field in fields) { EmitDataMember(ref fieldList, field.FieldTypeIndex, (int)field.Offset, new Utf8String(field.Name)); } } FinalizeFieldList(fieldList); } uint classTypeIndex = _blob.GetNextTypeIndex(); Utf8String name = new Utf8String(classTypeDescriptor.Name); uint recordSize = 20 + DebugInfoBlob.StringLengthEncoded(name) + TypeRecordsBlob.NumericLeafSize(classFieldsTypeDescriptior.Size) /*size of length */; _blob.WriteWORD(checked ((ushort)(_blob.DWORDAlignedSize(recordSize) - 2))); // don't include size of 'length' in 'length' _blob.WriteLeafKind(classTypeDescriptor.IsStruct != 0 ? LeafKind.LF_STRUCTURE : LeafKind.LF_CLASS); _blob.WriteWORD(fieldList.FieldsCount); _blob.WriteLF_CLASS_Properties(LF_CLASS_Properties.None); _blob.WriteDWORD(fieldList.TypeIndexOfFieldList); _blob.WriteDWORD(0); // Derivation list is not filled in here _blob.WriteDWORD(_tiVTShapePointer); // No vtable shape _blob.WriteNumericLeaf(classFieldsTypeDescriptior.Size); _blob.WriteString(name); _blob.AlignToDWORD(); VerifyBlobEligibleToBeBetweenRecords(); return(classTypeIndex); }
public uint GetClassTypeIndex(ClassTypeDescriptor classTypeDescriptor) { FieldListInProgress fieldList = default(FieldListInProgress); if (classTypeDescriptor.BaseClassId != 0) { fieldList = StartFieldList(); EmitBaseClass(ref fieldList, classTypeDescriptor.BaseClassId); FinalizeFieldList(fieldList); } uint classTypeIndex = _blob.GetNextTypeIndex(); Utf8String name = new Utf8String(classTypeDescriptor.Name); uint recordSize = 20 + DebugInfoBlob.StringLengthEncoded(name) + TypeRecordsBlob.NumericLeafSize(0) /*size of length */; _blob.WriteWORD(checked ((ushort)(_blob.DWORDAlignedSize(recordSize) - 2))); // don't include size of 'length' in 'length' _blob.WriteLeafKind(classTypeDescriptor.IsStruct != 0 ? LeafKind.LF_STRUCTURE : LeafKind.LF_CLASS); _blob.WriteWORD(fieldList.FieldsCount); _blob.WriteLF_CLASS_Properties(LF_CLASS_Properties.ForwardReference); _blob.WriteDWORD(fieldList.TypeIndexOfFieldList); _blob.WriteDWORD(0); // Derivation list is not filled in here _blob.WriteDWORD(0); // No vtable shape _blob.WriteNumericLeaf(0); _blob.WriteString(name); _blob.AlignToDWORD(); VerifyBlobEligibleToBeBetweenRecords(); return(classTypeIndex); }