Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Apply feedback
  • Loading branch information
filipnavara authored and github-actions committed Sep 23, 2022
commit 7e819976cb91ea0b9cafcd8de3e344065927afef
2 changes: 0 additions & 2 deletions src/coreclr/tools/Common/TypeSystem/Common/TargetDetails.cs
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,6 @@ public int MinimumCodeAlignment
}
}

public int MinimumObjectSize => PointerSize * 3;

public TargetDetails(TargetArchitecture architecture, TargetOS targetOS, TargetAbi abi)
{
Architecture = architecture;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,10 @@ public override ObjectNodeSection Section
}
}

public int MinimumObjectSize => _type.Context.Target.MinimumObjectSize;
public int MinimumObjectSize => GetMinimumObjectSize(_type.Context);

public static int GetMinimumObjectSize(TypeSystemContext typeSystemContext)
=> typeSystemContext.Target.PointerSize * 3;

protected virtual bool EmitVirtualSlotsAndInterfaces => false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,20 @@ int ISymbolDefinitionNode.Offset

public override void EncodeData(ref ObjectDataBuilder dataBuilder, NodeFactory factory, bool relocsOnly)
{
int initialOffset = dataBuilder.CountBytes;

// Sync Block
dataBuilder.EmitZeroPointer();

// byte contents
_data.WriteContent(ref dataBuilder, this, factory);

int objectSize = dataBuilder.CountBytes - initialOffset;
int minimumObjectSize = EETypeNode.GetMinimumObjectSize(factory.TypeSystemContext);
if (objectSize < minimumObjectSize)
{
dataBuilder.EmitZeros(minimumObjectSize - objectSize);
}
}

protected override string GetName(NodeFactory factory) => this.GetMangledName(factory.NameMangler);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2234,7 +2234,6 @@ public ObjectInstance(DefType type, AllocationSite allocationSite)
int size = type.InstanceByteCount.AsInt;
if (type.IsValueType)
size += type.Context.Target.PointerSize;
size = Math.Max(size, type.Context.Target.MinimumObjectSize - type.Context.Target.PointerSize);
_data = new byte[size];
}

Expand Down