-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JIT: Expand inlined delegate calls in correct order (#89175)
The access of the target instance was incorrectly inserted right after the location of the delegate instance. Since this indirection can throw a NRE this is incorrect; to get the proper inlined behavior, the indirection must happen only after all arguments have been evaluated. Fix #75832
- Loading branch information
1 parent
4cbf8bd
commit 3db5172
Showing
3 changed files
with
54 additions
and
2 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
38 changes: 38 additions & 0 deletions
38
src/tests/JIT/Regression/JitBlue/Runtime_75832/Runtime_75832.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,38 @@ | ||
// 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_75832 | ||
{ | ||
[Fact] | ||
public static int TestEntryPoint() | ||
{ | ||
try | ||
{ | ||
Test(0); | ||
Console.WriteLine("FAIL: No exception thrown"); | ||
} | ||
catch (DivideByZeroException) | ||
{ | ||
return 100; | ||
} | ||
catch (Exception ex) | ||
{ | ||
Console.WriteLine("FAIL: Caught {0}", ex.GetType().Name); | ||
} | ||
|
||
return 101; | ||
} | ||
|
||
[MethodImpl(MethodImplOptions.NoInlining)] | ||
private static void Test(int i) | ||
{ | ||
GetAction()(100 / i); | ||
} | ||
|
||
[MethodImpl(MethodImplOptions.NoInlining)] | ||
private static Action<int> GetAction() => null; | ||
} |
9 changes: 9 additions & 0 deletions
9
src/tests/JIT/Regression/JitBlue/Runtime_75832/Runtime_75832.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,9 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<Optimize>True</Optimize> | ||
<DebugType>None</DebugType> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="$(MSBuildProjectName).cs" /> | ||
</ItemGroup> | ||
</Project> |