Skip to content

Commit a301a2e

Browse files
committed
Print total bytecode size for a method including inlined methods
Signed-off-by: Dev Agarwal <dev.agarwal@ibm.com>
1 parent cb98417 commit a301a2e

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

runtime/compiler/control/CompilationThread.cpp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10284,6 +10284,7 @@ void TR::CompilationInfoPerThreadBase::logCompilationSuccess(J9VMThread *vmThrea
1028410284
|| (compiler->getOption(TR_CountOptTransformations)
1028510285
&& compiler->getVerboseOptTransformationCount() >= 1)) {
1028610286
const uint32_t bytecodeSize = TR::CompilationInfo::getMethodBytecodeSize(method);
10287+
const uint32_t totalBytecodeSize = TR::CompilationInfoPerThreadBase::computeTotalBytecodeSize(compiler);
1028710288
const bool isJniNative = compilee->isJNINative();
1028810289
TR_VerboseLog::CriticalSection vlogLock;
1028910290
TR_VerboseLog::write(TR_Vlog_COMP, "(%s%s) %s @ " POINTER_PRINTF_FORMAT "-" POINTER_PRINTF_FORMAT,
@@ -10308,7 +10309,7 @@ void TR::CompilationInfoPerThreadBase::logCompilationSuccess(J9VMThread *vmThrea
1030810309
TR_VerboseLog::write(" Q_SZ=%d Q_SZI=%d QW=%d", _compInfo.getMethodQueueSize(),
1030910310
_compInfo.getNumQueuedFirstTimeCompilations(), _compInfo.getQueueWeight());
1031010311

10311-
TR_VerboseLog::write(" j9m=%p bcsz=%u", method, bytecodeSize);
10312+
TR_VerboseLog::write(" j9m=%p bcsz=%u bcszWithInling=%u", method, bytecodeSize, totalBytecodeSize);
1031210313

1031310314
if (!_methodBeingCompiled->_async)
1031410315
TR_VerboseLog::write(" sync"); // flag the synchronous compilations
@@ -10794,6 +10795,21 @@ void TR::CompilationInfoPerThreadBase::processExceptionCommonTasks(J9VMThread *v
1079410795
}
1079510796
}
1079610797

10798+
uint32_t TR::CompilationInfoPerThreadBase::computeTotalBytecodeSize(TR::Compilation *compiler)
10799+
{
10800+
TR_ResolvedMethod *method = compiler->getMethodBeingCompiled();
10801+
uint32_t result = method->maxBytecodeIndex();
10802+
10803+
for (uint32_t i = 0; i < compiler->getNumInlinedCallSites(); i++) {
10804+
TR_ResolvedMethod *m = compiler->getInlinedResolvedMethod(i);
10805+
if (m) {
10806+
result += m->maxBytecodeIndex();
10807+
}
10808+
}
10809+
10810+
return result;
10811+
}
10812+
1079710813
void TR::CompilationInfo::printCompQueue()
1079810814
{
1079910815
fprintf(stderr, "\nQueue:");

runtime/compiler/control/CompilationThread.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,8 @@ class CompilationInfoPerThreadBase {
458458
void processExceptionCommonTasks(J9VMThread *vmThread, TR::SegmentAllocator const &scratchSegmentProvider,
459459
TR::Compilation *compiler, const char *exceptionName, TR_MethodToBeCompiled *entry);
460460

461+
uint32_t computeTotalBytecodeSize(TR::Compilation *compiler);
462+
461463
#if defined(TR_HOST_S390)
462464
void outputVerboseMMapEntry(TR_ResolvedMethod *compilee, const struct ::tm &date, const struct timeval &time,
463465
void *startPC, void *endPC, const char *fmt, const char *profiledString, const char *compileString);

0 commit comments

Comments
 (0)