Fix constrained call corner cases (dotnet/coreclr#22464)
authorMichal Strehovský <MichalStrehovsky@users.noreply.github.com>
Mon, 18 Feb 2019 16:19:55 +0000 (17:19 +0100)
committerGitHub <noreply@github.com>
Mon, 18 Feb 2019 16:19:55 +0000 (17:19 +0100)
commit65fea94036de7b999de96c66fcbeffea79357995
tree016ab942b966da74376ba7f68ffe585eaa48428c
parent2189994ac8cf55a305da182b35d3c370e5faa668
Fix constrained call corner cases (dotnet/coreclr#22464)

Fixes dotnet/coreclr#22423. I'm still unclear on how JitStress manages to get itself into that situation, but I was able to write a repro that triggers the `!pMDAfterConstraintResolution->IsInterface()` assert using regular IL, so we need to handle that either way. The repro for that is constrained3.il.

While figuring out the repro, I wrote a bunch of other test code and found another bug (constrained2), where we would box in a situations that doesn't require boxing (canonically ambiguous situation where there's a suitable default interface implementation and a valuetype implementation of the constrained method that does not requires boxing once we no longer deal with __Canon).

Commit migrated from https://github.com/dotnet/coreclr/commit/88249918cd01e8729c60c0f6c2cf8145d0bc3c55
12 files changed:
src/coreclr/src/vm/jitinterface.cpp
src/coreclr/src/vm/methodtable.cpp
src/coreclr/tests/issues.targets
src/coreclr/tests/src/Loader/classloader/DefaultInterfaceMethods/constrainedcall/constrained2.il [new file with mode: 0644]
src/coreclr/tests/src/Loader/classloader/DefaultInterfaceMethods/constrainedcall/constrained2.ilproj [new file with mode: 0644]
src/coreclr/tests/src/Loader/classloader/DefaultInterfaceMethods/constrainedcall/constrained2_gm.il [new file with mode: 0644]
src/coreclr/tests/src/Loader/classloader/DefaultInterfaceMethods/constrainedcall/constrained2_gm.ilproj [new file with mode: 0644]
src/coreclr/tests/src/Loader/classloader/DefaultInterfaceMethods/constrainedcall/constrained3.il [new file with mode: 0644]
src/coreclr/tests/src/Loader/classloader/DefaultInterfaceMethods/constrainedcall/constrained3.ilproj [new file with mode: 0644]
src/coreclr/tests/src/Loader/classloader/DefaultInterfaceMethods/constrainedcall/constrained3_gm.il [new file with mode: 0644]
src/coreclr/tests/src/Loader/classloader/DefaultInterfaceMethods/constrainedcall/constrained3_gm.ilproj [new file with mode: 0644]
src/coreclr/tests/src/Loader/classloader/DefaultInterfaceMethods/constrainedcall/constrainedcall.il