This repository was archived by the owner on Jan 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Fix GH Issue 16892 - GC hole due to GT_INDEX_ADDR #16928
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
104 changes: 104 additions & 0 deletions
104
tests/src/JIT/Regression/JitBlue/GitHub_16892/GitHub_16892.cs
This file contains hidden or 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,104 @@ | ||
| using System; | ||
| using System.Runtime.CompilerServices; | ||
| // | ||
| // Test case for a GC Stress 4 failure | ||
| // | ||
| // This test was failing during a GC Stress 4 run in the method Test(...) | ||
| // | ||
| // The failure requires that this test be built with Debug codegen | ||
| // | ||
| // The GC Stress failure will occur if the JIT | ||
| // 1. has evaluated and stored the two outgoing stack based arguments: a5, a6 | ||
| // 2. and then performs a call to the helper CORINFO_HELP_RNGCHKFAIL | ||
| // | ||
| // With the fix the JIT will evaluate the arr[3] with the rangecheck | ||
| // into a new compiler temp, before storing any outgoing arguments. | ||
| // | ||
|
|
||
| class Item | ||
| { | ||
| int _value; | ||
|
|
||
| [MethodImpl(MethodImplOptions.NoInlining)] | ||
| public Item(int value) { _value = value; } | ||
|
|
||
| [MethodImpl(MethodImplOptions.NoInlining)] | ||
| public int GetValue() { return _value; } | ||
| } | ||
|
|
||
| class Program | ||
| { | ||
| public Item[] itemArray; | ||
|
|
||
| [MethodImpl(MethodImplOptions.NoInlining)] | ||
| void Init() | ||
| { | ||
| itemArray = new Item[11]; | ||
| for (int i=0; i<11; i++) | ||
| { | ||
| itemArray[i] = new Item(i); | ||
| } | ||
| } | ||
|
|
||
| [MethodImpl(MethodImplOptions.NoInlining)] | ||
| static int Compute(Item r1, Item r2, Item r3, Item r4, Item s5, Item s6) | ||
| { | ||
| int result = r1.GetValue(); | ||
| result += r2.GetValue(); | ||
| result += r3.GetValue(); | ||
| result += r4.GetValue(); | ||
| result += s5.GetValue(); | ||
| result += s6.GetValue(); | ||
| return result; | ||
| } | ||
|
|
||
| [MethodImpl(MethodImplOptions.NoInlining)] | ||
| int Test(Item a1, Item a2, Item a4, Item a5, Item a6) | ||
| { | ||
| Item[] arr = itemArray; | ||
| int result = 0; | ||
|
|
||
| // Insure that we have to generate fully interruptible GC information | ||
| // Form a possible infinte loop that the JIT believes could execute | ||
| // without encountering a GC safe point. | ||
| // | ||
| do { | ||
| if (result < 5) | ||
| { | ||
| result = Compute(a1, a2, arr[3], a4, a5, a6); | ||
| } | ||
| } while (result < 0); | ||
|
|
||
| return result; | ||
|
|
||
| } | ||
|
|
||
| static int Main(string[] args) | ||
| { | ||
| Program prog = new Program(); | ||
|
|
||
| prog.Init(); | ||
|
|
||
| Item[] arr = prog.itemArray; | ||
|
|
||
| Item obj1 = arr[1]; | ||
| Item obj2 = arr[2]; | ||
| Item obj3 = arr[3]; | ||
| Item obj4 = arr[4]; | ||
| Item obj5 = arr[5]; | ||
| Item obj6 = arr[6]; | ||
|
|
||
| int result = prog.Test(obj1, obj2, obj4, obj5, obj6); | ||
|
|
||
| if (result == 21) | ||
| { | ||
| Console.WriteLine("Passed"); | ||
| return 100; | ||
| } | ||
| else | ||
| { | ||
| Console.WriteLine("Failed"); | ||
| return -1; | ||
| } | ||
| } | ||
| } |
41 changes: 41 additions & 0 deletions
41
tests/src/JIT/Regression/JitBlue/GitHub_16892/GitHub_16892.csproj
This file contains hidden or 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,41 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
| <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> | ||
| <PropertyGroup> | ||
| <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
| <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
| <AssemblyName>$(MSBuildProjectName)</AssemblyName> | ||
| <SchemaVersion>2.0</SchemaVersion> | ||
| <ProjectGuid>{76E69AA0-8C5A-4F76-8561-B8089FFA8D79}</ProjectGuid> | ||
| <OutputType>Exe</OutputType> | ||
| <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> | ||
| <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> | ||
|
|
||
| </PropertyGroup> | ||
| <!-- Default configurations to help VS understand the configurations --> | ||
| <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
| </PropertyGroup> | ||
| <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
| </PropertyGroup> | ||
| <ItemGroup> | ||
| <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> | ||
| <Visible>False</Visible> | ||
| </CodeAnalysisDependentAssemblyPaths> | ||
| </ItemGroup> | ||
| <PropertyGroup> | ||
| <DebugType>Full</DebugType> | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Build this test with Debug==Full |
||
| <Optimize>False</Optimize> | ||
| <AllowUnsafeBlocks>True</AllowUnsafeBlocks> | ||
| </PropertyGroup> | ||
| <ItemGroup> | ||
| <Compile Include="$(MSBuildProjectName).cs" /> | ||
| </ItemGroup> | ||
| <ItemGroup> | ||
| <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> | ||
| </ItemGroup> | ||
| <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> | ||
| <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup> | ||
| <PropertyGroup> | ||
| <ProjectAssetsFile>$(JitPackagesConfigFileDirectory)benchmark\obj\project.assets.json</ProjectAssetsFile> | ||
| </PropertyGroup> | ||
| </Project> | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This actually is the only line necessary to correct this bug.