Skip to content

Commit bfda021

Browse files
authored
Merge pull request #21383 from nbhuiyan/bigcallees-0.51
(0.51) Prevent callers of big callees getting marked as big during ECS
2 parents 57ed162 + 7de1517 commit bfda021

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

runtime/compiler/optimizer/J9EstimateCodeSize.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1754,6 +1754,7 @@ TR_J9EstimateCodeSize::realEstimateCodeSize(TR_CallTarget *calltarget, TR_CallSt
17541754

17551755
int32_t origAnalyzedSize = _analyzedSize;
17561756
int32_t origRealSize = _realSize;
1757+
int32_t origBigCalleesSize = _bigCalleesSize;
17571758
bool prevNonColdCalls = _hasNonColdCalls;
17581759
bool estimateSuccess = estimateCodeSize(targetCallee, &callStack); //recurseDown = true
17591760
bool calltargetSetTooBig = false;
@@ -1798,11 +1799,18 @@ TR_J9EstimateCodeSize::realEstimateCodeSize(TR_CallTarget *calltarget, TR_CallSt
17981799
}
17991800
}
18001801

1801-
1802-
if (_analyzedSize - origAnalyzedSize > bigCalleeThreshold)
1802+
#if defined(J9VM_OPT_OPENJDK_METHODHANDLE)
1803+
int32_t bigCalleesSizeBelowMe = _bigCalleesSize - origBigCalleesSize;
1804+
#else
1805+
// Temporarily disable bigCalleeSize adjustment for OpenJ9 MethodHandle implementation as it exposes a functional issue
1806+
// with the change in inlining behaviour resulting from this big callee adjustment.
1807+
int32_t bigCalleesSizeBelowMe = 0;
1808+
#endif /* J9VM_OPT_OPENJDK_METHODHANDLE */
1809+
if ((_analyzedSize - origAnalyzedSize - bigCalleesSizeBelowMe) > bigCalleeThreshold)
18031810
{
18041811
///printf("set warmcallgraphtoobig for method %s at index %d\n", calleeName, newBCInfo._byteCodeIndex);fflush(stdout);
18051812
calltarget->_calleeMethod->setWarmCallGraphTooBig( newBCInfo.getByteCodeIndex(), comp());
1813+
_bigCalleesSize = _bigCalleesSize + _analyzedSize - origAnalyzedSize - bigCalleesSizeBelowMe;
18061814
heuristicTrace(tracer(), "set warmcallgraphtoobig for method %s at index %d\n", calleeName, newBCInfo.getByteCodeIndex());
18071815
//_analyzedSize = origAnalyzedSize;
18081816
//_realSize = origRealSize;

runtime/compiler/optimizer/J9EstimateCodeSize.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class TR_J9EstimateCodeSize : public TR_EstimateCodeSize
4343
{
4444
public:
4545

46-
TR_J9EstimateCodeSize() : TR_EstimateCodeSize(), _analyzedSize(0), _lastCallBlockFrequency(-1) { }
46+
TR_J9EstimateCodeSize() : TR_EstimateCodeSize(), _analyzedSize(0), _bigCalleesSize(0), _lastCallBlockFrequency(-1) { }
4747

4848
int32_t getOptimisticSize() { return _analyzedSize; }
4949

@@ -165,6 +165,7 @@ class TR_J9EstimateCodeSize : public TR_EstimateCodeSize
165165

166166
int32_t _lastCallBlockFrequency;
167167
int32_t _analyzedSize; // size if we assume we are doing a partial inline
168+
int32_t _bigCalleesSize;
168169
};
169170

170171
#define NUM_PREV_BC 5

0 commit comments

Comments
 (0)