-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Using canonical All-pointers GC desc in more scenarios. #83800
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
|
Lots of failures... |
|
I realized that couple of changes are not necessary and reverted them right before staging the PR. |
|
I've tried collecting crude statistics of how often the optimizations make a difference in Libraries testcases. It varies a lot, but in general I see:
|
|
|
||
| // ====================== GCDescOpt ========================================================== | ||
|
|
||
| [Fact] |
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.
This test will need to be disabled for Mono
jkotas
left a comment
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.
LGTM!
|
Thanks!! |
Re: #82744 (comment)
Fixes: #83111
Turns out NativeAOT already emits optimized GC descs. That just follows from the implementation that builds complete pointer maps and scans them for series. Array-of-all-pointer-structs cases were not considered on some code paths though.
In the most general case CoreClr builds GC descs by appending GC descs of constituent parts - the base class and struct fields. It does use the compact "all-pointers" form, but only for object arrays.
With this change we detect most of the cases of all-pointers instances and use a compact 1-serie GC desc.
This is not a 100% match of the optimal GC descs produced by NativeAOT.
For example NativeAOT will naturally coalesce adjacent all-pointers structs in the middle of an instance into one contiguous GC serie. NativeAOT has more time and more motivation for this (the number of statically required method tables could be a lot higher than what is actually used at run time and using more compact forms reduces size).
For the JIT scenario, handling "all-pointers" seems good enough and also what we can do cheaply and allocation-free at JIT time.