blob: 2a72bd8a851b7a13c2efd71a362d6c8b7f9e8de6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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());
}
}
|