Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -953,15 +953,17 @@ private static TypeDesc GetActualTemplateTypeForType(NodeFactory factory, TypeDe

private ISymbolNode GetStaticsNode(NodeFactory context, out BagElementKind staticsBagKind)
{
ISymbolNode symbol = context.GCStaticEEType(GCPointerMap.FromStaticLayout(_type.GetClosestDefType()));
DefType closestCanonDefType = (DefType)_type.GetClosestDefType().ConvertToCanonForm(CanonicalFormKind.Specific);
ISymbolNode symbol = context.GCStaticEEType(GCPointerMap.FromStaticLayout(closestCanonDefType));
staticsBagKind = BagElementKind.GcStaticDesc;

return symbol;
}

private ISymbolNode GetThreadStaticsNode(NodeFactory context, out BagElementKind staticsBagKind)
{
ISymbolNode symbol = context.GCStaticEEType(GCPointerMap.FromThreadStaticLayout(_type.GetClosestDefType()));
DefType closestCanonDefType = (DefType)_type.GetClosestDefType().ConvertToCanonForm(CanonicalFormKind.Specific);
ISymbolNode symbol = context.GCStaticEEType(GCPointerMap.FromThreadStaticLayout(closestCanonDefType));
staticsBagKind = BagElementKind.ThreadStaticDesc;

return symbol;
Expand Down Expand Up @@ -997,13 +999,14 @@ public override IEnumerable<DependencyListEntry> GetStaticDependencies(NodeFacto

if (!_isUniversalCanon)
{
if (_type.GetClosestDefType().GCStaticFieldSize.AsInt > 0)
DefType closestCanonDefType = (DefType)_type.GetClosestDefType().ConvertToCanonForm(CanonicalFormKind.Specific);
if (closestCanonDefType.GCStaticFieldSize.AsInt > 0)
{
BagElementKind ignored;
yield return new DependencyListEntry(GetStaticsNode(context, out ignored), "type gc static info");
}

if (_type.GetClosestDefType().ThreadGcStaticFieldSize.AsInt > 0)
if (closestCanonDefType.ThreadGcStaticFieldSize.AsInt > 0)
{
BagElementKind ignored;
yield return new DependencyListEntry(GetThreadStaticsNode(context, out ignored), "type thread static info");
Expand Down Expand Up @@ -1207,24 +1210,24 @@ public override Vertex WriteVertex(NodeFactory factory)

if (!_isUniversalCanon)
{
DefType closestDefType = _type.GetClosestDefType();
if (closestDefType.NonGCStaticFieldSize.AsInt != 0)
DefType closestCanonDefType = (DefType)_type.GetClosestDefType().ConvertToCanonForm(CanonicalFormKind.Specific);
if (closestCanonDefType.NonGCStaticFieldSize.AsInt != 0)
{
layoutInfo.AppendUnsigned(BagElementKind.NonGcStaticDataSize, checked((uint)closestDefType.NonGCStaticFieldSize.AsInt));
layoutInfo.AppendUnsigned(BagElementKind.NonGcStaticDataSize, checked((uint)closestCanonDefType.NonGCStaticFieldSize.AsInt));
}

if (closestDefType.GCStaticFieldSize.AsInt != 0)
if (closestCanonDefType.GCStaticFieldSize.AsInt != 0)
{
layoutInfo.AppendUnsigned(BagElementKind.GcStaticDataSize, checked((uint)closestDefType.GCStaticFieldSize.AsInt));
layoutInfo.AppendUnsigned(BagElementKind.GcStaticDataSize, checked((uint)closestCanonDefType.GCStaticFieldSize.AsInt));
BagElementKind staticDescBagType;
ISymbolNode staticsDescSymbol = GetStaticsNode(factory, out staticDescBagType);
uint gcStaticsSymbolIndex = factory.MetadataManager.NativeLayoutInfo.StaticsReferences.GetIndex(staticsDescSymbol);
layoutInfo.AppendUnsigned(staticDescBagType, gcStaticsSymbolIndex);
}

if (closestDefType.ThreadGcStaticFieldSize.AsInt != 0)
if (closestCanonDefType.ThreadGcStaticFieldSize.AsInt != 0)
{
layoutInfo.AppendUnsigned(BagElementKind.ThreadStaticDataSize, checked((uint)closestDefType.ThreadGcStaticFieldSize.AsInt));
layoutInfo.AppendUnsigned(BagElementKind.ThreadStaticDataSize, checked((uint)closestCanonDefType.ThreadGcStaticFieldSize.AsInt));
BagElementKind threadStaticDescBagType;
ISymbolNode threadStaticsDescSymbol = GetThreadStaticsNode(factory, out threadStaticDescBagType);
uint threadStaticsSymbolIndex = factory.MetadataManager.NativeLayoutInfo.StaticsReferences.GetIndex(threadStaticsDescSymbol);
Expand Down