@@ -2164,12 +2164,12 @@ GenTree* Compiler::getArrayLengthFromAllocation(GenTree* tree DEBUGARG(BasicBloc
2164
2164
}
2165
2165
2166
2166
//-------------------------------------------------------------------------
2167
- // SetSingleInlineCadidateInfo : set a single inline candidate info in the current call.
2167
+ // SetSingleInlineCandidateInfo : set a single inline candidate info in the current call.
2168
2168
//
2169
2169
// Arguments:
2170
2170
// candidateInfo - inline candidate info
2171
2171
//
2172
- void GenTreeCall::SetSingleInlineCadidateInfo (InlineCandidateInfo* candidateInfo)
2172
+ void GenTreeCall::SetSingleInlineCandidateInfo (InlineCandidateInfo* candidateInfo)
2173
2173
{
2174
2174
if (candidateInfo != nullptr)
2175
2175
{
@@ -2180,9 +2180,9 @@ void GenTreeCall::SetSingleInlineCadidateInfo(InlineCandidateInfo* candidateInfo
2180
2180
{
2181
2181
gtInlineInfoCount = 0;
2182
2182
gtFlags &= ~GTF_CALL_INLINE_CANDIDATE;
2183
- gtCallMoreFlags &= ~GTF_CALL_M_GUARDED_DEVIRT;
2184
2183
}
2185
2184
gtInlineCandidateInfo = candidateInfo;
2185
+ ClearGuardedDevirtualizationCandidate();
2186
2186
}
2187
2187
2188
2188
//-------------------------------------------------------------------------
@@ -2199,22 +2199,29 @@ InlineCandidateInfo* GenTreeCall::GetGDVCandidateInfo(uint8_t index)
2199
2199
2200
2200
//-------------------------------------------------------------------------
2201
2201
// AddGDVCandidateInfo: Record a guarded devirtualization (GDV) candidate info
2202
- // for this call. For now, we only support one GDV candidate per call.
2202
+ // for this call. A call can't have more than MAX_GDV_TYPE_CHECKS number of candidates
2203
2203
//
2204
2204
// Arguments:
2205
+ // comp - Compiler instance
2205
2206
// candidateInfo - GDV candidate info
2206
2207
//
2207
- void GenTreeCall::AddGDVCandidateInfo(InlineCandidateInfo* candidateInfo)
2208
+ void GenTreeCall::AddGDVCandidateInfo(Compiler* comp, InlineCandidateInfo* candidateInfo)
2208
2209
{
2210
+ assert(gtInlineInfoCount < MAX_GDV_TYPE_CHECKS);
2209
2211
assert(candidateInfo != nullptr);
2212
+
2210
2213
if (gtInlineInfoCount == 0)
2211
2214
{
2212
2215
gtInlineCandidateInfo = candidateInfo;
2213
2216
}
2217
+ else if (gtInlineInfoCount == 1)
2218
+ {
2219
+ gtInlineCandidateInfo =
2220
+ new (comp, CMK_Inlining) InlineCandidateInfo[MAX_GDV_TYPE_CHECKS]{*gtInlineCandidateInfo, *candidateInfo};
2221
+ }
2214
2222
else
2215
2223
{
2216
- // Allocate a fixed list of InlineCandidateInfo structs
2217
- assert(!"multiple GDV candidates are not implemented yet");
2224
+ gtInlineCandidateInfo[gtInlineInfoCount] = *candidateInfo;
2218
2225
}
2219
2226
2220
2227
gtCallMoreFlags |= GTF_CALL_M_GUARDED_DEVIRT;
@@ -7729,10 +7736,11 @@ GenTreeCall* Compiler::gtNewCallNode(gtCallTypes callType,
7729
7736
node->gtCallType = callType;
7730
7737
node->gtCallMethHnd = callHnd;
7731
7738
INDEBUG(node->callSig = nullptr;)
7732
- node->tailCallInfo = nullptr;
7733
- node->gtRetClsHnd = nullptr;
7734
- node->gtControlExpr = nullptr;
7735
- node->gtCallMoreFlags = GTF_CALL_M_EMPTY;
7739
+ node->tailCallInfo = nullptr;
7740
+ node->gtRetClsHnd = nullptr;
7741
+ node->gtControlExpr = nullptr;
7742
+ node->gtCallMoreFlags = GTF_CALL_M_EMPTY;
7743
+ node->gtInlineInfoCount = 0;
7736
7744
7737
7745
if (callType == CT_INDIRECT)
7738
7746
{
@@ -12353,10 +12361,11 @@ void Compiler::gtDispTree(GenTree* tree,
12353
12361
printf(" (FramesRoot last use)");
12354
12362
}
12355
12363
12356
- if (((call->gtFlags & GTF_CALL_INLINE_CANDIDATE) != 0) && (call->GetInlineCandidateInfo() != nullptr) &&
12357
- (call->GetInlineCandidateInfo()->exactContextHnd != nullptr))
12364
+ if (((call->gtFlags & GTF_CALL_INLINE_CANDIDATE) != 0) &&
12365
+ (call->GetSingleInlineCandidateInfo() != nullptr) &&
12366
+ (call->GetSingleInlineCandidateInfo()->exactContextHnd != nullptr))
12358
12367
{
12359
- printf(" (exactContextHnd=0x%p)", dspPtr(call->GetInlineCandidateInfo ()->exactContextHnd));
12368
+ printf(" (exactContextHnd=0x%p)", dspPtr(call->GetSingleInlineCandidateInfo ()->exactContextHnd));
12360
12369
}
12361
12370
12362
12371
gtDispCommonEndLine(tree);
@@ -17871,7 +17880,7 @@ CORINFO_CLASS_HANDLE Compiler::gtGetClassHandle(GenTree* tree, bool* pIsExact, b
17871
17880
// type class handle in the inline info (for GDV candidates,
17872
17881
// this data is valid only for a correct guess, so we cannot
17873
17882
// use it).
17874
- InlineCandidateInfo* inlInfo = call->GetInlineCandidateInfo ();
17883
+ InlineCandidateInfo* inlInfo = call->GetSingleInlineCandidateInfo ();
17875
17884
assert(inlInfo != nullptr);
17876
17885
17877
17886
// Grab it as our first cut at a return type.
0 commit comments