summaryrefslogtreecommitdiff
path: root/tests/src/JIT/Regression/JitBlue/GitHub_10940/GitHub_10940.cs
diff options
context:
space:
mode:
authorJiyoung Yun <jy910.yun@samsung.com>2017-04-27 16:54:50 +0900
committerJiyoung Yun <jy910.yun@samsung.com>2017-04-27 16:54:50 +0900
commit5b975f8233e8c8d17b215372f89ca713b45d6a0b (patch)
tree0267bcc331458a01f4c26fafd28110a72273beb3 /tests/src/JIT/Regression/JitBlue/GitHub_10940/GitHub_10940.cs
parenta56e30c8d33048216567753d9d3fefc2152af8ac (diff)
downloadcoreclr-5b975f8233e8c8d17b215372f89ca713b45d6a0b.tar.gz
coreclr-5b975f8233e8c8d17b215372f89ca713b45d6a0b.tar.bz2
coreclr-5b975f8233e8c8d17b215372f89ca713b45d6a0b.zip
Imported Upstream version 2.0.0.11599upstream/2.0.0.11599
Diffstat (limited to 'tests/src/JIT/Regression/JitBlue/GitHub_10940/GitHub_10940.cs')
-rw-r--r--tests/src/JIT/Regression/JitBlue/GitHub_10940/GitHub_10940.cs58
1 files changed, 58 insertions, 0 deletions
diff --git a/tests/src/JIT/Regression/JitBlue/GitHub_10940/GitHub_10940.cs b/tests/src/JIT/Regression/JitBlue/GitHub_10940/GitHub_10940.cs
new file mode 100644
index 0000000000..2a72bd8a85
--- /dev/null
+++ b/tests/src/JIT/Regression/JitBlue/GitHub_10940/GitHub_10940.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.Runtime.CompilerServices;
+
+// This test checks whether or not the JIT properly spills side effects in the importer when dumping multi-reg values
+// to temps. If the JIT does not do so correctly, the calls to GetString() and GetDecimal() will be reordered and the
+// test will fail with exit code 0; if it does do so correctly, the calls will not be reordered and the test will
+// pass.
+
+class Test
+{
+ abstract class ValueSourceBase
+ {
+ public abstract string GetString();
+ public abstract decimal GetDecimal();
+ public abstract int GetReturnValue();
+ }
+
+ class ValueSource : ValueSourceBase
+ {
+ int rv;
+
+ public override string GetString()
+ {
+ rv = 0;
+ return "";
+ }
+
+ public override decimal GetDecimal()
+ {
+ rv = 100;
+ return 0;
+ }
+
+ public override int GetReturnValue()
+ {
+ return rv;
+ }
+ }
+
+ Test(string s, decimal d)
+ {
+ }
+
+ [MethodImpl(MethodImplOptions.NoInlining)]
+ static int M(ValueSourceBase vs)
+ {
+ new Test(vs.GetString(), vs.GetDecimal());
+ return vs.GetReturnValue();
+ }
+
+ static int Main()
+ {
+ return M(new ValueSource());
+ }
+}