| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Group class-based layouts with GC pointers into equivalence classes of compatible layouts maintained via a DSU parent pointer, so that ClassLayout::AreCompatible compares class representatives instead of walking all GC slots on every call. The previous slot-by-slot comparison is kept as ClassLayout::AreCompatibleSlow; it is used to join a newly created layout with the representative of its class and to verify the DSU-based result in DEBUG builds. Copies between distinct but layout-compatible structs used to make JIT compilation time quadratic in the number of GC slots times the number of copies; the compatibility check is now O(1). Add src/tests/JIT/opt/Structs/StructCopyCompatibleLayouts.cs with two 1000-field structs of identical layout and 2000 straight-line copies between them, asserting value and GC-reference preservation. Fixes dotnet#42801
|
Azure Pipelines: Successfully started running 5 pipeline(s). 11 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Sorry, something went wrong.
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
Sorry, something went wrong.
Use the existing slow comparison for mixed custom and class-based layouts. Custom layouts have no DSU parent and cannot use the representative comparison. Validated extracted compatibility methods in checked, release and sanitized harnesses over 104,976 pairs. Full JIT build and execution were not run in this environment. AI assistance was used to prepare and validate this change.
|
@dotnet-policy-service agree |
Sorry, something went wrong.
|
For head d45ebc7, the failing SuperPMI tpdiff run has two concrete tooling errors: the windows-x64-2 Helix log reports Intel Pin PrepareToAttach(): Current thread holds VM lock, followed by a missing *_details.csv; the summary step fails in superpmi.py with ValueError: too many values to unpack (expected 5). Could a maintainer advise whether these match a known build error and what the appropriate next step is? These logs alone do not establish whether the PR caused the failure. AI-generated diagnostic, posted on behalf of the PR author. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Fixes #42801
Description
ClassLayout::AreCompatible compared the GC slots of the two layouts one by one on every call, i.e. O(slot count) per call. With many distinct but layout-compatible struct types and many copies between them, JIT compilation time was quadratic in (slots × copies).
This change groups class-based layouts with GC pointers into equivalence classes of compatible layouts using a disjoint-set-union structure:
Custom and block layouts keep the existing pointer-equality path, and non-GC layouts keep the existing early-out path.
Note on the approach vs the issue: the issue proposed building the DSU lazily on the first AreCompatible call (InitDSU + a static initialized flag). This implementation instead maintains the structure incrementally at layout creation time, which keeps AreCompatible parameterless and bounds the extra creation-time cost to one slot-by-slot comparison per same-size representative per created layout (zero for custom, block and non-GC layouts).
Customer Impact
None known today — the issue notes there are currently no known scenarios where this affects JitCompilationTime. This removes the quadratic JIT compilation-time behavior for methods with many copies between distinct but layout-compatible structs, in anticipation of more AreCompatible usages.
Regression?
Testing
Risk
Low: the equivalence classes are validated against the previous algorithm on every AreCompatible call in DEBUG/Checked builds; custom, block and non-GC layouts are unaffected.