-
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
[release/9.0-staging] JIT: Read back all replacements before statements with implicit EH control flow #109143
base: release/9.0-staging
Are you sure you want to change the base?
[release/9.0-staging] JIT: Read back all replacements before statements with implicit EH control flow #109143
Conversation
…ntrol flow Physical promotion sometimes needs to insert read backs of all stale pending replacements when it encounters potential implicit EH control flow (that is, intra-function control flow because of locally caught exceptions). It would be possible for this to interact with QMARKs such that we inserted readbacks inside one of the branches, yet believed we had read back the replacement on all paths. The fix here is to indiscriminately start reading back all replacements before a statement that may cause potential intra-function control flow to occur. Fix #108969
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
This one should target 9.0-staging, but looks like that branch doesn't exist yet. |
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.
lgtm. please get a code review. we will take for consideration in 9.0.x
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.
@jakobbotsch - Please retarget this PR to the release/9.0-staging branch.
You can retarget to that branch by clicking on the Edit button on the top right (next to the PR title) and choosing the release/9.0-staging branch from the dropdown. Important: Please make sure you don't bring any unrelated changes from the release/9.0 branch when retargeting to release/9.0-staging.
Backport of #109107 to release/9.0
/cc @jakobbotsch
Customer Impact
#108969
Silent bad code generation in some cases involving structs, type tests, and exception handling. Programs may unexpectedly crash or compute incorrectly.
As an example, given
The JIT will promote the
v.A
field to a local, and so must ensure that all calls toUse
have the correct value, even if an exception is thrown. If the exception site is within a type test (here induced by the(int?)o
cast) or similar construct within a try, then value of the promoted local may not be initialized correctly.There is a workaround (using the undocumented env var
DOTNET_JitEnablePhysicalPromotion=0
) but it will not be easy for customers to determine the underlying problem and realize there is a workaround available.Regression
Regression from .NET 8.
Testing
Verified on the example in #108969 and new test case added to capture this particular pattern.
Risk
Low. The fix is fairly surgical. A small number of methods impacted in our SPMI suite.