Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
3c4ccbc
Change all "unmanaged" (no GC fields) sequential types to have sequen…
jkoritzinsky Nov 18, 2021
6b9e41d
Merge branch 'main' into managedseqential_unmanaged
jkoritzinsky Nov 18, 2021
b85447d
Fix inverted condition
jkoritzinsky Nov 19, 2021
0ff8540
Account for RequiresAlign8 for auto-layout nested structs in sequenti…
jkoritzinsky Nov 22, 2021
c6ee36d
Clean up R2R layout algorithm's handling of the new managed-sequentia…
jkoritzinsky Nov 29, 2021
99c0244
Update src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRu…
jkoritzinsky Nov 30, 2021
0ec572a
Try to remove the explicit layout quirk by following the behavior in …
jkoritzinsky Nov 30, 2021
e2589f3
Fix missed cast.
jkoritzinsky Nov 30, 2021
1744d82
Update src/coreclr/tools/Common/TypeSystem/Common/MetadataFieldLayout…
jkoritzinsky Nov 30, 2021
bbaa220
AlignUp the right variable.
jkoritzinsky Nov 30, 2021
7afb6d2
Remove alignUpInstanceByteSize parameter as it's always true
jkoritzinsky Nov 30, 2021
f8f8390
Merge branch 'main' of github.com:dotnet/runtime into managedseqentia…
jkoritzinsky Nov 30, 2021
0e317fe
Make enums use sequential layout again since the auto-layout algorith…
jkoritzinsky Nov 30, 2021
f174cad
Remove HasLayoutMetadata branch and method since the only cases where…
jkoritzinsky Nov 30, 2021
6a90bb3
Handle enum alignment concerns while allowing enums themselves to hav…
jkoritzinsky Dec 3, 2021
880430a
Update the auto-layout algorithm to better track alignment requiremen…
jkoritzinsky Dec 8, 2021
83e7c80
Merge branch 'main' of github.com:dotnet/runtime into managedseqentia…
jkoritzinsky Dec 9, 2021
91df6da
Remove now-invalid alignment fixup
jkoritzinsky Dec 9, 2021
8196fbe
Handle the case of an auto-layout struct as a field in another struct.
jkoritzinsky Dec 9, 2021
da12b83
Store the custom alignment requirement for layoutkind.auto value type…
jkoritzinsky Dec 10, 2021
47c95bf
Update StructPacking test based on failures.
jkoritzinsky Dec 10, 2021
c309a69
Fix more of the struct packing test results
jkoritzinsky Dec 10, 2021
6cfe0c7
Don't double-count the adjustment for auto-layout reference type base…
jkoritzinsky Dec 10, 2021
f6af360
Fix GCSeries calculation for platforms that have the specialized alig…
jkoritzinsky Dec 10, 2021
66f80e8
Update check to specifically check if the base size is pointer sized.…
jkoritzinsky Dec 10, 2021
8501319
Update StructPacking.cs for arm and arm64 (we now respect alignment r…
jkoritzinsky Dec 10, 2021
1b9eda3
Fix default packing size calculations
jkoritzinsky Dec 10, 2021
2f74ce3
Try one more change to fix the last issue
jkoritzinsky Dec 11, 2021
c98ae95
Cleanup and update some corner cases of the managed-sequential case.
jkoritzinsky Dec 13, 2021
966af36
Fix nites.
jkoritzinsky Dec 13, 2021
ae9aa6c
Fix some copy-paste issues.
jkoritzinsky Dec 13, 2021
842aef2
Fix ->/. typo
jkoritzinsky Dec 13, 2021
d269851
Fix disqualifying from managed-sequential when RequiresAlign8 is true…
jkoritzinsky Dec 13, 2021
e423c3c
Update x86 tests that check sizeof for types that have changed size.
jkoritzinsky Dec 14, 2021
a1bc86e
Fix Align8 candidate calculation to not account for packing for auto-…
jkoritzinsky Dec 14, 2021
53e5644
Merge branch 'managedseqential_unmanaged' of github.com:jkoritzinsky/…
jkoritzinsky Dec 14, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix default packing size calculations
  • Loading branch information
jkoritzinsky committed Dec 10, 2021
commit 1b9eda368f9020dad418f56cadff0b59da5a38c1
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@ private static LayoutInt AlignUpInstanceFieldOffset(TypeDesc typeWithField, Layo

protected ComputedInstanceFieldLayout ComputeSequentialFieldLayout(MetadataType type, int numInstanceFields)
{
if (type.Name == "TimeSpan") System.Diagnostics.Debugger.Break();
var offsets = new FieldAndOffset[numInstanceFields];

// For types inheriting from another type, field offsets continue on from where they left off
Expand Down Expand Up @@ -432,14 +433,14 @@ protected virtual void AlignBaseOffsetIfNecessary(MetadataType type, ref LayoutI

protected ComputedInstanceFieldLayout ComputeAutoFieldLayout(MetadataType type, int numInstanceFields)
{
if (type.Name == "UnmanagedMemoryStream") System.Diagnostics.Debugger.Break();
if (type.Name == "DateTimeResult") System.Diagnostics.Debugger.Break();
TypeSystemContext context = type.Context;

bool hasLayout = type.HasLayout();
var layoutMetadata = type.GetClassLayout();

int packingSize = ComputePackingSize(type, layoutMetadata);
packingSize = Math.Min(context.Target.MaximumAutoLayoutPackingSize, packingSize);
// Auto-layout in CoreCLR does not respect packing size.
int packingSize = type.Context.Target.MaximumAlignment;

var offsets = new FieldAndOffset[numInstanceFields];
int fieldOrdinal = 0;
Expand Down Expand Up @@ -815,7 +816,7 @@ private static SizeAndAlignment ComputeFieldSizeAndAlignment(TypeDesc fieldType,
private static int ComputePackingSize(MetadataType type, ClassLayoutMetadata layoutMetadata)
{
if (layoutMetadata.PackingSize == 0)
return type.Context.Target.DefaultPackingSize;
return type.Context.Target.MaximumAlignment;
else
return layoutMetadata.PackingSize;
}
Expand Down
15 changes: 0 additions & 15 deletions src/coreclr/tools/Common/TypeSystem/Common/TargetDetails.cs
Original file line number Diff line number Diff line change
Expand Up @@ -324,20 +324,5 @@ public int MaxHomogeneousAggregateElementCount
return 4;
}
}

public int MaximumAutoLayoutPackingSize
{
get
{
if (Abi == TargetAbi.CoreRT)
{
if (Architecture == TargetArchitecture.X86)
{
return PointerSize;
}
}
return MaximumAlignment;
}
}
}
}