Skip to content

Commit

Permalink
Put Crossgen2 in sync with dotnet#54235 (dotnet#54438)
Browse files Browse the repository at this point in the history
  • Loading branch information
trylek authored Jun 23, 2021
1 parent 707cf4f commit d7a5b89
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -782,10 +782,9 @@ public LayoutInt CalculateFieldBaseOffset(MetadataType type, bool requiresAlign8
if (!type.IsValueType && type.HasBaseType)
{
cumulativeInstanceFieldPos = type.BaseType.InstanceByteCountUnaligned;
if (!type.BaseType.InstanceByteCountUnaligned.IsIndeterminate)
if (!cumulativeInstanceFieldPos.IsIndeterminate)
{
cumulativeInstanceFieldPos = type.BaseType.InstanceByteCountUnaligned;
if (type.BaseType.IsZeroSizedReferenceType && ((MetadataType)type.BaseType).HasLayout())
if (requiresAlignedBase && type.BaseType.IsZeroSizedReferenceType && ((MetadataType)type.BaseType).HasLayout())
{
cumulativeInstanceFieldPos += LayoutInt.One;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ public static bool IsBlittableType(TypeDesc type)
&& !baseType.IsWellKnownType(WellKnownType.Object)
&& !baseType.IsWellKnownType(WellKnownType.ValueType);

// Type is blittable only if parent is also blittable and is not empty.
if (hasNonTrivialParent && (!IsBlittableType(baseType) || baseType.IsZeroSizedReferenceType))
// Type is blittable only if parent is also blittable.
if (hasNonTrivialParent && !IsBlittableType(baseType))
{
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ public void IsBlittableType_TypeWithBlittableBase_ReturnsTrue(string className)
[InlineData("ClassWithExplicitEmptyBase")]
[InlineData("ClassWithExplicitEmptySizeZeroBase")]
[InlineData("ClassWithSequentialEmptyBase")]
public void IsBlittableType_TypeWithEmptyBase_ReturnsFalse(string className)
public void IsBlittableType_TypeWithEmptyBase_ReturnsTrue(string className)
{
TypeDesc classWithEmptyBase = _testModule.GetType("Marshalling", className);
Assert.False(MarshalUtils.IsBlittableType(classWithEmptyBase));
Assert.True(MarshalUtils.IsBlittableType(classWithEmptyBase));
}
}
}
3 changes: 0 additions & 3 deletions src/tests/issues.targets
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,6 @@
<ExcludeList Include="$(XunitTestBinBase)/tracing/eventpipe/eventsvalidation/ThreadPool/*">
<Issue>https://github.com/dotnet/runtime/issues/48727</Issue>
</ExcludeList>
<ExcludeList Include="$(XunitTestBinBase)/Interop/LayoutClass/LayoutClassTest/*">
<Issue>https://github.com/dotnet/runtime/issues/54316</Issue>
</ExcludeList>
</ItemGroup>

<!-- All Unix targets on all runtimes -->
Expand Down

0 comments on commit d7a5b89

Please sign in to comment.