Skip to content

Commit 0c04b3a

Browse files
committed
Bail out shared type instantiations
1 parent 4b11c79 commit 0c04b3a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/coreclr/vm/jitinterface.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8780,8 +8780,18 @@ bool CEEInfo::resolveVirtualMethodHelper(CORINFO_DEVIRTUALIZATION_INFO * info)
87808780
// This is generic virtual method devirtualization.
87818781
if (!isArray && pBaseMD->HasMethodInstantiation())
87828782
{
8783+
// If we're in a shared context we'll devirt to a shared
8784+
// generic method and won't be able to inline, so just bail.
8785+
//
8786+
if (pExactMT->IsSharedByGenericInstantiations())
8787+
{
8788+
info->detail = CORINFO_DEVIRTUALIZATION_FAILED_CANON;
8789+
return false;
8790+
}
8791+
87838792
pDevirtMD = pDevirtMD->FindOrCreateAssociatedMethodDesc(
87848793
pDevirtMD, pExactMT, pExactMT->IsValueType() && !pDevirtMD->IsStatic(), pBaseMD->GetMethodInstantiation(), false);
8794+
87858795
isGenericVirtual = true;
87868796
}
87878797

0 commit comments

Comments
 (0)