Skip to content

Commit d7a5b89

Browse files
authored
Put Crossgen2 in sync with #54235 (#54438)
1 parent 707cf4f commit d7a5b89

File tree

4 files changed

+6
-10
lines changed

4 files changed

+6
-10
lines changed

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -782,10 +782,9 @@ 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())
787+
if (requiresAlignedBase && type.BaseType.IsZeroSizedReferenceType && ((MetadataType)type.BaseType).HasLayout())
789788
{
790789
cumulativeInstanceFieldPos += LayoutInt.One;
791790
}

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
}

src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/MarshalUtilsTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ public void IsBlittableType_TypeWithBlittableBase_ReturnsTrue(string className)
7474
[InlineData("ClassWithExplicitEmptyBase")]
7575
[InlineData("ClassWithExplicitEmptySizeZeroBase")]
7676
[InlineData("ClassWithSequentialEmptyBase")]
77-
public void IsBlittableType_TypeWithEmptyBase_ReturnsFalse(string className)
77+
public void IsBlittableType_TypeWithEmptyBase_ReturnsTrue(string className)
7878
{
7979
TypeDesc classWithEmptyBase = _testModule.GetType("Marshalling", className);
80-
Assert.False(MarshalUtils.IsBlittableType(classWithEmptyBase));
80+
Assert.True(MarshalUtils.IsBlittableType(classWithEmptyBase));
8181
}
8282
}
8383
}

src/tests/issues.targets

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,6 @@
123123
<ExcludeList Include="$(XunitTestBinBase)/tracing/eventpipe/eventsvalidation/ThreadPool/*">
124124
<Issue>https://github.com/dotnet/runtime/issues/48727</Issue>
125125
</ExcludeList>
126-
<ExcludeList Include="$(XunitTestBinBase)/Interop/LayoutClass/LayoutClassTest/*">
127-
<Issue>https://github.com/dotnet/runtime/issues/54316</Issue>
128-
</ExcludeList>
129126
</ItemGroup>
130127

131128
<!-- All Unix targets on all runtimes -->

0 commit comments

Comments
 (0)