public DesktopInstanceField(DesktopGCHeap heap, IFieldData data, string name, FieldAttributes attributes, IntPtr sig, int sigLen) { _name = name; _field = data; _attributes = attributes; ulong mt = data.TypeMethodTable; if (mt != 0) _type = (BaseDesktopHeapType)heap.GetGCHeapType(mt, 0); if (_type == null) { if (sig != IntPtr.Zero && sigLen > 0) { SigParser sigParser = new SigParser(sig, sigLen); bool res; int sigType, etype = 0; if (res = sigParser.GetCallingConvInfo(out sigType)) Debug.Assert(sigType == SigParser.IMAGE_CEE_CS_CALLCONV_FIELD); res = res && sigParser.SkipCustomModifiers(); res = res && sigParser.GetElemType(out etype); if (res) { ClrElementType type = (ClrElementType)etype; if (type == ClrElementType.Array) { res = sigParser.PeekElemType(out etype); res = res && sigParser.SkipExactlyOne(); int ranks = 0; res = res && sigParser.GetData(out ranks); if (res) _type = heap.GetArrayType((ClrElementType)etype, ranks, null); } else if (type == ClrElementType.SZArray) { res = sigParser.PeekElemType(out etype); type = (ClrElementType)etype; if (DesktopRuntimeBase.IsObjectReference(type)) _type = (BaseDesktopHeapType)heap.GetBasicType(ClrElementType.SZArray); else _type = (BaseDesktopHeapType)heap.GetArrayType(type, -1, null); } else if (type == ClrElementType.Pointer) { // Only deal with single pointers for now and types that have already been constructed res = sigParser.GetElemType(out etype); type = (ClrElementType)etype; int token; sigParser.GetToken(out token); BaseDesktopHeapType innerType = (BaseDesktopHeapType)heap.GetGCHeapTypeFromModuleAndToken(data.Module, Convert.ToUInt32(token)); if (innerType == null) { innerType = (BaseDesktopHeapType)heap.GetBasicType(type); } _type = heap.CreatePointerType(innerType, type, null); } } } if (_type == null) _type = (BaseDesktopHeapType)heap.GetBasicType(ElementType); } else if (ElementType != ClrElementType.Class) { _type.ElementType = ElementType; } }
public DesktopInstanceField(DesktopGCHeap heap, IFieldData data, string name, FieldAttributes attributes, IntPtr sig, int sigLen) { _name = name; _field = data; _attributes = attributes; ulong mt = data.TypeMethodTable; if (mt != 0) { _type = (BaseDesktopHeapType)heap.GetGCHeapType(mt, 0); } if (_type == null) { if (sig != IntPtr.Zero && sigLen > 0) { SigParser sigParser = new SigParser(sig, sigLen); bool res; int sigType, etype = 0; if (res = sigParser.GetCallingConvInfo(out sigType)) { Debug.Assert(sigType == SigParser.IMAGE_CEE_CS_CALLCONV_FIELD); } res = res && sigParser.SkipCustomModifiers(); res = res && sigParser.GetElemType(out etype); if (res) { ClrElementType type = (ClrElementType)etype; if (type == ClrElementType.Array) { res = sigParser.PeekElemType(out etype); res = res && sigParser.SkipExactlyOne(); int ranks = 0; res = res && sigParser.GetData(out ranks); if (res) { _type = heap.GetArrayType((ClrElementType)etype, ranks, null); } } else if (type == ClrElementType.SZArray) { res = sigParser.PeekElemType(out etype); type = (ClrElementType)etype; if (DesktopRuntimeBase.IsObjectReference(type)) { _type = (BaseDesktopHeapType)heap.GetBasicType(ClrElementType.SZArray); } else { _type = (BaseDesktopHeapType)heap.GetArrayType(type, -1, null); } } else if (type == ClrElementType.Pointer) { // Only deal with single pointers for now and types that have already been constructed res = sigParser.GetElemType(out etype); type = (ClrElementType)etype; int token; sigParser.GetToken(out token); BaseDesktopHeapType innerType = (BaseDesktopHeapType)heap.GetGCHeapTypeFromModuleAndToken(data.Module, Convert.ToUInt32(token)); if (innerType == null) { innerType = (BaseDesktopHeapType)heap.GetBasicType(type); } _type = heap.CreatePointerType(innerType, type, null); } } } if (_type == null) { _type = (BaseDesktopHeapType)heap.GetBasicType(ElementType); } } else if (ElementType != ClrElementType.Class) { _type.ElementType = ElementType; } }
public DesktopThreadStaticField(DesktopGCHeap heap, IFieldData field, string name) { _field = field; _name = name; _type = (BaseDesktopHeapType)heap.GetGCHeapType(field.TypeMethodTable, 0); }
public DesktopThreadStaticField(DesktopGCHeap heap, IFieldData field, string name) { _field = field; _name = name; _type = (BaseDesktopHeapType)heap.GetGCHeapType(field.TypeMethodTable, 0); }
public DesktopStaticField(DesktopGCHeap heap, IFieldData field, BaseDesktopHeapType containingType, string name, FieldAttributes attributes, object defaultValue, IntPtr sig, int sigLen) { m_field = field; m_name = name; m_attributes = attributes; m_type = (BaseDesktopHeapType)heap.GetGCHeapType(field.TypeMethodTable, 0); m_defaultValue = defaultValue; m_heap = heap; if (m_type != null && ElementType != ClrElementType.Class) { m_type.SetElementType(ElementType); } m_containingType = containingType; if (m_type == null) { if (sig != IntPtr.Zero && sigLen > 0) { SigParser sigParser = new SigParser(sig, sigLen); bool res; int sigType, etype = 0; if (res = sigParser.GetCallingConvInfo(out sigType)) { Debug.Assert(sigType == SigParser.IMAGE_CEE_CS_CALLCONV_FIELD); } res = res && sigParser.SkipCustomModifiers(); res = res && sigParser.GetElemType(out etype); if (res) { ClrElementType type = (ClrElementType)etype; if (type == ClrElementType.Array) { res = sigParser.PeekElemType(out etype); res = res && sigParser.SkipExactlyOne(); int ranks = 0; res = res && sigParser.GetData(out ranks); if (res) { m_type = heap.GetArrayType((ClrElementType)etype, ranks, null); } } else if (type == ClrElementType.SZArray) { res = sigParser.PeekElemType(out etype); type = (ClrElementType)etype; if (DesktopRuntimeBase.IsObjectReference(type)) { m_type = (BaseDesktopHeapType)heap.GetBasicType(ClrElementType.SZArray); } else { m_type = (BaseDesktopHeapType)heap.GetArrayType(type, -1, null); } } } } if (m_type == null) { m_type = (BaseDesktopHeapType)TryBuildType(m_heap); } if (m_type == null) { m_type = (BaseDesktopHeapType)heap.GetBasicType(ElementType); } } }
public DesktopInstanceField(DesktopGCHeap heap, IFieldData data, string name, FieldAttributes attributes, IntPtr sig, int sigLen) { m_name = name; m_field = data; m_attributes = attributes; ulong mt = data.TypeMethodTable; if (mt != 0) { m_type = (BaseDesktopHeapType)heap.GetGCHeapType(mt, 0); } if (m_type == null) { if (sig != IntPtr.Zero && sigLen > 0) { SigParser sigParser = new SigParser(sig, sigLen); bool res; int sigType, etype = 0; if (res = sigParser.GetCallingConvInfo(out sigType)) { Debug.Assert(sigType == SigParser.IMAGE_CEE_CS_CALLCONV_FIELD); } res = res && sigParser.SkipCustomModifiers(); res = res && sigParser.GetElemType(out etype); if (res) { ClrElementType type = (ClrElementType)etype; if (type == ClrElementType.Array) { res = sigParser.PeekElemType(out etype); res = res && sigParser.SkipExactlyOne(); int ranks = 0; res = res && sigParser.GetData(out ranks); if (res) { m_type = heap.GetArrayType((ClrElementType)etype, ranks, null); } } else if (type == ClrElementType.SZArray) { res = sigParser.PeekElemType(out etype); type = (ClrElementType)etype; if (DesktopRuntimeBase.IsObjectReference(type)) { m_type = (BaseDesktopHeapType)heap.GetBasicType(ClrElementType.SZArray); } else { m_type = (BaseDesktopHeapType)heap.GetArrayType(type, -1, null); } } } } if (m_type == null) { m_type = (BaseDesktopHeapType)heap.GetBasicType(ElementType); } } else if (ElementType != ClrElementType.Class) { m_type.SetElementType(ElementType); } }
public DesktopStaticField(DesktopGCHeap heap, IFieldData field, BaseDesktopHeapType containingType, string name, FieldAttributes attributes, object defaultValue, IntPtr sig, int sigLen) { m_field = field; m_name = name; m_attributes = attributes; m_type = (BaseDesktopHeapType)heap.GetGCHeapType(field.TypeMethodTable, 0); m_defaultValue = defaultValue; m_heap = heap; if (m_type != null && ElementType != ClrElementType.Class) m_type.SetElementType(ElementType); m_containingType = containingType; if (m_type == null) { if (sig != IntPtr.Zero && sigLen > 0) { SigParser sigParser = new SigParser(sig, sigLen); bool res; int sigType, etype = 0; if (res = sigParser.GetCallingConvInfo(out sigType)) Debug.Assert(sigType == SigParser.IMAGE_CEE_CS_CALLCONV_FIELD); res = res && sigParser.SkipCustomModifiers(); res = res && sigParser.GetElemType(out etype); if (res) { ClrElementType type = (ClrElementType)etype; if (type == ClrElementType.Array) { res = sigParser.PeekElemType(out etype); res = res && sigParser.SkipExactlyOne(); int ranks = 0; res = res && sigParser.GetData(out ranks); if (res) m_type = heap.GetArrayType((ClrElementType)etype, ranks, null); } else if (type == ClrElementType.SZArray) { res = sigParser.PeekElemType(out etype); type = (ClrElementType)etype; if (DesktopRuntimeBase.IsObjectReference(type)) m_type = (BaseDesktopHeapType)heap.GetBasicType(ClrElementType.SZArray); else m_type = (BaseDesktopHeapType)heap.GetArrayType(type, -1, null); } } } if (m_type == null) m_type = (BaseDesktopHeapType)TryBuildType(m_heap); if (m_type == null) m_type = (BaseDesktopHeapType)heap.GetBasicType(ElementType); } }
public DesktopInstanceField(DesktopGCHeap heap, IFieldData data, string name, FieldAttributes attributes, IntPtr sig, int sigLen) { m_name = name; m_field = data; m_attributes = attributes; ulong mt = data.TypeMethodTable; if (mt != 0) m_type = (BaseDesktopHeapType)heap.GetGCHeapType(mt, 0); if (m_type == null) { if (sig != IntPtr.Zero && sigLen > 0) { SigParser sigParser = new SigParser(sig, sigLen); bool res; int sigType, etype = 0; if (res = sigParser.GetCallingConvInfo(out sigType)) Debug.Assert(sigType == SigParser.IMAGE_CEE_CS_CALLCONV_FIELD); res = res && sigParser.SkipCustomModifiers(); res = res && sigParser.GetElemType(out etype); if (res) { ClrElementType type = (ClrElementType)etype; if (type == ClrElementType.Array) { res = sigParser.PeekElemType(out etype); res = res && sigParser.SkipExactlyOne(); int ranks = 0; res = res && sigParser.GetData(out ranks); if (res) m_type = heap.GetArrayType((ClrElementType)etype, ranks, null); } else if (type == ClrElementType.SZArray) { res = sigParser.PeekElemType(out etype); type = (ClrElementType)etype; if (DesktopRuntimeBase.IsObjectReference(type)) m_type = (BaseDesktopHeapType)heap.GetBasicType(ClrElementType.SZArray); else m_type = (BaseDesktopHeapType)heap.GetArrayType(type, -1, null); } } } if (m_type == null) m_type = (BaseDesktopHeapType)heap.GetBasicType(ElementType); } else if (ElementType != ClrElementType.Class) { m_type.SetElementType(ElementType); } }