-
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: Add Statement::m_treeListEnd (#81031)
Before this change statements have only one field for the "tree list" even though bidirectional iteration is supported after nodes have been linked. This worked fine before the locals tree list existed since the "root node" was always the last node. This does not work for the locals tree list since the "root node" is not part of the list, meaning that we need somewhere else to store the 'last' node. Before this PR the assumption was that the root node was _never_ part of the locals linked list, so we could use the gtNext/gtPrev fields of the root node. However, the added test case shows that in fact it is possible we end up with a top level local. This PR fixes the problem by adding a Statement::m_treeListEnd field that can keep the last node of the locals linked list. While this takes some memory, it seems like the most maintainable way to resolve the problem. I experimented with making the linked list circular or by allocating a new stand-in node when necessary but eventually I ended up here. Fix #81018
- Loading branch information
1 parent
9f54ca6
commit e6f143b
Showing
9 changed files
with
128 additions
and
40 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
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
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
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
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
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
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
36 changes: 36 additions & 0 deletions
36
src/tests/JIT/Regression/JitBlue/Runtime_81018/Runtime_81018.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,36 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
// Generated by Fuzzlyn v1.5 on 2023-01-22 16:00:16 | ||
// Run on Arm64 Windows | ||
// Seed: 17286164302317655577 | ||
// Reduced from 117.6 KiB to 0.4 KiB in 00:02:13 | ||
// Hits JIT assert in Release: | ||
// Assertion failed '!m_rootNode->OperIsLocal() && !m_rootNode->OperIsLocalAddr()' in 'Program:Main(Fuzzlyn.ExecutionServer.IRuntime)' during 'Morph - Structs/AddrExp' (IL size 83; hash 0xade6b36b; FullOpts) | ||
// | ||
// File: D:\a\_work\1\s\src\coreclr\jit\lclmorph.cpp Line: 34 | ||
// | ||
public interface I0 | ||
{ | ||
} | ||
|
||
public struct S0 : I0 | ||
{ | ||
public sbyte F0; | ||
public S0 M17(I0 arg0, ulong arg1) | ||
{ | ||
return this; | ||
} | ||
} | ||
|
||
public class Runtime_81018 | ||
{ | ||
public static ulong s_2; | ||
public static int Main() | ||
{ | ||
var vr6 = new S0(); | ||
var vr7 = new S0(); | ||
new S0().M17(new S0().M17(vr7, 0).M17(vr6, s_2), s_2); | ||
return 100; | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
src/tests/JIT/Regression/JitBlue/Runtime_81018/Runtime_81018.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> |