Skip to content

Commit 006ef73

Browse files
authored
Merge pull request eclipse-openj9#20890 from vijaysun-omr/inliner-diags2
Fix missing diagnostics and tuning knobs in inliner
2 parents 81a325b + 78724db commit 006ef73

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

runtime/compiler/optimizer/J9EstimateCodeSize.cpp

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ const float TR_J9EstimateCodeSize::CONST_ARG_IN_CALLEE_ADJUSTMENT_FACTOR = 0.75f
5252

5353
#define DEFAULT_KNOWN_OBJ_WEIGHT 10
5454

55+
#define DEFAULT_FREQ_CUTOFF 40
56+
57+
5558
/*
5659
DEFINEs are ugly in general, but putting
5760
if (tracer)
@@ -1294,7 +1297,11 @@ TR_J9EstimateCodeSize::realEstimateCodeSize(TR_CallTarget *calltarget, TR_CallSt
12941297
return returnCleanup(ECS_VISITED_COUNT_THRESHOLD_EXCEEDED);
12951298
}
12961299

1297-
if (_recursionDepth > MAX_ECS_RECURSION_DEPTH)
1300+
1301+
static const char *mrd = feGetEnv("TR_MaxRecursionDepth");
1302+
static const int32_t maxRecDepth = mrd ? atoi(mrd) : MAX_ECS_RECURSION_DEPTH;
1303+
1304+
if (_recursionDepth > maxRecDepth)
12981305
{
12991306
calltarget->_isPartialInliningCandidate = false;
13001307
heuristicTrace(tracer(), "*** Depth %d: ECS end for target %p signature %s. Exceeded Recursion Depth", _recursionDepth, calltarget, callerName);
@@ -1669,7 +1676,9 @@ TR_J9EstimateCodeSize::realEstimateCodeSize(TR_CallTarget *calltarget, TR_CallSt
16691676
}
16701677
else
16711678
{
1672-
int32_t freqCutoff = 40;
1679+
static const char *fc = feGetEnv("TR_FrequencyCutoff");
1680+
static const int32_t freqCutoff = fc ? atoi(fc) : DEFAULT_FREQ_CUTOFF;
1681+
16731682
bool isColdCall = (((comp()->getMethodHotness() <= warm) && profileManager->isColdCall(targetCallee->_calleeMethod->getPersistentIdentifier(), calltarget->_calleeMethod->getPersistentIdentifier(), i, comp())) || (currentBlock->getFrequency() < freqCutoff)) && !_inliner->alwaysWorthInlining(targetCallee->_calleeMethod, NULL);
16741683

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

18071817
if(comp()->getVisitCount() > HIGH_VISIT_COUNT)
@@ -1823,6 +1833,8 @@ TR_J9EstimateCodeSize::realEstimateCodeSize(TR_CallTarget *calltarget, TR_CallSt
18231833
calltarget->addDeadCallee(callSites[i]);
18241834
j--;
18251835
_numOfEstimatedCalls--;
1836+
1837+
heuristicTrace(tracer(),"Depth %d: estimateCodeSize skipping too big estimated call and resetting _optimisticSize to %d and _realSize to %d", _recursionDepth, _optimisticSize, _realSize);
18261838
}
18271839

18281840
if(comp()->getVisitCount() > HIGH_VISIT_COUNT)
@@ -1836,7 +1848,7 @@ TR_J9EstimateCodeSize::realEstimateCodeSize(TR_CallTarget *calltarget, TR_CallSt
18361848
}
18371849
else
18381850
{
1839-
heuristicTrace(tracer(),"Depth %d: estimateCodeSize aborting due to _optimisticSize: %d > sizeThreshold: %d",_optimisticSize,sizeThreshold);
1851+
heuristicTrace(tracer(),"Depth %d: estimateCodeSize aborting due to _optimisticSize: %d > sizeThreshold: %d", _recursionDepth, _optimisticSize,sizeThreshold);
18401852
break;
18411853
}
18421854
}

0 commit comments

Comments
 (0)