Fix several devirtualization issues
authorAndy Ayers <andya@microsoft.com>
Tue, 21 Mar 2017 20:17:28 +0000 (13:17 -0700)
committerAndy Ayers <andya@microsoft.com>
Wed, 22 Mar 2017 00:56:38 +0000 (17:56 -0700)
commit822a84d9525265cb0ca952e2aa5e3272fe0e3ca1
tree0b5ea8a53d135ecdeada890ec3a1d73030452586
parent03e0c746aa86adbf2ccf40d3ab3630dd4de55c1e
Fix several devirtualization issues

When doing interface devirtualization, if the object type is canonical,
ensure that the owner type is too. The jit may present a mixed set
when inlining a shared method into a non-shared method. Ideally the
jit would also be able to present exact object types in such cases but
currently it cannot guarantee this. Closes dotnet/coreclr#10311.

Adjust contracts to address some contract violations seen in desktop
testing. Make the helper non-static and fold in some of the info that
was passed from the caller to bring the desktop and CoreCLR implementations
closer.

Disallow interface devirt if the method is final but the class is not
exact or final, since derived classes can still override final methods
when implementing interfaces.

Don't try and devirtualize interface calls from com objects.

Add some related test cases.

Commit migrated from https://github.com/dotnet/coreclr/commit/d02fbd29384dc10217c35af0aea3ee862c07ac63
src/coreclr/src/jit/importer.cpp
src/coreclr/src/vm/jitinterface.cpp
src/coreclr/src/vm/jitinterface.h
src/coreclr/tests/src/JIT/opt/Devirtualization/GitHub_10311.cs [new file with mode: 0644]
src/coreclr/tests/src/JIT/opt/Devirtualization/GitHub_10311.csproj [new file with mode: 0644]
src/coreclr/tests/src/JIT/opt/Devirtualization/generic.cs [new file with mode: 0644]
src/coreclr/tests/src/JIT/opt/Devirtualization/generic.csproj [new file with mode: 0644]
src/coreclr/tests/src/JIT/opt/Devirtualization/overload.cs [new file with mode: 0644]
src/coreclr/tests/src/JIT/opt/Devirtualization/overload.csproj [new file with mode: 0644]
src/coreclr/tests/src/JIT/opt/Devirtualization/override.il [new file with mode: 0644]
src/coreclr/tests/src/JIT/opt/Devirtualization/override.ilproj [new file with mode: 0644]