forked from dotnet/runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The jit tracks the number of no return calls to determine if it should run throw helper merging and to decide if no return calls should tail called. The accounting is currently done when the calls are initially imported, so if code is duplicated (by say finally cloning the count may end up being an under-estimate. While not a correctness issue, it is better for the count to be accurate (or an over-estimate). So, update the count when cloning a no-return call. Closes dotnet#36584.
- Loading branch information
1 parent
9740aa5
commit eb15919
Showing
3 changed files
with
78 additions
and
0 deletions.
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
56 changes: 56 additions & 0 deletions
56
src/coreclr/tests/src/JIT/Regression/JitBlue/Runtime_36584/Runtime_36584.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,56 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System; | ||
|
||
// Finally cloning creates new throw merge candidates that | ||
// need to be properly counted. | ||
|
||
class Runtime_36584 | ||
{ | ||
static int x; | ||
|
||
static void ThrowHelper() | ||
{ | ||
throw new Exception(); | ||
} | ||
|
||
public static int Main() | ||
{ | ||
x = 100; | ||
|
||
if (x != 100) | ||
{ | ||
ThrowHelper(); | ||
} | ||
|
||
if (x != 100) | ||
{ | ||
ThrowHelper(); | ||
} | ||
|
||
if (x != 100) | ||
{ | ||
try | ||
{ | ||
x++; | ||
} | ||
// This finally will be cloned | ||
finally | ||
{ | ||
if (x != 100) | ||
{ | ||
ThrowHelper(); | ||
} | ||
|
||
if (x != 100) | ||
{ | ||
ThrowHelper(); | ||
} | ||
} | ||
} | ||
|
||
return x; | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
src/coreclr/tests/src/JIT/Regression/JitBlue/Runtime_36584/Runtime_36584.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,13 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<DebugType /> | ||
<Optimize>True</Optimize> | ||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="$(MSBuildProjectName).cs" /> | ||
</ItemGroup> | ||
</Project> |