@@ -5897,10 +5897,10 @@ void Compiler::considerGuardedDevirtualization(GenTreeCall* call,
5897
5897
5898
5898
bool hasPgoData = true ;
5899
5899
5900
- CORINFO_CLASS_HANDLE likelyClasses[MAX_GDV_TYPE_CHECKS] = {};
5901
- CORINFO_METHOD_HANDLE likelyMethodes [MAX_GDV_TYPE_CHECKS] = {};
5902
- unsigned likelihoods[MAX_GDV_TYPE_CHECKS] = {};
5903
- int candidatesCount = 0 ;
5900
+ CORINFO_CLASS_HANDLE likelyClasses[MAX_GDV_TYPE_CHECKS] = {};
5901
+ CORINFO_METHOD_HANDLE likelyMethods [MAX_GDV_TYPE_CHECKS] = {};
5902
+ unsigned likelihoods[MAX_GDV_TYPE_CHECKS] = {};
5903
+ int candidatesCount = 0 ;
5904
5904
5905
5905
// We currently only get likely class guesses when there is PGO data
5906
5906
// with class profiles.
@@ -5911,7 +5911,7 @@ void Compiler::considerGuardedDevirtualization(GenTreeCall* call,
5911
5911
}
5912
5912
else
5913
5913
{
5914
- pickGDV (call, ilOffset, isInterface, likelyClasses, likelyMethodes , &candidatesCount, likelihoods);
5914
+ pickGDV (call, ilOffset, isInterface, likelyClasses, likelyMethods , &candidatesCount, likelihoods);
5915
5915
assert ((unsigned )candidatesCount <= MAX_GDV_TYPE_CHECKS);
5916
5916
assert ((unsigned )candidatesCount <= (unsigned )getGDVMaxTypeChecks ());
5917
5917
if (candidatesCount == 0 )
@@ -6015,7 +6015,7 @@ void Compiler::considerGuardedDevirtualization(GenTreeCall* call,
6015
6015
for (int candidateId = 0 ; candidateId < candidatesCount; candidateId++)
6016
6016
{
6017
6017
CORINFO_CLASS_HANDLE likelyClass = likelyClasses[candidateId];
6018
- CORINFO_METHOD_HANDLE likelyMethod = likelyMethodes [candidateId];
6018
+ CORINFO_METHOD_HANDLE likelyMethod = likelyMethods [candidateId];
6019
6019
unsigned likelihood = likelihoods[candidateId];
6020
6020
6021
6021
CORINFO_CONTEXT_HANDLE likelyContext = NULL ;
@@ -6058,6 +6058,10 @@ void Compiler::considerGuardedDevirtualization(GenTreeCall* call,
6058
6058
likelyContext = dvInfo.exactContext ;
6059
6059
likelyMethod = dvInfo.devirtualizedMethod ;
6060
6060
}
6061
+ else
6062
+ {
6063
+ likelyContext = MAKE_METHODCONTEXT (likelyMethod);
6064
+ }
6061
6065
6062
6066
uint32_t likelyMethodAttribs = info.compCompHnd ->getMethodAttribs (likelyMethod);
6063
6067
@@ -6291,14 +6295,8 @@ void Compiler::impMarkInlineCandidate(GenTree* callNode,
6291
6295
{
6292
6296
InlineResult inlineResult (this , call, nullptr , " impMarkInlineCandidate for GDV" );
6293
6297
6294
- CORINFO_CONTEXT_HANDLE moreExactContext = call->GetGDVCandidateInfo (candidateId)->exactContextHnd ;
6295
- if (moreExactContext == NULL )
6296
- {
6297
- moreExactContext = exactContextHnd;
6298
- }
6299
-
6300
6298
// Do the actual evaluation
6301
- impMarkInlineCandidateHelper (call, candidateId, moreExactContext , exactContextNeedsRuntimeLookup, callInfo,
6299
+ impMarkInlineCandidateHelper (call, candidateId, exactContextHnd , exactContextNeedsRuntimeLookup, callInfo,
6302
6300
ilOffset, &inlineResult);
6303
6301
// Ignore non-inlineable candidates
6304
6302
// TODO: Consider keeping them to just devirtualize without inlining, at least for interface
@@ -6464,15 +6462,17 @@ void Compiler::impMarkInlineCandidateHelper(GenTreeCall* call,
6464
6462
6465
6463
if (call->IsGuardedDevirtualizationCandidate ())
6466
6464
{
6467
- if (call->GetGDVCandidateInfo (candidateIndex)->guardedMethodUnboxedEntryHandle != nullptr )
6465
+ InlineCandidateInfo* gdvCandidate = call->GetGDVCandidateInfo (candidateIndex);
6466
+ if (gdvCandidate->guardedMethodUnboxedEntryHandle != nullptr )
6468
6467
{
6469
- fncHandle = call-> GetGDVCandidateInfo (candidateIndex) ->guardedMethodUnboxedEntryHandle ;
6468
+ fncHandle = gdvCandidate ->guardedMethodUnboxedEntryHandle ;
6470
6469
}
6471
6470
else
6472
6471
{
6473
- fncHandle = call-> GetGDVCandidateInfo (candidateIndex) ->guardedMethodHandle ;
6472
+ fncHandle = gdvCandidate ->guardedMethodHandle ;
6474
6473
}
6475
- methAttr = info.compCompHnd ->getMethodAttribs (fncHandle);
6474
+ exactContextHnd = gdvCandidate->exactContextHnd ;
6475
+ methAttr = info.compCompHnd ->getMethodAttribs (fncHandle);
6476
6476
}
6477
6477
else
6478
6478
{
@@ -7784,32 +7784,25 @@ void Compiler::impCheckCanInline(GenTreeCall* call,
7784
7784
JITDUMP (" \n CheckCanInline: fetching method info for inline candidate %s -- context %p\n " ,
7785
7785
compiler->eeGetMethodName (ftn), pParam->exactContextHnd );
7786
7786
7787
- if (pParam->exactContextHnd == nullptr )
7788
- {
7789
- JITDUMP (" NULL context\n " );
7790
- }
7791
- else if (pParam->exactContextHnd == METHOD_BEING_COMPILED_CONTEXT ())
7787
+ if (pParam->exactContextHnd == METHOD_BEING_COMPILED_CONTEXT ())
7792
7788
{
7793
7789
JITDUMP (" Current method context\n " );
7794
7790
}
7795
7791
else if ((((size_t )pParam->exactContextHnd & CORINFO_CONTEXTFLAGS_MASK) == CORINFO_CONTEXTFLAGS_METHOD))
7796
7792
{
7797
7793
JITDUMP (" Method context: %s\n " ,
7798
- compiler->eeGetMethodName ((CORINFO_METHOD_HANDLE)pParam->exactContextHnd ));
7794
+ compiler->eeGetMethodFullName ((CORINFO_METHOD_HANDLE)pParam->exactContextHnd ));
7799
7795
}
7800
7796
else
7801
7797
{
7802
7798
JITDUMP (" Class context: %s\n " , compiler->eeGetClassName ((CORINFO_CLASS_HANDLE)(
7803
7799
(size_t )pParam->exactContextHnd & ~CORINFO_CONTEXTFLAGS_MASK)));
7804
7800
}
7805
7801
7806
- const bool isGdv = pParam->call ->IsGuardedDevirtualizationCandidate ();
7807
-
7808
7802
// Fetch method info. This may fail, if the method doesn't have IL.
7809
- // NOTE: For GDV we're expected to use a different context (per candidate)
7810
7803
//
7811
7804
CORINFO_METHOD_INFO methInfo;
7812
- if (!compCompHnd->getMethodInfo (ftn, &methInfo, isGdv ? nullptr : pParam->exactContextHnd ))
7805
+ if (!compCompHnd->getMethodInfo (ftn, &methInfo, pParam->exactContextHnd ))
7813
7806
{
7814
7807
inlineResult->NoteFatal (InlineObservation::CALLEE_NO_METHOD_INFO);
7815
7808
return ;
0 commit comments