[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. |
jeffschwMSFT
left a comment
There was a problem hiding this comment.
lgtm. please get a code review. we will take for consideration in 9.0.x
carlossanlop
left a comment
There was a problem hiding this comment.
@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.
|
@carlossanlop I retargeted this, but you are still set as changes requested. Can it be merged? |
|
once ready, this can be merged |
|
Ping @carlossanlop |
|
So we aiming to 9.0.2 now? |
Yes, it's looking like this fix will be published with the January servicing release at this point. |
|
9.0.2 is our February servicing release |
|
My apologies @kirsan31, it looks like I dropped the ball here on getting this PR merged in time for the first servicing release (which I believe to be the January one). |
|
/ba-g Failures are known |
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.Afield to a local, and so must ensure that all calls toUsehave the correct value, even if an exception is thrown. If the exception site is within a type test (here induced by the(int?)ocast) 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.