-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Don't inline expand boxes with many GC pointers #101669
Conversation
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
/benchmark plaintext,json,fortunes aspnet-citrine-win runtime,libs |
Benchmark started for plaintext, json, fortunes on aspnet-citrine-win with runtime, libs. Logs: link |
plaintext - aspnet-citrine-win
json - aspnet-citrine-win
fortunes - aspnet-citrine-win
|
// After a certain number of GC pointers, the write barriers used | ||
// in inline expansion stop being profitable. | ||
ClassLayout* layout = typGetObjLayout(pResolvedToken->hClass); | ||
if (layout->GetGCPtrCount() > 3) |
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 suspect this might need more work, e.g. when we box a struct with 4 fields but all of them are null or e.g. nongc strings - this will be a regression. Also, I suspect this might ruin some "optimize boxing" optimizations.
I think we need to either fix all those places to deal with a helper call or we need to emit a bulk copy in codegen, just like I did in #99096 (but to do it for batched-copy, not batched-precise-barrier).
We have optimized JIT_Box helper variants only on Windows: runtime/src/coreclr/vm/jitinterfacegen.cpp Lines 75 to 88 in f88ab88
|
For ContainsPointers the optimized assembly helper needs to thunk out to C++ anyway so the optimization might not amount to much for the relevant cases. I'll add this to the issue. Not actually planning to work on this based on Egor's comments. |
I can try myself, but I think it should be more or less trivial, you just need to introduce a new helper (where you'll just do |
If we want to keep the NEWS, we might just be able to use the CORINFO_HELP_ASSIGN_STRUCT to do the copying. |
Yep, that's what I meant, the helper is completely unused/unimplemented, so at least we won't have to bump R2R format 🙂 |
No description provided.