-
Notifications
You must be signed in to change notification settings - Fork 107
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
Reduce enum stubs codegen with NativeAOT #1441
Reduce enum stubs codegen with NativeAOT #1441
Conversation
Changing this back to draft as it doesn't actually seem to be improving the size. But in both cases, all of this code is guarded under some CsWinRT/src/WinRT.Runtime/Marshalers.cs Lines 1568 to 1581 in ae69551
@MichalStrehovsky would you know why is the linker apparently not respecting this? We're wasting a lot of size just compiling generic versions of all of those helpers that we know could not possibly be used. Why is this happening despite the check? 🤔 |
This is constructing delegates, so:
Without those, the whole program analysis will figure out the targets of reflection before RyuJIT starts eliminating unreachable codepaths and that's a done deal unfortunately. |
Ooh I see, thank you! I guess this is just also blocked by #1444 then and fixing that will also improve this. Thank you! 🙂 |
47e4332
to
bba9b52
Compare
@MichalStrehovsky I don't get how this is still regressing on .NET 9, and we're not using With roots like this one: I don't understand where are all of those generic instantiations coming from and on what closure. This PR literally only removes an existing lambda expression and replaces it with a cached, reused delegate. The weird thing is that I also don't see any generic instantiation over |
Chatted with Michal, publishing this as it's not actually regressing, just not improving much. |
bba9b52
to
47050b1
Compare
This PR includes some optimizations to reduce the codegen a bit more for
Marshaler<T>
with enum types.It also is a little performance optimizations in that all shared stubs are now properly cached with
beforefieldinit
too.