Add a repro test.
authorSergey Andreenko <seandree@microsoft.com>
Thu, 2 May 2019 22:05:40 +0000 (15:05 -0700)
committerSergey Andreenko <seandree@microsoft.com>
Thu, 2 May 2019 22:29:04 +0000 (15:29 -0700)
Commit migrated from https://github.com/dotnet/coreclr/commit/0c16be11a2bb4b08c5ca701ac9a6d786cf18ce4e

src/coreclr/tests/src/JIT/Regression/JitBlue/GitHub_23199/GitHub_23199.cs [new file with mode: 0644]
src/coreclr/tests/src/JIT/Regression/JitBlue/GitHub_23199/GitHub_23199.csproj [new file with mode: 0644]

diff --git a/src/coreclr/tests/src/JIT/Regression/JitBlue/GitHub_23199/GitHub_23199.cs b/src/coreclr/tests/src/JIT/Regression/JitBlue/GitHub_23199/GitHub_23199.cs
new file mode 100644 (file)
index 0000000..19b5446
--- /dev/null
@@ -0,0 +1,50 @@
+using System;
+using System.Diagnostics;
+using System.Runtime.CompilerServices;
+
+// The test returns 2*pointer size struct where the second pointer is a managed object
+// and need a gc reference. On amd64 Unix and arm64 such structs are returned via registers.
+// The was a problem in GCStress infrastracture where it did not mark this pointer alive.
+
+namespace GitHub_23199
+{
+    public class Program
+    {
+        [MethodImpl(MethodImplOptions.NoInlining)]
+        static void Test1()
+        {
+            ProcessStartInfo pi = new ProcessStartInfo();
+            // pi.Environment calls crossgened HashtableEnumerator::get_Entry returning struct that we need.
+            Console.WriteLine(pi.Environment.Count);
+        }
+
+        struct A
+        {
+            public String a;
+            public String b;
+        }
+
+        [MethodImpl(MethodImplOptions.NoInlining)]
+        static A GetA()
+        {
+            A a = new A();
+            a.a = new String("Hello");
+            a.b = new string("World!");
+            return a;
+        }
+
+        [MethodImpl(MethodImplOptions.NoInlining)]
+        static void Test2()
+        {
+            A a = GetA();
+            Console.WriteLine(a.a + " " + a.b);
+        }
+
+        static int Main(string[] args)
+        {
+            Test1();
+            Test2();
+            return 100;
+        }
+    }
+}
diff --git a/src/coreclr/tests/src/JIT/Regression/JitBlue/GitHub_23199/GitHub_23199.csproj b/src/coreclr/tests/src/JIT/Regression/JitBlue/GitHub_23199/GitHub_23199.csproj
new file mode 100644 (file)
index 0000000..95052d9
--- /dev/null
@@ -0,0 +1,33 @@
+<?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>
+    <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' " />
+  <ItemGroup>
+    <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+      <Visible>False</Visible>
+    </CodeAnalysisDependentAssemblyPaths>
+  </ItemGroup>
+  <PropertyGroup>
+    <DebugType>None</DebugType>
+    <Optimize>True</Optimize>
+  </PropertyGroup>
+  <ItemGroup>
+    <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="$(MSBuildProjectName).cs" />
+  </ItemGroup>
+  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+  <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
+</Project>