Skip to content

Commit f14893c

Browse files
committed
Remove the duplicate base type size quirk per JanK's PR feedback
1 parent 642659b commit f14893c

1 file changed

Lines changed: 0 additions & 9 deletions

File tree

src/coreclr/tools/Common/TypeSystem/Common/MetadataFieldLayoutAlgorithm.cs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -313,15 +313,6 @@ protected ComputedInstanceFieldLayout ComputeExplicitFieldLayout(MetadataType ty
313313
// It is calculated as the field whose offset and size add to the greatest value.
314314
LayoutInt offsetBias = !type.IsValueType ? new LayoutInt(type.Context.Target.PointerSize) : LayoutInt.Zero;
315315
LayoutInt cumulativeInstanceFieldPos = CalculateFieldBaseOffset(type, requiresAlign8: false, requiresAlignedBase: false) - offsetBias;
316-
if (!type.IsValueType)
317-
{
318-
// CoreCLR runtime has a bug in field offset calculation in the presence of class inheritance
319-
// and explicit layout: in classlayoutinfo.cpp, the calculated layout adds base class size to
320-
// field offsets (so that they are instance-relative) but HandleExplicitLayout in methodtablebuilder
321-
// treats them as relative to the 'instance slice' which is offset by the base class size once more,
322-
// effectively doubling the base class offset.
323-
cumulativeInstanceFieldPos = cumulativeInstanceFieldPos + cumulativeInstanceFieldPos;
324-
}
325316
LayoutInt instanceSize = cumulativeInstanceFieldPos + offsetBias;
326317

327318
var layoutMetadata = type.GetClassLayout();

0 commit comments

Comments
 (0)