@@ -55,6 +55,10 @@ const float TR_J9EstimateCodeSize::CONST_ARG_IN_CALLEE_ADJUSTMENT_FACTOR = 0.75f
55
55
56
56
#define DEFAULT_FREQ_CUTOFF 40
57
57
58
+ #define FREQ_CUTOFF_INTERPRETED_HOTANDABOVE 700
59
+
60
+ #define FREQ_CUTOFF_INTERPRETED_WARM 50
61
+
58
62
#define DEFAULT_GRACE_INLINING_THRESHOLD 100
59
63
60
64
#define DEFAULT_ANALYZED_ALLOWANCE_FACTOR 2
@@ -1730,10 +1734,39 @@ TR_J9EstimateCodeSize::realEstimateCodeSize(TR_CallTarget *calltarget, TR_CallSt
1730
1734
}
1731
1735
else
1732
1736
{
1737
+ // Now check the invocation count for the callee if interpreted.
1738
+ bool isInterpretedCallWithLowFrequency = false ;
1739
+ static bool shouldNotInlineInterpretedMethods = feGetEnv (" TR_DisableSkippingInliningOfColdInterpretedMethods" ) == NULL ;
1740
+ if (shouldNotInlineInterpretedMethods)
1741
+ {
1742
+ static bool includeWarmCompilationsAsWell = feGetEnv (" TR_EnableSkippingInliningOfColdInterpretedMethodsInWarm" ) != NULL ;
1743
+ if (targetCallee->_calleeMethod ->isInterpretedForHeuristics () && !comp ()->fej9 ()->compiledAsDLTBefore (targetCallee->_calleeMethod ))
1744
+ {
1745
+ if (comp ()->getMethodHotness () > warm)
1746
+ {
1747
+ static const char *cutOffHotAndAbove = feGetEnv (" TR_FreqCutOffForInterpretedCalleeInHotAndAbove" );
1748
+ static const int32_t cutOffFreqForHotAndAbove = cutOffHotAndAbove ? atoi (cutOffHotAndAbove) : FREQ_CUTOFF_INTERPRETED_HOTANDABOVE;
1749
+ isInterpretedCallWithLowFrequency = currentBlock->getFrequency () < cutOffFreqForHotAndAbove;
1750
+ }
1751
+ else if (includeWarmCompilationsAsWell && comp ()->getMethodHotness () == warm)
1752
+ {
1753
+ static const char *cutOffForWarm = feGetEnv (" TR_FreqCutOffForInterpretedCalleeInWarm" );
1754
+ static const int32_t cutOffFreqForWarm = cutOffForWarm ? atoi (cutOffForWarm) : FREQ_CUTOFF_INTERPRETED_WARM;
1755
+ isInterpretedCallWithLowFrequency = currentBlock->getFrequency () < cutOffFreqForWarm;
1756
+ }
1757
+ heuristicTrace (tracer ()," Depth %d: callee %s is interpreted and isInterpretedCallWithLowFrequency = %s." ,_recursionDepth,calleeName,isInterpretedCallWithLowFrequency ? " true" : " false" );
1758
+ }
1759
+ }
1760
+
1733
1761
static const char *fc = feGetEnv (" TR_FrequencyCutoff" );
1734
1762
static const int32_t freqCutoff = fc ? atoi (fc) : DEFAULT_FREQ_CUTOFF;
1735
1763
1736
- bool isColdCall = (((comp ()->getMethodHotness () <= warm) && profileManager->isColdCall (targetCallee->_calleeMethod ->getPersistentIdentifier (), calltarget->_calleeMethod ->getPersistentIdentifier (), i, comp ())) || (currentBlock->getFrequency () < freqCutoff)) && !_inliner->alwaysWorthInlining (targetCallee->_calleeMethod , NULL );
1764
+ bool isColdCall = ((comp ()->getMethodHotness () <= warm \
1765
+ && profileManager->isColdCall (targetCallee->_calleeMethod ->getPersistentIdentifier (),
1766
+ calltarget->_calleeMethod ->getPersistentIdentifier (), i, comp ())) \
1767
+ || currentBlock->getFrequency () < freqCutoff \
1768
+ || isInterpretedCallWithLowFrequency) \
1769
+ && !(_inliner->alwaysWorthInlining (targetCallee->_calleeMethod , NULL ));
1737
1770
1738
1771
if (coldCallInfoIsReliable && isColdCall)
1739
1772
{
0 commit comments