diff options
author | Michal Strehovský <MichalStrehovsky@users.noreply.github.com> | 2018-01-24 01:10:52 +0100 |
---|---|---|
committer | Jan Kotas <jkotas@microsoft.com> | 2018-01-23 16:10:52 -0800 |
commit | 3211c255a54b2956b345ba85e7be371548264e7a (patch) | |
tree | 09619a0fe1b41e174f52cdb57acfc6061c8815d2 /src | |
parent | 2dbcd446269df79a49bfb3e1222fccdb22db27ef (diff) | |
download | coreclr-3211c255a54b2956b345ba85e7be371548264e7a.tar.gz coreclr-3211c255a54b2956b345ba85e7be371548264e7a.tar.bz2 coreclr-3211c255a54b2956b345ba85e7be371548264e7a.zip |
Do not devirtualize shared default interface methods (#15979)
The result of the devirtualization for a method on a generic type should be an instantiating stub, but this doesn't seem to work right.
Fixing that is a perf issue (that can be triaged/punted - #15977). This commit is a correctness fix to avoid bad codegen for that case.
Resolves #15591.
Diffstat (limited to 'src')
-rw-r--r-- | src/vm/jitinterface.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/vm/jitinterface.cpp b/src/vm/jitinterface.cpp index 874beae85b..d08ba0cbe2 100644 --- a/src/vm/jitinterface.cpp +++ b/src/vm/jitinterface.cpp @@ -8870,6 +8870,14 @@ CORINFO_METHOD_HANDLE CEEInfo::resolveVirtualMethodHelper(CORINFO_METHOD_HANDLE { return nullptr; } + + // If we devirtualized into a default interface method on a generic type, we should actually return an + // instantiating stub but this is not happening. + // Making this work is tracked by https://github.com/dotnet/coreclr/issues/15977 + if (pDevirtMD->GetMethodTable()->IsInterface() && pDevirtMD->HasClassInstantiation()) + { + return nullptr; + } } else { |