-
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: fix OSR handling for pinned locals (#67680)
The OSR method may not see any references to the pinned local, but must still report it in the GC info. So under OSR, mark (root method) pinned locals as implicitly referenced. This should address the issue seen in #67688.
- Loading branch information
1 parent
32a6620
commit c288acd
Showing
3 changed files
with
66 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System; | ||
|
||
// Run under COMPlus_GCStress=3 | ||
|
||
class PinnedLocal | ||
{ | ||
static int F(char c) | ||
{ | ||
return (int) c; | ||
} | ||
|
||
public static unsafe int Main() | ||
{ | ||
string ss = "goodbye, world\n"; | ||
string s = "hello, world\n"; | ||
int r = 0; | ||
fixed(char* p = s) | ||
{ | ||
for (int i = 0; i < 100_000; i++) | ||
{ | ||
r += F(p[i % s.Length]); | ||
|
||
if ((i % 10_000) == 0) | ||
{ | ||
GC.Collect(2); | ||
ss = new String('a', 100); | ||
} | ||
} | ||
|
||
Console.WriteLine($"r is {r}"); | ||
return r - 9000061 + 100; | ||
} | ||
} | ||
} |
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,21 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<DebugType /> | ||
<Optimize>True</Optimize> | ||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="$(MSBuildProjectName).cs" /> | ||
</ItemGroup> | ||
<PropertyGroup> | ||
<CLRTestBatchPreCommands><![CDATA[ | ||
$(CLRTestBatchPreCommands) | ||
set COMPlus_GCStress=3 | ||
]]></CLRTestBatchPreCommands> | ||
<BashCLRTestPreCommands><![CDATA[ | ||
$(BashCLRTestPreCommands) | ||
export COMPlus_GCStress=3 | ||
]]></BashCLRTestPreCommands> | ||
</PropertyGroup> | ||
</Project> |