Skip to content

Commit 0c2bd78

Browse files
authored
Merge pull request #21557 from dsouzai/verboseInliningAOT
Add Verbose Inlining output for AOT Loads
2 parents 782c4fe + 0ea071e commit 0c2bd78

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

runtime/compiler/runtime/RelocationRuntime.cpp

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,15 @@ void TR_RelocationRuntime::relocationFailureCleanup()
537537
}
538538
}
539539

540+
static int32_t strHash(const char *str)
541+
{
542+
// The string hash from Java
543+
int32_t result = 0;
544+
for (const unsigned char *s = reinterpret_cast<const unsigned char*>(str); *s; s++)
545+
result = result * 33 + *s;
546+
return result;
547+
}
548+
540549
// Function called for AOT method from both JXE and Shared Classes to perform relocations
541550
//
542551
void
@@ -703,6 +712,37 @@ TR_RelocationRuntime::relocateAOTCodeAndData(U_8 *tempDataStart,
703712
}
704713
}
705714

715+
if (_exceptionTable->inlinedCalls)
716+
{
717+
if (comp()->getOptions()->getVerboseOption(TR_VerboseInlining))
718+
{
719+
U_32 numInlinedCallSites = getNumInlinedCallSites(_exceptionTable);
720+
int32_t jittedBodyHash = strHash(comp()->signature());
721+
char callerBuf[501], calleeBuf[501];
722+
TR_VerboseLog::CriticalSection vlogLock;
723+
TR_VerboseLog::writeLine(TR_Vlog_INL, "%d methods inlined into %x %s @ %p", numInlinedCallSites, jittedBodyHash, comp()->signature(), _exceptionTable->startPC);
724+
for (auto siteIndex = 0; siteIndex < numInlinedCallSites; siteIndex++)
725+
{
726+
TR_InlinedCallSite *site = (TR_InlinedCallSite *)getInlinedCallSiteArrayElement(_exceptionTable, siteIndex);
727+
int32_t calleeLen = fej9()->printTruncatedSignature(calleeBuf, sizeof(calleeBuf)-1, site->_methodInfo);
728+
calleeBuf[calleeLen] = 0; // null terminate
729+
const char *callerSig = comp()->signature();
730+
int16_t callerIndex = site->_byteCodeInfo.getCallerIndex();
731+
if (callerIndex != -1)
732+
{
733+
TR_InlinedCallSite *callerCallsite = (TR_InlinedCallSite *)getInlinedCallSiteArrayElement(_exceptionTable, callerIndex);
734+
int32_t callerLen = fej9()->printTruncatedSignature(callerBuf, sizeof(callerBuf)-1, callerCallsite->_methodInfo);
735+
callerBuf[callerLen] = 0; // null terminate
736+
callerSig = callerBuf;
737+
}
738+
TR_VerboseLog::writeLine(TR_Vlog_INL, "#%d: %x #%d inlined %x@%d -> %x bcsz=%d %s",
739+
siteIndex, jittedBodyHash, callerIndex,
740+
strHash(callerSig), site->_byteCodeInfo.getByteCodeIndex(),
741+
strHash(calleeBuf), TR::Compiler->mtd.bytecodeSize(site->_methodInfo), calleeBuf);
742+
}
743+
}
744+
}
745+
706746
// Fix RAM method and send target AFTER all relocations are complete.
707747
startPC = _exceptionTable->startPC;
708748
} //end if J9_JIT_DCE_EXCEPTION_INFO

0 commit comments

Comments
 (0)