Skip to content

Commit 89c96dc

Browse files
authored
Devirtualization with multiple guesses: JIT (#86809)
1 parent b201698 commit 89c96dc

File tree

6 files changed

+226
-129
lines changed

6 files changed

+226
-129
lines changed

src/coreclr/jit/compiler.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7128,9 +7128,10 @@ class Compiler
71287128
void pickGDV(GenTreeCall* call,
71297129
IL_OFFSET ilOffset,
71307130
bool isInterface,
7131-
CORINFO_CLASS_HANDLE* classGuess,
7132-
CORINFO_METHOD_HANDLE* methodGuess,
7133-
unsigned* likelihood);
7131+
CORINFO_CLASS_HANDLE* classGuesses,
7132+
CORINFO_METHOD_HANDLE* methodGuesses,
7133+
int* candidatesCount,
7134+
unsigned* likelihoods);
71347135

71357136
void considerGuardedDevirtualization(GenTreeCall* call,
71367137
IL_OFFSET ilOffset,

src/coreclr/jit/gentree.cpp

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12400,11 +12400,21 @@ void Compiler::gtDispTree(GenTree* tree,
1240012400
printf(" (FramesRoot last use)");
1240112401
}
1240212402

12403-
if (((call->gtFlags & GTF_CALL_INLINE_CANDIDATE) != 0) &&
12404-
(call->GetSingleInlineCandidateInfo() != nullptr) &&
12405-
(call->GetSingleInlineCandidateInfo()->exactContextHnd != nullptr))
12403+
if ((call->gtFlags & GTF_CALL_INLINE_CANDIDATE) != 0)
1240612404
{
12407-
printf(" (exactContextHnd=0x%p)", dspPtr(call->GetSingleInlineCandidateInfo()->exactContextHnd));
12405+
InlineCandidateInfo* inlineInfo;
12406+
if (call->IsGuardedDevirtualizationCandidate())
12407+
{
12408+
inlineInfo = call->GetGDVCandidateInfo(0);
12409+
}
12410+
else
12411+
{
12412+
inlineInfo = call->GetSingleInlineCandidateInfo();
12413+
}
12414+
if ((inlineInfo != nullptr) && (inlineInfo->exactContextHnd != nullptr))
12415+
{
12416+
printf(" (exactContextHnd=0x%p)", dspPtr(inlineInfo->exactContextHnd));
12417+
}
1240812418
}
1240912419

1241012420
gtDispCommonEndLine(tree);

0 commit comments

Comments
 (0)