-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Properly account for padding in PUTARG_SPLIT with GT_FIELD_LIST (#57279)
We were writing the stack part to the outgoing stack area by a loop incrementing the offset by the written size in each iteration. However, it is possible due to padding and optimization that the written size is smaller than the delta to the next field. Instead, use the offset of each field minus the offset of the first stack field to find the offset in the outgoing arg area. Fix #57064
- Loading branch information
1 parent
1f26d24
commit b2fc310
Showing
3 changed files
with
66 additions
and
11 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
35 changes: 35 additions & 0 deletions
35
src/tests/JIT/Regression/JitBlue/Runtime_57064/Runtime_57064.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,35 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System.Runtime.CompilerServices; | ||
|
||
struct S | ||
{ | ||
public uint F0; | ||
public ushort F1; | ||
public uint F2; | ||
} | ||
|
||
public class Runtime_57064 | ||
{ | ||
public static int Main() | ||
{ | ||
S val = Create(); | ||
val.F0 = 0xF0; | ||
val.F1 = 0xF1; | ||
val.F2 = 0xF2; | ||
// This call splits S between registers and stack on ARM32. | ||
// The issue was that we were writing S.F2 at stack+2 | ||
// instead of stack+4 when val was promoted. | ||
return Split(null, false, null, val) == 0xF2 ? 100 : -1; | ||
} | ||
|
||
[MethodImpl(MethodImplOptions.NoInlining)] | ||
static uint Split(ushort[] arg0, bool arg1, bool[] arg2, S arg3) | ||
{ | ||
return arg3.F2; | ||
} | ||
|
||
[MethodImpl(MethodImplOptions.NoInlining)] | ||
static S Create() => default; | ||
} |
12 changes: 12 additions & 0 deletions
12
src/tests/JIT/Regression/JitBlue/Runtime_57064/Runtime_57064.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,12 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<DebugType>None</DebugType> | ||
<Optimize>True</Optimize> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="$(MSBuildProjectName).cs" /> | ||
</ItemGroup> | ||
</Project> |