Jit: fix a few issues with single def local tracking (dotnet/coreclr#10633)
authorAndy Ayers <andya@microsoft.com>
Sat, 1 Apr 2017 07:56:33 +0000 (00:56 -0700)
committerGitHub <noreply@github.com>
Sat, 1 Apr 2017 07:56:33 +0000 (00:56 -0700)
commit747c705e7fd71e7ed958a35aaa825a0ceb6274e3
treecec7588ef6f4cb704e67a1d6774a515b85f24957
parent653ffa476f89b4706de7bbdda440eb6a1e676e67
Jit: fix a few issues with single def local tracking (dotnet/coreclr#10633)

Fixes for three issues that came up in desktop testing.

1. Don't track class types for locals when in import only mode,
since the jit may be looking at an uninstantiated generic method.
In these cases the jit's use of TYP_REF to represent CORINFO_TYPE_VAR
confuses the tracking code. In import only mode the jit is not going
to use the information, so there is no need to track it at all.

    Import only mode is tied to verification and CoreCLR runs in full
trust mode, so no test was added.

2. Allow `lvaUpdateClass` to be called more than once but assert
that the second and subsequent calls provide the exact same update
as the first call.

    This can happen for single def ref class locals whose definition
block is reimported. Reimportation is triggered by some tolerable
non-ref type mismatches at block joins and so ref type information
should be consistent for each importation attempt.

    Add a couple of IL test cases translated from destkop MC++ tests
that will trigger this kind of reimportation.

3. Bail out of devirtualization (for desktop only) if the base class
has precise initialization semantics, since desktop seems to trigger
class initialization for ref type callvirts (contrary to ECMA355 I.8.9.5).
See dotnet/coreclr#4853 for some discussion. Since this is desktop only behavior
no test was added.

Commit migrated from https://github.com/dotnet/coreclr/commit/a7ab04cfb152f133d130948709dd5ac4f1494a19
src/coreclr/src/jit/gentree.cpp
src/coreclr/src/jit/importer.cpp
src/coreclr/src/jit/lclvars.cpp
src/coreclr/tests/src/JIT/Methodical/Boxing/morph/sin3double.il [new file with mode: 0644]
src/coreclr/tests/src/JIT/Methodical/Boxing/morph/sin3double.ilproj [new file with mode: 0644]
src/coreclr/tests/src/JIT/Methodical/acceptance/Boxing/boxing001.il [new file with mode: 0644]
src/coreclr/tests/src/JIT/Methodical/acceptance/Boxing/boxing001.ilproj [new file with mode: 0644]