summaryrefslogtreecommitdiff
path: root/tests/src/JIT/Regression
diff options
context:
space:
mode:
Diffstat (limited to 'tests/src/JIT/Regression')
-rw-r--r--tests/src/JIT/Regression/CLR-x86-JIT/V1-M10/b08944/b08944b.csproj3
-rw-r--r--tests/src/JIT/Regression/JitBlue/DevDiv_461649/DevDiv_461649.cs54
-rw-r--r--tests/src/JIT/Regression/JitBlue/DevDiv_461649/DevDiv_461649.csproj44
-rw-r--r--tests/src/JIT/Regression/JitBlue/DevDiv_461649/Input.xml4
-rw-r--r--tests/src/JIT/Regression/JitBlue/DevDiv_461649/Transform.xsl30
-rw-r--r--tests/src/JIT/Regression/JitBlue/GitHub_12037/GitHub_12037.cs109
-rw-r--r--tests/src/JIT/Regression/JitBlue/GitHub_12037/GitHub_12037.csproj38
-rw-r--r--tests/src/JIT/Regression/JitBlue/GitHub_12392/GitHub_12392.cs108
-rw-r--r--tests/src/JIT/Regression/JitBlue/GitHub_12392/GitHub_12392.csproj38
9 files changed, 428 insertions, 0 deletions
diff --git a/tests/src/JIT/Regression/CLR-x86-JIT/V1-M10/b08944/b08944b.csproj b/tests/src/JIT/Regression/CLR-x86-JIT/V1-M10/b08944/b08944b.csproj
index 755d0f4f5b..7d1df367c4 100644
--- a/tests/src/JIT/Regression/CLR-x86-JIT/V1-M10/b08944/b08944b.csproj
+++ b/tests/src/JIT/Regression/CLR-x86-JIT/V1-M10/b08944/b08944b.csproj
@@ -11,6 +11,9 @@
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <!-- This test is disabled until #12224 is fixed -->
+ <GCStressIncompatible>true</GCStressIncompatible>
+
</PropertyGroup>
<!-- Default configurations to help VS understand the configurations -->
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
diff --git a/tests/src/JIT/Regression/JitBlue/DevDiv_461649/DevDiv_461649.cs b/tests/src/JIT/Regression/JitBlue/DevDiv_461649/DevDiv_461649.cs
new file mode 100644
index 0000000000..0265f43065
--- /dev/null
+++ b/tests/src/JIT/Regression/JitBlue/DevDiv_461649/DevDiv_461649.cs
@@ -0,0 +1,54 @@
+// 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.IO;
+using System.Xml;
+using System.Xml.XPath;
+using System.Xml.Xsl;
+
+
+namespace XSLTest
+{
+ class Program
+ {
+ // In this test a dynamic method with tail-prefixed call is created.
+ // One of the locals is not explicitly initialized but a flag to init locals is set.
+ // (That never happens in normal C# methods due to C# definite assignment rules.)
+ // The jit performs an optimization transforming the tail call into a loop.
+ // The bug was that the local was only zero-initialized for the first iteration of the loop.
+
+ static int Main(string[] args)
+ {
+ string inputXml = "Input.xml";
+ string inputXsl = "Transform.xsl";
+
+ return DotNetXslCompiledTransform(inputXml, inputXsl);
+ }
+
+ private static int DotNetXslCompiledTransform(string inputXml, string inputXsl)
+ {
+ XslCompiledTransform transform = new XslCompiledTransform();
+ transform.Load(inputXsl);
+
+ StringWriter stringWriter = new StringWriter();
+ XmlWriter writer = new XmlTextWriter(stringWriter);
+
+ transform.Transform(inputXml, null, writer);
+
+ string transformResult = stringWriter.ToString();
+ if (transformResult == "<!--20.0 20.0 20.0 20.0 20.0--> 40 40 40 40 40")
+ {
+ Console.WriteLine("SUCCESS");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("FAILURE");
+ return 0;
+ }
+ }
+ }
+}
+
diff --git a/tests/src/JIT/Regression/JitBlue/DevDiv_461649/DevDiv_461649.csproj b/tests/src/JIT/Regression/JitBlue/DevDiv_461649/DevDiv_461649.csproj
new file mode 100644
index 0000000000..5cfcb815db
--- /dev/null
+++ b/tests/src/JIT/Regression/JitBlue/DevDiv_461649/DevDiv_461649.csproj
@@ -0,0 +1,44 @@
+<?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>
+ </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></DebugType>
+ <Optimize>True</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="$(MSBuildProjectName).cs" />
+ <Reference Include="System.Private.Xml" />
+ <Content Include="Input.xml">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </Content>
+ <Content Include="Transform.xsl">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </Content>
+ </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/Regression/JitBlue/DevDiv_461649/Input.xml b/tests/src/JIT/Regression/JitBlue/DevDiv_461649/Input.xml
new file mode 100644
index 0000000000..d8552e46a0
--- /dev/null
+++ b/tests/src/JIT/Regression/JitBlue/DevDiv_461649/Input.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<root>
+ <bla test="20.0 20.0 20.0 20.0 20.0"/>
+</root> \ No newline at end of file
diff --git a/tests/src/JIT/Regression/JitBlue/DevDiv_461649/Transform.xsl b/tests/src/JIT/Regression/JitBlue/DevDiv_461649/Transform.xsl
new file mode 100644
index 0000000000..3f39086691
--- /dev/null
+++ b/tests/src/JIT/Regression/JitBlue/DevDiv_461649/Transform.xsl
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:l="http://www.schema.de/XSL/ST4DocuManagerlang" version="1.0">
+ <xsl:template match="/">
+ <xsl:for-each select="/root/bla">
+ <xsl:comment>
+ <xsl:value-of select="@test"/>
+ </xsl:comment>
+ <xsl:call-template name="duplicate">
+ <xsl:with-param name="value" select="@test" />
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:template>
+
+ <xsl:template name="duplicate">
+ <xsl:param name="value" />
+ <xsl:param name="result" />
+ <xsl:choose>
+ <xsl:when test="contains($value, ' ')">
+ <xsl:call-template name="duplicate">
+ <xsl:with-param name="value" select="substring-after($value, ' ')" />
+ <xsl:with-param name="result" select="concat($result,' ', substring-before($value, ' ') * 2)" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat($result,' ', $value * 2)" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+</xsl:stylesheet> \ No newline at end of file
diff --git a/tests/src/JIT/Regression/JitBlue/GitHub_12037/GitHub_12037.cs b/tests/src/JIT/Regression/JitBlue/GitHub_12037/GitHub_12037.cs
new file mode 100644
index 0000000000..527a8a18a6
--- /dev/null
+++ b/tests/src/JIT/Regression/JitBlue/GitHub_12037/GitHub_12037.cs
@@ -0,0 +1,109 @@
+// 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;
+
+public class TailCallOptTest
+{
+ public static int Main()
+ {
+ bool res1 = Caller1(new object(), 0L, 0xBEEF, new TypedDouble(1.0), new TypedDouble(2.0), new TypedDouble(3.0));
+ bool res2 = Caller2(new object(), 0L, 0xBEEF, new TypedDouble(1.0), new TwoInts(3, 5), new TypedDouble(3.0));
+ return (res1 && res2) ? 100 : 0;
+ }
+
+ // In this test typedDouble2 is passed to Caller1 on the stack. Then typedDouble2.Value is passed to Callee1 in a register.
+ // Since Calee1 also has a stack argument (typedDouble3.Value) and the call is dispatched as a fast tail call,
+ // it's set up in the incoming argument area of Caller1. JIT lowering code needs to ensure that typedDouble2
+ // in that area is not overwritten by typedDouble3.Value before typedDouble2.Value is computed. The JIT had a bug in that code
+ // because typedDouble2.Value was represented as GT_LCL_FLD and it was incorrectly converted into GT_LCL_VAR resulting in type
+ // mismatches (long vs. double since the struct is passed as a long but its only field is double).
+ public static bool Caller1(object parameters, long l,
+ double doubleArg, TypedDouble typedDouble1, TypedDouble typedDouble2, TypedDouble typedDouble3)
+ {
+ double param = 19.0;
+
+ Console.Write("Let's ");
+ Console.Write("Discourage ");
+ Console.Write("Inlining ");
+ Console.Write("Of ");
+ Console.Write("Caller ");
+ Console.Write("Into ");
+ Console.WriteLine("Main.");
+
+ return Callee1(doubleArg, param, typedDouble1.Value, typedDouble2.Value, typedDouble3.Value);
+ }
+
+ public static bool Callee1(double doubleArg, double param, double typedDoubleArg1, double typedDoubleArg2, double typedDoubleArg3)
+ {
+ Console.WriteLine("{0} {1} {2} {3} {4}", doubleArg, param, typedDoubleArg1, typedDoubleArg2, typedDoubleArg3);
+ if ((doubleArg == 0xBEEF) && (param == 19.0) && (typedDoubleArg1 == 1.0) && (typedDoubleArg2 == 2.0) && (typedDoubleArg3 == 3.0))
+ {
+ Console.WriteLine("PASSED");
+ return true;
+ }
+ else
+ {
+ Console.WriteLine("FAILED");
+ return false;
+ }
+ }
+
+ // In this test twoInts is passed to Caller2 on the stack. Then twoInts.Value1 and twoInts.Value2 were passed to Callee2 in registers.
+ // Since Calee2 also has a stack argument (i3) and the call is dispatched as a fast tail call,
+ // it's set up in the incoming argument area of Caller2. JIT lowering code needs to ensure that twoInts
+ // in that area is not overwritten by i3 before twoInts.Value1 and twoInts.Value2 are computed. The JIT had a bug in that code
+ // because twoInts.Value1 and twoInts.Value2 were represented as GT_LCL_FLD and they were incorrectly converted into GT_LCL_VAR
+ // resulting in an identical value passed for both fields.
+ public static bool Caller2(object parameters, long l,
+ double doubleArg, TypedDouble typedDouble1, TwoInts twoInts, TypedDouble typedDouble3)
+ {
+ double param = 19.0;
+
+ Console.Write("Let's ");
+ Console.Write("Discourage ");
+ Console.Write("Inlining ");
+ Console.Write("Of ");
+ Console.Write("Caller ");
+ Console.Write("Into ");
+ Console.WriteLine("Main.");
+
+ return Callee2(twoInts.Value1, twoInts.Value2, typedDouble1.Value, param, 11);
+ }
+
+ public static bool Callee2(int i1, int i2, double typedDoubleArg1, double typedDoubleArg2, int i3)
+ {
+ Console.WriteLine("{0} {1} {2} {3} {4}", i1, i2, typedDoubleArg1, typedDoubleArg2, i3);
+ if ((i1 == 3) && (i2 == 5) && (typedDoubleArg1 == 1.0) && (typedDoubleArg2 == 19) && (i3 == 11))
+ {
+ Console.WriteLine("PASSED");
+ return true;
+ }
+ else
+ {
+ Console.WriteLine("FAILED");
+ return false;
+ }
+ }
+
+ public struct TypedDouble
+ {
+ public TypedDouble(double value)
+ {
+ Value = value;
+ }
+ public readonly double Value;
+ }
+
+ public struct TwoInts
+ {
+ public TwoInts(int value1, int value2)
+ {
+ Value1 = value1;
+ Value2 = value2;
+ }
+ public readonly int Value1;
+ public readonly int Value2;
+ }
+}
diff --git a/tests/src/JIT/Regression/JitBlue/GitHub_12037/GitHub_12037.csproj b/tests/src/JIT/Regression/JitBlue/GitHub_12037/GitHub_12037.csproj
new file mode 100644
index 0000000000..2cafa4cedf
--- /dev/null
+++ b/tests/src/JIT/Regression/JitBlue/GitHub_12037/GitHub_12037.csproj
@@ -0,0 +1,38 @@
+<?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>
+
+ </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></DebugType>
+ <Optimize>True</Optimize>
+ </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>
+</Project>
diff --git a/tests/src/JIT/Regression/JitBlue/GitHub_12392/GitHub_12392.cs b/tests/src/JIT/Regression/JitBlue/GitHub_12392/GitHub_12392.cs
new file mode 100644
index 0000000000..23058fd768
--- /dev/null
+++ b/tests/src/JIT/Regression/JitBlue/GitHub_12392/GitHub_12392.cs
@@ -0,0 +1,108 @@
+// 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.Reflection;
+
+namespace Test
+{
+ // This is a regression test for a bug in fgMorphRecognizeBoxNullable.
+ // See the comment in Setting<T>.HasValue for details.
+ class Program
+ {
+
+ static int Main(string[] args)
+ {
+ Test t = new Test();
+ if (!t.TestMethod())
+ {
+ Console.WriteLine("SUCCESS");
+ return 100;
+ }
+ else
+ {
+ Console.WriteLine("FAILURE");
+ return 0;
+ }
+ }
+ }
+
+ class Test
+ {
+ Setting<bool?> supportInteractive = Setting.ForBool(null);
+
+ public bool TestMethod()
+ {
+ return this.supportInteractive.HasValue;
+ }
+ }
+
+ public class Setting<T>
+ {
+ Setting()
+ {
+ }
+
+ public Setting(T value)
+ {
+ this.value = value;
+ }
+
+ public bool HasValue
+ {
+ get
+ {
+ if (this.value != null)
+ {
+ Type t = this.value.GetType();
+ if (t.IsGenericType)
+ {
+ if (t.GetGenericTypeDefinition() == typeof(Nullable<>))
+ {
+ PropertyInfo hasValueProperty = t.GetProperty("HasValue");
+ bool result = (bool)hasValueProperty.GetValue(this.value, null);
+ return result;
+ }
+ }
+ }
+
+ // The bug reproduces when the C# compiler generates
+ // ldnull
+ // cgt.un
+ // ret
+ // for this statement.
+ // The code above this statement is necessary so that some assertions are
+ // propagated and the statement gets re-morphed.
+ // The bug in fgMorphRecognizeBoxNullable was that it couldn't deal
+ // with a morphed helper call correctly.
+ return null != this.value;
+ }
+ }
+
+ T value;
+ public T Value
+ {
+ get { return this.value; }
+ set { this.value = value; }
+ }
+ }
+
+ public class Setting
+ {
+ Setting()
+ {
+ ;
+ }
+
+ public static Setting<bool?> ForBool(string parameter)
+ {
+ if (null == parameter)
+ {
+ return new Setting<bool?>(null);
+ }
+ Setting<bool?> setting = new Setting<bool?>(bool.Parse(parameter));
+ return setting;
+ }
+ }
+}
diff --git a/tests/src/JIT/Regression/JitBlue/GitHub_12392/GitHub_12392.csproj b/tests/src/JIT/Regression/JitBlue/GitHub_12392/GitHub_12392.csproj
new file mode 100644
index 0000000000..2cafa4cedf
--- /dev/null
+++ b/tests/src/JIT/Regression/JitBlue/GitHub_12392/GitHub_12392.csproj
@@ -0,0 +1,38 @@
+<?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>
+
+ </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></DebugType>
+ <Optimize>True</Optimize>
+ </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>
+</Project>