-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add explicit null-check for tailcalls to VSD (#62719)
There is already a comment that this is necessary, but it is only being done for x86 tailcalls via jit helper. Do it for normal tailcalls to VSD as well. Fix #61486
- Loading branch information
1 parent
a7ae08b
commit c0c4125
Showing
3 changed files
with
63 additions
and
9 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
45 changes: 45 additions & 0 deletions
45
src/tests/JIT/Regression/JitBlue/Runtime_61486/Runtime_61486.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,45 @@ | ||
// 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.Reflection; | ||
using System.Runtime.CompilerServices; | ||
|
||
public class Runtime_61486 | ||
{ | ||
public static int Main() | ||
{ | ||
var my = new My(new My(null)); | ||
var m = my.GetType().GetMethod("M"); | ||
try | ||
{ | ||
m.Invoke(my, null); | ||
return -1; | ||
} | ||
catch (TargetInvocationException ex) when (ex.InnerException is NullReferenceException) | ||
{ | ||
return 100; | ||
} | ||
} | ||
|
||
public interface IFace | ||
{ | ||
void M(); | ||
} | ||
|
||
public class My : IFace | ||
{ | ||
private IFace _face; | ||
|
||
public My(IFace face) | ||
{ | ||
_face = face; | ||
} | ||
|
||
// We cannot handle a null ref inside a VSD if the caller is not | ||
// managed frame. This test is verifying that JIT null checks ahead of | ||
// time in this case. | ||
[MethodImpl(MethodImplOptions.AggressiveOptimization)] | ||
public void M() => _face.M(); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
src/tests/JIT/Regression/JitBlue/Runtime_61486/Runtime_61486.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> | ||
<OutputType>Exe</OutputType> | ||
<Optimize>True</Optimize> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="$(MSBuildProjectName).cs" /> | ||
</ItemGroup> | ||
</Project> |