Skip to content

Commit c58b321

Browse files
committed
Adjust inliner use of profiled fanin data
The inliner uses some heuristics that tries to avoid the inlining of large callees that have already been compiled. What constitutes a large method is determined in a routine called `isLargeCompileMethod()`. If the callee is in a large frequency block, then we always want to inline that callee. If the callee is in a medium or low frequency block, then we look at callee size and at the fanin info (how many methods call this callee). For low frequency blocks we are more conservative with inlining than with medium frequency blocks. The existing code contained a bug in that, if there was no fanin info for a callee in a low/medium frequency block, we would always inline the callee, regardless of its size. This commit fixes this problem and considers the size of the callee first and then the fanin info. If there is no fanin info, then the size of the callee is the only criterion. Signed-off-by: Marius Pirvu <[email protected]>
1 parent 18777d2 commit c58b321

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

runtime/compiler/optimizer/InlinerTempForJ9.cpp

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4722,13 +4722,22 @@ bool TR_MultipleCallTargetInliner::isLargeCompiledMethod(TR_ResolvedMethod *call
47224722
veryLargeCompiledMethodFaninThreshold = 0;
47234723
}
47244724
}
4725-
4726-
uint32_t numCallers = 0, totalWeight = 0;
4727-
((TR_ResolvedJ9Method *) calleeResolvedMethod)->getFaninInfo(&numCallers, &totalWeight);
4728-
if ((numCallers > veryLargeCompiledMethodFaninThreshold) &&
4729-
(bytecodeSize > veryLargeCompiledMethodThreshold))
4725+
// Prevent inlining of "large" methods with "many" callers
4726+
if (bytecodeSize > veryLargeCompiledMethodThreshold)
47304727
{
4731-
return true;
4728+
uint32_t numCallers = 0, totalWeight = 0;
4729+
if (!comp()->getOption(TR_DisableInlinerFanIn))
4730+
((TR_ResolvedJ9Method *) calleeResolvedMethod)->getFaninInfo(&numCallers, &totalWeight);
4731+
if (numCallers == 0) // no fanin info
4732+
{
4733+
// If there is no fanin info, prevent inlining just based on method size
4734+
return true;
4735+
}
4736+
else
4737+
{
4738+
if (numCallers > veryLargeCompiledMethodFaninThreshold)
4739+
return true;
4740+
}
47324741
}
47334742
}
47344743
}

0 commit comments

Comments
 (0)