-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Record struct packing even when falling back to auto layout #116608
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request fixes the record struct packing for cases that fall back to auto layout. Key changes include:
- Adding new tests in StructPacking.cs (TestAction and an overload for Test) to verify expected native sizes.
- Setting the packing size explicitly when using Auto layout in methodtablebuilder.cpp.
- Consolidating the SetPackingSize implementation in class.h by removing a duplicate definition.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
src/tests/Interop/StructPacking/StructPacking.cs | Adds tests for struct packing validation using different layouts. |
src/coreclr/vm/methodtablebuilder.cpp | Explicitly sets the packing size for auto layout cases. |
src/coreclr/vm/class.h | Removes the duplicate SetPackingSize to avoid redundancy. |
Comments suppressed due to low confidence (2)
src/tests/Interop/StructPacking/StructPacking.cs:139
- The new TestAction method adds tests to validate struct packing behavior when falling back to auto layout. Verify that these tests comprehensively cover the scenarios for both 64-bit and 32-bit processes.
// Test data types that invalidate managed sequential layout
src/coreclr/vm/class.h:463
- The duplicate implementation of SetPackingSize has been removed. Ensure that all external references now use the remaining version without any side effects.
void SetPackingSize(BYTE cbPackingSize)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
/backport to release/10.0-preview6 |
Started backporting to release/10.0-preview6: https://github.com/dotnet/runtime/actions/runs/15720419045 |
/ba-g failures unrelated |
Fixes #116475