diff options
author | mikedn <onemihaid@hotmail.com> | 2019-04-13 20:39:20 +0300 |
---|---|---|
committer | Bruce Forstall <brucefo@microsoft.com> | 2019-04-13 10:39:20 -0700 |
commit | 8ce1e716841e4a9d6c54be45eb75e740872a4b3e (patch) | |
tree | f504a4e57155260099fcb439eeb5202b0025e703 /tests | |
parent | 3bb584305549f865af443472100641de7b5d848e (diff) | |
download | coreclr-8ce1e716841e4a9d6c54be45eb75e740872a4b3e.tar.gz coreclr-8ce1e716841e4a9d6c54be45eb75e740872a4b3e.tar.bz2 coreclr-8ce1e716841e4a9d6c54be45eb75e740872a4b3e.zip |
Fix ARM's genPutArgStk codegen (#23867)
* Fix ARM's genPutArgStk codegen
When the OBJ node wraps a LCL_VAR node the code uses the type information (struct size, GC layout) from LclVarDsc. This is not always correct because the OBJ may actually have a different struct type due to type reinterpretation (e.g. Unsafe.As<X, Y>).
* Fix genPutArgStk comment
Diffstat (limited to 'tests')
-rw-r--r-- | tests/src/JIT/Regression/JitBlue/GitHub_23794/GitHub_23794.cs | 58 | ||||
-rw-r--r-- | tests/src/JIT/Regression/JitBlue/GitHub_23794/GitHub_23794.csproj | 17 |
2 files changed, 75 insertions, 0 deletions
diff --git a/tests/src/JIT/Regression/JitBlue/GitHub_23794/GitHub_23794.cs b/tests/src/JIT/Regression/JitBlue/GitHub_23794/GitHub_23794.cs new file mode 100644 index 0000000000..bfa6fcc492 --- /dev/null +++ b/tests/src/JIT/Regression/JitBlue/GitHub_23794/GitHub_23794.cs @@ -0,0 +1,58 @@ +// 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; +using System.Runtime.InteropServices; + +class Program +{ + [StructLayout(LayoutKind.Sequential)] + struct S + { + public uint i0; + public uint i1; + public uint i2; + public uint i3; + + public int i4; + public int i5; + } + + [StructLayout(LayoutKind.Sequential)] + struct S16 + { + public uint i0; + public uint i1; + public uint i2; + public uint i3; + } + + static int Main() + { + S s = new S(); + s.i0 = 0x12345678; + s.i1 = 0x87654321; + return Test(s); + } + + [MethodImpl(MethodImplOptions.NoInlining)] + static int Call(int r0, int r1, int r2, int r3, int r4, int r5, int r6, S16 s) + { + return (s.i0 == 0x12345678 && s.i1 == 0x87654321) ? 100 : 1; + } + + [MethodImpl(MethodImplOptions.NoInlining)] + static void Escape<T>(ref T t) + { + } + + [MethodImpl(MethodImplOptions.NoInlining)] + static int Test(S p) + { + S s = p; + Escape(ref s); + return Call(0, 1, 2, 3, 4, 5, 6, Unsafe.As<S, S16>(ref s)); + } +} diff --git a/tests/src/JIT/Regression/JitBlue/GitHub_23794/GitHub_23794.csproj b/tests/src/JIT/Regression/JitBlue/GitHub_23794/GitHub_23794.csproj new file mode 100644 index 0000000000..83594da8fa --- /dev/null +++ b/tests/src/JIT/Regression/JitBlue/GitHub_23794/GitHub_23794.csproj @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Release</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <OutputType>Exe</OutputType> + <DebugType></DebugType> + <Optimize>True</Optimize> + </PropertyGroup> + <ItemGroup> + <Compile Include="$(MSBuildProjectName).cs" /> + </ItemGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup> +</Project> |