-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JIT: Handle memory conservatively in handler blocks in VN (#106274)
SSA does not model memory SSA faithfully inside try clauses. To model it faithfully we would need to make all intermediate memory states in the try block visible to the handler block. Doing so would require teaching SSA about all nodes that define memory, and introduce a bunch of new memory SSA states for EH constructs. Instead of doing that this PR makes VN treat any handler block with multiple incoming memory states (meaning that memory changed during the try) conservatively. The diffs seem small enough; we can consider a more elaborate fix in .NET 10. Fix #86112
- Loading branch information
1 parent
2ba659b
commit f18294b
Showing
3 changed files
with
54 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
src/tests/JIT/Regression/JitBlue/Runtime_86112/Runtime_86112.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System; | ||
using System.Runtime.CompilerServices; | ||
using Xunit; | ||
|
||
public class Runtime_86112 | ||
{ | ||
static int _intStatic; | ||
|
||
[Fact] | ||
public static int Problem() | ||
{ | ||
[MethodImpl(MethodImplOptions.NoInlining)] | ||
static void Throw() | ||
{ | ||
_intStatic = 1; | ||
throw new Exception(); | ||
} | ||
|
||
_intStatic = 2; | ||
|
||
try | ||
{ | ||
Throw(); | ||
_intStatic = 2; | ||
} | ||
catch (Exception) | ||
{ | ||
if (_intStatic == 2) | ||
{ | ||
return 101; | ||
} | ||
} | ||
|
||
return 100; | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
src/tests/JIT/Regression/JitBlue/Runtime_86112/Runtime_86112.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<Optimize>True</Optimize> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="$(MSBuildProjectName).cs" /> | ||
</ItemGroup> | ||
</Project> |