summaryrefslogtreecommitdiff
path: root/tests/src/JIT
diff options
context:
space:
mode:
authorBruce Forstall <Bruce_Forstall@msn.com>2018-10-22 16:13:07 -0700
committerBruce Forstall <Bruce_Forstall@msn.com>2018-10-25 16:25:07 -0700
commitada55ba08723fa2e0b2133291f2ee85820bbb75b (patch)
tree6591c8495d5f86f4e468ced13350cdb80377af1b /tests/src/JIT
parent41f935f8948acd378986df6c9b6bf7a19bb429f9 (diff)
downloadcoreclr-ada55ba08723fa2e0b2133291f2ee85820bbb75b.tar.gz
coreclr-ada55ba08723fa2e0b2133291f2ee85820bbb75b.tar.bz2
coreclr-ada55ba08723fa2e0b2133291f2ee85820bbb75b.zip
Stop attempting to move PSPSym during localloc for arm32/arm64
For arm64, this was creating a data corruption possibility, as the calculations were done wrong. In neither case was it necessary, as in the main function we always access the PSPSym FP-relative, so when writing back the PSPSym, we were always writing to exactly the same slot; nothing was actually moving. I can't recall or figure out why we were moving it in the first place, or what might have changed. Added a new variant of the localloc eh tests that has outgoing arguments, to exercise the case where we need to re-establish the outgoing argument space after the localloc.
Diffstat (limited to 'tests/src/JIT')
-rw-r--r--tests/src/JIT/jit64/localloc/eh/eh05.cs90
-rw-r--r--tests/src/JIT/jit64/localloc/eh/eh05_dynamic.csproj40
-rw-r--r--tests/src/JIT/jit64/localloc/eh/eh05_large.csproj40
-rw-r--r--tests/src/JIT/jit64/localloc/eh/eh05_small.csproj40
4 files changed, 210 insertions, 0 deletions
diff --git a/tests/src/JIT/jit64/localloc/eh/eh05.cs b/tests/src/JIT/jit64/localloc/eh/eh05.cs
new file mode 100644
index 0000000000..1689f6f2a7
--- /dev/null
+++ b/tests/src/JIT/jit64/localloc/eh/eh05.cs
@@ -0,0 +1,90 @@
+// 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.
+
+/*
+ * Test reading localloc variable from catch block.
+ */
+
+using System;
+using LocallocTesting;
+using System.Runtime.CompilerServices;
+
+internal class LocallocTest
+{
+ // Create a non-inlined call that will be made from Main with some arguments,
+ // so fixed-out-args platforms will need to move the outgoing argument space
+ // along with the localloc.
+ [MethodImplAttribute(MethodImplOptions.NoInlining)]
+ public static int FunctionWithLotsOfArguments(int a, int b, int c, int d, int e, int f, int g, int h, int j, int k, int l, int m)
+ {
+ return a + b + c + d + e + f + g + h + j + k + l + m;
+ }
+
+ public static unsafe int Main()
+ {
+ ulong local1 = Global.INITIAL_VALUE;
+ ulong local2 = local1 + 1;
+ int size = 0;
+#if LOCALLOC_SMALL
+ Int32* intArray1 = stackalloc Int32[1];
+ Int32* intArray2 = stackalloc Int32[1];
+ size = 1;
+#elif LOCALLOC_LARGE
+ Int32* intArray1 = stackalloc Int32[0x1000];
+ Int32* intArray2 = stackalloc Int32[0x1000];
+ size = 0x1000;
+#else
+ Int32* intArray1 = stackalloc Int32[Global.stackAllocSize];
+ Int32* intArray2 = stackalloc Int32[Global.stackAllocSize];
+ size = Global.stackAllocSize;
+#endif
+ try
+ {
+ Global.initializeStack(intArray1, size, 1000);
+ Global.initializeStack(intArray2, size, 2000);
+ throw new Exception("Test Exception");
+ }
+ catch
+ {
+ if (!Global.verifyStack("intArray1", intArray1, size, 1000))
+ {
+ return 1;
+ }
+ if (!Global.verifyStack("intArray2", intArray2, size, 2000))
+ {
+ return 1;
+ }
+ if (FunctionWithLotsOfArguments(1,2,3,4,5,1,2,3,4,5,1,2) != 33)
+ {
+ return 1;
+ }
+ }
+
+
+ if (!Global.verifyStack("intArray1", intArray1, size, 1000))
+ {
+ return 1;
+ }
+ if (!Global.verifyStack("intArray2", intArray2, size, 2000))
+ {
+ return 1;
+ }
+ if (!Global.verifyLocal("local1", local1, Global.INITIAL_VALUE))
+ {
+ return 1;
+ }
+ if (!Global.verifyLocal("local2", local2, Global.INITIAL_VALUE + 1))
+ {
+ return 1;
+ }
+
+ if (FunctionWithLotsOfArguments(0,2,3,4,5,1,2,3,4,5,1,2) != 32)
+ {
+ return 1;
+ }
+
+ Console.WriteLine("Passed\n");
+ return 100;
+ }
+}
diff --git a/tests/src/JIT/jit64/localloc/eh/eh05_dynamic.csproj b/tests/src/JIT/jit64/localloc/eh/eh05_dynamic.csproj
new file mode 100644
index 0000000000..bf1543911c
--- /dev/null
+++ b/tests/src/JIT/jit64/localloc/eh/eh05_dynamic.csproj
@@ -0,0 +1,40 @@
+<?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>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <CLRTestPriority>1</CLRTestPriority>
+ </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>
+ <!-- Set to 'Full' if the Debug? column is marked in the spreadsheet. Leave blank otherwise. -->
+ <DebugType>PdbOnly</DebugType>
+ <NoLogo>True</NoLogo>
+ <AllowUnsafeBlocks>True</AllowUnsafeBlocks>
+ <DefineConstants>$(DefineConstants);DESKTOP;LOCALLOC_DYNAMIC</DefineConstants>
+ <NoWarn>$(NoWarn),8002</NoWarn>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="eh05.cs" />
+ <ProjectReference Include="..\common\common.ilproj" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/jit64/localloc/eh/eh05_large.csproj b/tests/src/JIT/jit64/localloc/eh/eh05_large.csproj
new file mode 100644
index 0000000000..13d1a3ec2e
--- /dev/null
+++ b/tests/src/JIT/jit64/localloc/eh/eh05_large.csproj
@@ -0,0 +1,40 @@
+<?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>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <CLRTestPriority>1</CLRTestPriority>
+ </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>
+ <!-- Set to 'Full' if the Debug? column is marked in the spreadsheet. Leave blank otherwise. -->
+ <DebugType>PdbOnly</DebugType>
+ <NoLogo>True</NoLogo>
+ <AllowUnsafeBlocks>True</AllowUnsafeBlocks>
+ <DefineConstants>$(DefineConstants);DESKTOP;LOCALLOC_LARGE</DefineConstants>
+ <NoWarn>$(NoWarn),8002</NoWarn>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="eh05.cs" />
+ <ProjectReference Include="..\common\common.ilproj" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/jit64/localloc/eh/eh05_small.csproj b/tests/src/JIT/jit64/localloc/eh/eh05_small.csproj
new file mode 100644
index 0000000000..eed8694eda
--- /dev/null
+++ b/tests/src/JIT/jit64/localloc/eh/eh05_small.csproj
@@ -0,0 +1,40 @@
+<?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>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <CLRTestPriority>1</CLRTestPriority>
+ </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>
+ <!-- Set to 'Full' if the Debug? column is marked in the spreadsheet. Leave blank otherwise. -->
+ <DebugType>PdbOnly</DebugType>
+ <NoLogo>True</NoLogo>
+ <AllowUnsafeBlocks>True</AllowUnsafeBlocks>
+ <DefineConstants>$(DefineConstants);DESKTOP;LOCALLOC_SMALL</DefineConstants>
+ <NoWarn>$(NoWarn),8002</NoWarn>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="eh05.cs" />
+ <ProjectReference Include="..\common\common.ilproj" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
+</Project>