@@ -5977,7 +5977,9 @@ unsigned Compiler::gtSetEvalOrder(GenTree* tree)
5977
5977
if (call->gtCallType == CT_INDIRECT)
5978
5978
{
5979
5979
// 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));
5981
5983
5982
5984
GenTree* indirect = call->gtCallAddr;
5983
5985
@@ -6725,7 +6727,7 @@ bool GenTree::TryGetUse(GenTree* operand, GenTree*** pUse)
6725
6727
}
6726
6728
if (call->gtCallType == CT_INDIRECT)
6727
6729
{
6728
- if (operand == call->gtCallCookie)
6730
+ if (!call->IsVirtualStub() && ( operand == call->gtCallCookie) )
6729
6731
{
6730
6732
*pUse = &call->gtCallCookie;
6731
6733
return true;
@@ -9899,16 +9901,23 @@ GenTreeCall* Compiler::gtCloneExprCallHelper(GenTreeCall* tree)
9899
9901
/* Copy the union */
9900
9902
if (tree->gtCallType == CT_INDIRECT)
9901
9903
{
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;
9904
9913
}
9905
9914
else
9906
9915
{
9907
9916
copy->gtCallMethHnd = tree->gtCallMethHnd;
9908
9917
copy->gtInlineCandidateInfo = tree->gtInlineCandidateInfo;
9909
- copy->gtInlineInfoCount = tree->gtInlineInfoCount;
9910
9918
}
9911
9919
9920
+ copy->gtInlineInfoCount = tree->gtInlineInfoCount;
9912
9921
copy->gtLateDevirtualizationInfo = tree->gtLateDevirtualizationInfo;
9913
9922
9914
9923
copy->gtCallType = tree->gtCallType;
@@ -10641,7 +10650,7 @@ void GenTreeUseEdgeIterator::AdvanceCall()
10641
10650
assert(call->gtCallType == CT_INDIRECT);
10642
10651
10643
10652
m_advance = &GenTreeUseEdgeIterator::AdvanceCall<CALL_ADDRESS>;
10644
- if (call->gtCallCookie != nullptr)
10653
+ if (! call->IsVirtualStub() && (call-> gtCallCookie != nullptr) )
10645
10654
{
10646
10655
m_edge = &call->gtCallCookie;
10647
10656
return;
@@ -10964,6 +10973,11 @@ void Compiler::gtDispNodeName(GenTree* tree)
10964
10973
}
10965
10974
else if (tree->AsCall()->gtCallType == CT_INDIRECT)
10966
10975
{
10976
+ if (tree->AsCall()->IsVirtual())
10977
+ {
10978
+ callType = "CALLV";
10979
+ }
10980
+
10967
10981
ctType = " ind";
10968
10982
}
10969
10983
else
0 commit comments