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: fix spill logic for local structs
If we're appending an assignment whose LHS is is a location within a local struct, we need to spill all references to that struct from the eval stack. Update the existing logic for this to handle the case where the LHS is a field of a local struct, and the field is updated by unusual means (here, `initobj`). Fixes dotnet#764.
- Loading branch information
1 parent
f5957b1
commit daac3ae
Showing
3 changed files
with
78 additions
and
5 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
52 changes: 52 additions & 0 deletions
52
src/coreclr/tests/src/JIT/Regression/JitBlue/Runtime_764/Runtime_764.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,52 @@ | ||
// 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; | ||
|
||
// Regression test case for importer bug. | ||
// If Release is inlined into Main, the importer may unsafely re-order trees. | ||
|
||
public struct Ptr<T> where T: class | ||
{ | ||
private T _value; | ||
|
||
public Ptr(T value) | ||
{ | ||
_value = value; | ||
} | ||
|
||
public T Release() | ||
{ | ||
T tmp = _value; | ||
_value = null; | ||
return tmp; | ||
} | ||
} | ||
|
||
class Runtime_764 | ||
{ | ||
private static int Main(string[] args) | ||
{ | ||
Ptr<string> ptr = new Ptr<string>("Hello, world"); | ||
|
||
bool res = false; | ||
while (res) | ||
{ | ||
} | ||
|
||
string summary = ptr.Release(); | ||
|
||
if (summary == null) | ||
{ | ||
Console.WriteLine("FAILED"); | ||
return -1; | ||
} | ||
else | ||
{ | ||
Console.WriteLine("PASSED"); | ||
return 100; | ||
} | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
src/coreclr/tests/src/JIT/Regression/JitBlue/Runtime_764/Runtime_764.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> |