Skip to content

Commit

Permalink
Merge pull request #20890 from vijaysun-omr/inliner-diags2
Browse files Browse the repository at this point in the history
Fix missing diagnostics and tuning knobs in inliner
  • Loading branch information
hzongaro authored Jan 15, 2025
2 parents 81a325b + 78724db commit 006ef73
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions runtime/compiler/optimizer/J9EstimateCodeSize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ const float TR_J9EstimateCodeSize::CONST_ARG_IN_CALLEE_ADJUSTMENT_FACTOR = 0.75f

#define DEFAULT_KNOWN_OBJ_WEIGHT 10

#define DEFAULT_FREQ_CUTOFF 40


/*
DEFINEs are ugly in general, but putting
if (tracer)
Expand Down Expand Up @@ -1294,7 +1297,11 @@ TR_J9EstimateCodeSize::realEstimateCodeSize(TR_CallTarget *calltarget, TR_CallSt
return returnCleanup(ECS_VISITED_COUNT_THRESHOLD_EXCEEDED);
}

if (_recursionDepth > MAX_ECS_RECURSION_DEPTH)

static const char *mrd = feGetEnv("TR_MaxRecursionDepth");
static const int32_t maxRecDepth = mrd ? atoi(mrd) : MAX_ECS_RECURSION_DEPTH;

if (_recursionDepth > maxRecDepth)
{
calltarget->_isPartialInliningCandidate = false;
heuristicTrace(tracer(), "*** Depth %d: ECS end for target %p signature %s. Exceeded Recursion Depth", _recursionDepth, calltarget, callerName);
Expand Down Expand Up @@ -1669,7 +1676,9 @@ TR_J9EstimateCodeSize::realEstimateCodeSize(TR_CallTarget *calltarget, TR_CallSt
}
else
{
int32_t freqCutoff = 40;
static const char *fc = feGetEnv("TR_FrequencyCutoff");
static const int32_t freqCutoff = fc ? atoi(fc) : DEFAULT_FREQ_CUTOFF;

bool isColdCall = (((comp()->getMethodHotness() <= warm) && profileManager->isColdCall(targetCallee->_calleeMethod->getPersistentIdentifier(), calltarget->_calleeMethod->getPersistentIdentifier(), i, comp())) || (currentBlock->getFrequency() < freqCutoff)) && !_inliner->alwaysWorthInlining(targetCallee->_calleeMethod, NULL);

if (coldCallInfoIsReliable && isColdCall)
Expand Down Expand Up @@ -1802,6 +1811,7 @@ TR_J9EstimateCodeSize::realEstimateCodeSize(TR_CallTarget *calltarget, TR_CallSt
calltarget->addDeadCallee(callSites[i]);
j--;
_numOfEstimatedCalls--;
heuristicTrace(tracer(),"Depth %d: estimateCodeSize skipping estimated call and resetting _optimisticSize to %d and _realSize to %d", _recursionDepth, _optimisticSize, _realSize);
}

if(comp()->getVisitCount() > HIGH_VISIT_COUNT)
Expand All @@ -1823,6 +1833,8 @@ TR_J9EstimateCodeSize::realEstimateCodeSize(TR_CallTarget *calltarget, TR_CallSt
calltarget->addDeadCallee(callSites[i]);
j--;
_numOfEstimatedCalls--;

heuristicTrace(tracer(),"Depth %d: estimateCodeSize skipping too big estimated call and resetting _optimisticSize to %d and _realSize to %d", _recursionDepth, _optimisticSize, _realSize);
}

if(comp()->getVisitCount() > HIGH_VISIT_COUNT)
Expand All @@ -1836,7 +1848,7 @@ TR_J9EstimateCodeSize::realEstimateCodeSize(TR_CallTarget *calltarget, TR_CallSt
}
else
{
heuristicTrace(tracer(),"Depth %d: estimateCodeSize aborting due to _optimisticSize: %d > sizeThreshold: %d",_optimisticSize,sizeThreshold);
heuristicTrace(tracer(),"Depth %d: estimateCodeSize aborting due to _optimisticSize: %d > sizeThreshold: %d", _recursionDepth, _optimisticSize,sizeThreshold);
break;
}
}
Expand Down

0 comments on commit 006ef73

Please sign in to comment.