Skip to content

Commit 9ad2183

Browse files
committed
Put Crossgen2 in sync with dotnet#54235
1 parent 4fd380a commit 9ad2183

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

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

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -782,13 +782,8 @@ public LayoutInt CalculateFieldBaseOffset(MetadataType type, bool requiresAlign8
782782
if (!type.IsValueType && type.HasBaseType)
783783
{
784784
cumulativeInstanceFieldPos = type.BaseType.InstanceByteCountUnaligned;
785-
if (!type.BaseType.InstanceByteCountUnaligned.IsIndeterminate)
785+
if (!cumulativeInstanceFieldPos.IsIndeterminate)
786786
{
787-
cumulativeInstanceFieldPos = type.BaseType.InstanceByteCountUnaligned;
788-
if (type.BaseType.IsZeroSizedReferenceType && ((MetadataType)type.BaseType).HasLayout())
789-
{
790-
cumulativeInstanceFieldPos += LayoutInt.One;
791-
}
792787
AlignBaseOffsetIfNecessary(type, ref cumulativeInstanceFieldPos, requiresAlign8, requiresAlignedBase);
793788
}
794789
}

src/coreclr/tools/Common/TypeSystem/Interop/IL/MarshalUtils.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ public static bool IsBlittableType(TypeDesc type)
2323
&& !baseType.IsWellKnownType(WellKnownType.Object)
2424
&& !baseType.IsWellKnownType(WellKnownType.ValueType);
2525

26-
// Type is blittable only if parent is also blittable and is not empty.
27-
if (hasNonTrivialParent && (!IsBlittableType(baseType) || baseType.IsZeroSizedReferenceType))
26+
// Type is blittable only if parent is also blittable.
27+
if (hasNonTrivialParent && !IsBlittableType(baseType))
2828
{
2929
return false;
3030
}

0 commit comments

Comments
 (0)