Repository navigation
Fix auto-layout gap filling for derived classes - #138180
Open
jkoritzinsky wants to merge 1 commit into
Open
jkoritzinsky wants to merge 1 commit into
jkoritzinsky wants to merge 1 commit into
Conversation
Co-authored-by: Copilot App <[email protected]>
|
Azure Pipelines: Successfully started running 3 pipeline(s). 12 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @agocke |
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the auto-layout gap-filling change.
No open issues 🎉
What changed in this PR
Fixes CoreCLR auto-layout gap filling so derived fields do not overlap base or struct fields when a struct’s byte size is mistaken for a primitive size class.
Changes:
- Excludes by-value fields from the gap-filling candidate scan while preserving GC-reference handling.
- Adds four regression cases covering one-byte and empty structs, reference and
longfields, and overlap with a later struct field.
| File | Description |
|---|---|
| src/tests/Loader/classloader/SequentialLayout/ManagedSequential/ManagedSequential.cs | Adds field-value checks that detect layout overlap across four regression cases. |
| src/coreclr/vm/methodtablebuilder.cpp | Filters out by-value fields when selecting the next gap-filling candidate. |
Review effort: Balanced
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Auto-layout gap filling can confuse a by-value field's size in bytes with a primitive field's logarithmic size class. This can place derived fields over base or struct fields, silently corrupting data.
Exclude by-value fields from the candidate scan while preserving GC-reference handling. Add regression cases for one-byte and empty structs, reference and
longfields, and overlap with a later struct field.Validation on Windows x64:
.\build.cmd clr+libs+host -rc Checked: passed on the unfixed baseline..\build.cmd clr.runtime -rc Checked: passed after the fix..\src\tests\build.cmd x64 Checked -GenerateLayoutOnly /p:LibrariesConfiguration=Debug /p:HostConfiguration=Debug: passed.ManagedSequentialrunner: all 10 tests passed with the fixed runtime, both normally and with ReadyToRun and tiering disabled.Resolves #138000
Note
This pull request description was generated with GitHub Copilot.