Uh oh!
There was an error while loading. Please reload this page.
Don't inline expand boxes with many GC pointers - #101669
Conversation
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
MichalStrehovsky
commented
Apr 29, 2024
/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.
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).
jkotas
commented
Apr 29, 2024
We have optimized JIT_Box helper variants only on Windows: runtime/src/coreclr/vm/jitinterfacegen.cpp Lines 75 to 88 in f88ab88 |
MichalStrehovsky
commented
Apr 29, 2024
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. |
EgorBo
commented
Apr 29, 2024
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 |
MichalStrehovsky
commented
Apr 29, 2024
If we want to keep the NEWS, we might just be able to use the CORINFO_HELP_ASSIGN_STRUCT to do the copying. |
EgorBo
commented
Apr 29, 2024
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.