Inline access to non-GC static fields#5131
Inline access to non-GC static fields#5131MichalStrehovsky wants to merge 5 commits intodotnet:masterfrom
Conversation
|
This is still asserting RyuJIT. This looks like another RyuJIT bug in the rarely used area but this time I don't have a repro with CoreCLR. I'm going to let this pull request sit until we decide that this is the direction we want. I don't want to engage RyuJIT team on this unless we have to. |
These parts sound good to me.
I think that it would be better to keep providing baseAddress + offset and let the JIT to figure out the address mode. It is beneficial on non-Intel where computing absolute address is relatively expensive and so you want JIT to CSE the baseAddress. (Intel can benefit from it in some less common cases - when optimizing for code size.) |
|
Closing stale PRs |
An alternate approach to what was attempted in #3962 (and dotnet/coreclr#12420), this time leveraging preexisting infrastructure in RyuJIT built for accessing RVA static fields. This is limited to non-GC statics, since that's what RyuJIT has.
It feels a bit more natural to how JitInterface is structured (e.g. RyuJIT is calling
initClassto eliminate the need to do the cctor check in some cases). If this is something we would want to take further, the next steps would be:initClassto allow generating the inline cctor check (we currently call the ReadyToRun helper to get non-GC static base - this change doesn't affect that).CORINFO_FIELD_INFO- replaceCORINFO_CONST_LOOKUP fieldLookupwithCORINFO_LOOKUP fieldLookupso that we can also do this from shared code.I don't have plans to do the next steps anytime soon though.
The changes to the generated code look like this:
Before:
After: