@@ -5977,7 +5977,9 @@ unsigned Compiler::gtSetEvalOrder(GenTree* tree)
59775977 if (call->gtCallType == CT_INDIRECT)
59785978 {
59795979 // pinvoke-calli cookie is a constant, or constant indirection
5980- assert(call->gtCallCookie == nullptr || call->gtCallCookie->OperIs(GT_CNS_INT, GT_IND));
5980+ // or a non-tree if this is a managed call.
5981+ assert(call->IsVirtualStub() || (call->gtCallCookie == nullptr) ||
5982+ call->gtCallCookie->OperIs(GT_CNS_INT, GT_IND));
59815983
59825984 GenTree* indirect = call->gtCallAddr;
59835985
@@ -6725,7 +6727,7 @@ bool GenTree::TryGetUse(GenTree* operand, GenTree*** pUse)
67256727 }
67266728 if (call->gtCallType == CT_INDIRECT)
67276729 {
6728- if (operand == call->gtCallCookie)
6730+ if (!call->IsVirtualStub() && ( operand == call->gtCallCookie) )
67296731 {
67306732 *pUse = &call->gtCallCookie;
67316733 return true;
@@ -9899,16 +9901,23 @@ GenTreeCall* Compiler::gtCloneExprCallHelper(GenTreeCall* tree)
98999901 /* Copy the union */
99009902 if (tree->gtCallType == CT_INDIRECT)
99019903 {
9902- copy->gtCallCookie = tree->gtCallCookie ? gtCloneExpr(tree->gtCallCookie) : nullptr;
9903- copy->gtCallAddr = tree->gtCallAddr ? gtCloneExpr(tree->gtCallAddr) : nullptr;
9904+ if (tree->IsVirtualStub())
9905+ {
9906+ copy->gtCallCookie = tree->gtCallCookie;
9907+ }
9908+ else
9909+ {
9910+ copy->gtCallCookie = tree->gtCallCookie ? gtCloneExpr(tree->gtCallCookie) : nullptr;
9911+ }
9912+ copy->gtCallAddr = tree->gtCallAddr ? gtCloneExpr(tree->gtCallAddr) : nullptr;
99049913 }
99059914 else
99069915 {
99079916 copy->gtCallMethHnd = tree->gtCallMethHnd;
99089917 copy->gtInlineCandidateInfo = tree->gtInlineCandidateInfo;
9909- copy->gtInlineInfoCount = tree->gtInlineInfoCount;
99109918 }
99119919
9920+ copy->gtInlineInfoCount = tree->gtInlineInfoCount;
99129921 copy->gtLateDevirtualizationInfo = tree->gtLateDevirtualizationInfo;
99139922
99149923 copy->gtCallType = tree->gtCallType;
@@ -10641,7 +10650,7 @@ void GenTreeUseEdgeIterator::AdvanceCall()
1064110650 assert(call->gtCallType == CT_INDIRECT);
1064210651
1064310652 m_advance = &GenTreeUseEdgeIterator::AdvanceCall<CALL_ADDRESS>;
10644- if (call->gtCallCookie != nullptr)
10653+ if (! call->IsVirtualStub() && (call-> gtCallCookie != nullptr) )
1064510654 {
1064610655 m_edge = &call->gtCallCookie;
1064710656 return;
@@ -10964,6 +10973,11 @@ void Compiler::gtDispNodeName(GenTree* tree)
1096410973 }
1096510974 else if (tree->AsCall()->gtCallType == CT_INDIRECT)
1096610975 {
10976+ if (tree->AsCall()->IsVirtual())
10977+ {
10978+ callType = "CALLV";
10979+ }
10980+
1096710981 ctType = " ind";
1096810982 }
1096910983 else
0 commit comments