-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Do not remove boxing for struct methods which my expose references to their fields #121396
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
base: main
Are you sure you want to change the base?
Conversation
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
|
|
||
| result = (CORINFO_METHOD_HANDLE)pUnboxedMD; | ||
| requiresInstMTArg = !!pUnboxedMD->RequiresInstMethodTableArg(); | ||
| // Give up on methods which may potentially expose byrefs to struct's fields: |
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.
This makes assumptions about the kind of optimizations that the JIT may perform. Should this check be done by the JIT, or be explicitly requested in the JIT/EE API?
| // Give up on methods which may potentially expose byrefs to struct's fields: | ||
| // * byref return types | ||
| // * byref-like return types | ||
| // * byref to byref-like types in parameters |
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.
What about a native pointer to a byref like type? Or worse, a void pointer cast in the body to a pointer to a byref like type.
I'm curious what exposed the problem here. It reminds me of the "unboxing of nullables" case a little bit where we don't produce a heap pointer. I wonder if we have to spec ourselves into being allowed to do this optimization.
(More robust would probably be to remove the box when we can prove that it doesn't escape.)
No description provided.