Skip to content

Commit

Permalink
Merge pull request #21056 from vijaysun-omr/jprofiling1
Browse files Browse the repository at this point in the history
JProfiling fix to avoid too many internal pointers
  • Loading branch information
r30shah authored Feb 5, 2025
2 parents a134afa + 17da4d5 commit 8bbc086
Showing 1 changed file with 26 additions and 9 deletions.
35 changes: 26 additions & 9 deletions runtime/compiler/optimizer/JProfilingValue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,11 +317,23 @@ void
TR_JProfilingValue::lowerCalls()
{
TR::TreeTop *cursor = comp()->getStartTree();
bool stopProfiling = false;
TR_BitVector *backwardAnalyzedAddressNodesToCheck = new (comp()->trStackMemory()) TR_BitVector();
while (cursor)
{
TR::Node * node = cursor->getNode();
TR::TreeTop *nextTreeTop = cursor->getNextTreeTop();
int32_t ipMax = comp()->maxInternalPointers()/2;
static const char * ipl = feGetEnv("TR_ProfilingIPLimit");
if (ipl)
{
static const int32_t ipLimit = atoi(ipl);
ipMax = ipLimit;
}

if (!stopProfiling && (comp()->getSymRefTab()->getNumInternalPointers() >= ipMax))
stopProfiling = true;

if (node->isProfilingCode() &&
node->getOpCodeValue() == TR::treetop &&
node->getFirstChild()->getOpCode().isCall() &&
Expand Down Expand Up @@ -354,15 +366,20 @@ TR_JProfilingValue::lowerCalls()
}

backwardAnalyzedAddressNodesToCheck->empty();
TR::Node *child = node->getFirstChild();
dumpOptDetails(comp(), "%s Replacing profiling placeholder n%dn with value profiling trees\n",
optDetailString(), child->getGlobalIndex());
// Extract the arguments and add the profiling trees
TR::Node *value = child->getFirstChild();
TR_AbstractHashTableProfilerInfo *table = (TR_AbstractHashTableProfilerInfo*) child->getSecondChild()->getAddress();
bool needNullTest = comp()->getSymRefTab()->isNonHelper(child->getSymbolReference(), TR::SymbolReferenceTable::jProfileValueWithNullCHKSymbol);
addProfilingTrees(comp(), cursor, value, table, needNullTest, true, trace());
// Remove the original trees and continue from the tree after the profiling

if (!stopProfiling)
{
TR::Node *child = node->getFirstChild();
dumpOptDetails(comp(), "%s Replacing profiling placeholder n%dn with value profiling trees\n",
optDetailString(), child->getGlobalIndex());
// Extract the arguments and add the profiling trees
TR::Node *value = child->getFirstChild();
TR_AbstractHashTableProfilerInfo *table = (TR_AbstractHashTableProfilerInfo*) child->getSecondChild()->getAddress();
bool needNullTest = comp()->getSymRefTab()->isNonHelper(child->getSymbolReference(), TR::SymbolReferenceTable::jProfileValueWithNullCHKSymbol);
addProfilingTrees(comp(), cursor, value, table, needNullTest, true, trace());
// Remove the original trees and continue from the tree after the profiling
}

TR::TransformUtil::removeTree(comp(), cursor);
if (trace())
comp()->dumpMethodTrees("After Adding Profiling Trees");
Expand Down

0 comments on commit 8bbc086

Please sign in to comment.