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.
JIT: if IR and stack can't provide a ref class handle, use object (do…
…tnet#239) In some cases we may end up in `lvaSetClass` without a valid ref class handle from either the IR or the stack. Use the handle for `object` as a conservative fallback. Closes dotnet/coreclr#27923.
1 parent
ff2c9c0
commit ffdb313
Showing
3 changed files
with
49 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
34 changes: 34 additions & 0 deletions
34
src/coreclr/tests/src/JIT/Regression/JitBlue/GitHub_27923/GitHub_27923.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,34 @@ | ||
// 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; | ||
using System.Runtime.CompilerServices; | ||
|
||
class Writer | ||
{ | ||
public object Data { get; set; } | ||
public int Position { get; set; } | ||
|
||
[MethodImpl(MethodImplOptions.NoInlining)] | ||
Writer() | ||
{ | ||
Data = new int[] { 100, -1, -2, -3 }; | ||
Position = 4; | ||
} | ||
|
||
[MethodImpl(MethodImplOptions.NoInlining)] | ||
public static ArraySegment<byte> Test() | ||
{ | ||
var writer = new Writer(); | ||
object temp = writer.Data; | ||
byte[] data = Unsafe.As<object, byte[]>(ref temp); | ||
return new ArraySegment<byte>(data, 0, writer.Position); | ||
} | ||
|
||
public static int Main() | ||
{ | ||
var x = Test(); | ||
return x[0]; | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
src/coreclr/tests/src/JIT/Regression/JitBlue/GitHub_27923/GitHub_27923.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,10 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<DebugType>None</DebugType> | ||
<Optimize>True</Optimize> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="$(MSBuildProjectName).cs" /> | ||
</ItemGroup> | ||
</Project> |