-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Allocate Array.Empty<> on a frozen segment (NonGC heap) #85559
Conversation
Although, I assume I'd better land a workaound to detect EmptyArray's cctor shape to emit a frozen allocator in JIT. Will see if I can do it easily |
@jkotas @MichalStrehovsky I'm a bit lost here - can you please point me where R2R helper can be mapped to a VM function? I basically want |
Ah, I think I've figured that out, just not sure if I bumped R2R version correctly (maybe a minor version change is enough?) |
Right, this does not need |
/azp run runtime-coreclr outerloop |
Azure Pipelines successfully started running 1 pipeline(s). |
@jkotas when you have time can you please review VM/CG2 side? I've added an allocator for non-array too but that is not used currently, I want to work separately on a phase to do a proper analysis and emit them less conservatively for many types of objects and e.g. initialized arrays. Currently, it only works for
works. I've also verified that the allocators work in both R2R and only-JIT modes |
LGTM otherwise |
@jakobbotsch @AndyAyersMS @dotnet/jit-contrib Please, sign off the JIT side - it should be simple at this point, recognizes a fixed IL pattern. I'll remove that once I come up with a smarter phase to insert allocators (already have a prototype) Also, I've removed some |
Co-authored-by: Jakob Botsch Nielsen <Jakob.botsch.nielsen@gmail.com>
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.
JIT changes LGTM assuming we can generalize it more in the future.
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.
I realize it's tempting to aggregate a bunch of jit interface changes to minimize some of the churn, but I'd really like to see PRs like this split into two -- one for things that should be no diff and another for things that that cause diffs.
This is exactly what I do in this PR - I add new helpers and plan to actively use them in a separate PR. In this PR I only added |
Contributes to #76151 (implements @jkotas's suggestion to put empty arrays on FOH). Initial infrastructure to emit "frozen" allocators instead of normal ones for
newobj
,newarr
in static constructors. Basically, we wantstatic readonly <gcref>
fields to be allocated on frozen segments since they're immortal. It gives us:Codegen improvement example:
Also, works for user-defined arrays: