Skip to content

Commit

Permalink
Fix subtle difference in x86 alignment with vs. without layout
Browse files Browse the repository at this point in the history
  • Loading branch information
trylek committed Jun 3, 2021
1 parent cabf41c commit 642659b
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -840,13 +840,13 @@ private static SizeAndAlignment ComputeFieldSizeAndAlignment(TypeDesc fieldType,
result.Alignment = fieldType.Context.Target.LayoutPointerSize;
}

if (!hasLayout || fieldType.Context.Target.Architecture != TargetArchitecture.ARM)
if (hasLayout)
{
result.Alignment = LayoutInt.Min(result.Alignment, new LayoutInt(packingSize));
}
else if (packingSize < 8)
else
{
result.Alignment = LayoutInt.Min(result.Alignment, fieldType.Context.Target.LayoutPointerSize);
result.Alignment = LayoutInt.Min(result.Alignment, fieldType.Context.Target.GetObjectAlignment(result.Alignment));
}

return result;
Expand Down

0 comments on commit 642659b

Please sign in to comment.