Skip to content

Commit 8bbc086

Browse files
authored
Merge pull request #21056 from vijaysun-omr/jprofiling1
JProfiling fix to avoid too many internal pointers
2 parents a134afa + 17da4d5 commit 8bbc086

File tree

1 file changed

+26
-9
lines changed

1 file changed

+26
-9
lines changed

runtime/compiler/optimizer/JProfilingValue.cpp

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -317,11 +317,23 @@ void
317317
TR_JProfilingValue::lowerCalls()
318318
{
319319
TR::TreeTop *cursor = comp()->getStartTree();
320+
bool stopProfiling = false;
320321
TR_BitVector *backwardAnalyzedAddressNodesToCheck = new (comp()->trStackMemory()) TR_BitVector();
321322
while (cursor)
322323
{
323324
TR::Node * node = cursor->getNode();
324325
TR::TreeTop *nextTreeTop = cursor->getNextTreeTop();
326+
int32_t ipMax = comp()->maxInternalPointers()/2;
327+
static const char * ipl = feGetEnv("TR_ProfilingIPLimit");
328+
if (ipl)
329+
{
330+
static const int32_t ipLimit = atoi(ipl);
331+
ipMax = ipLimit;
332+
}
333+
334+
if (!stopProfiling && (comp()->getSymRefTab()->getNumInternalPointers() >= ipMax))
335+
stopProfiling = true;
336+
325337
if (node->isProfilingCode() &&
326338
node->getOpCodeValue() == TR::treetop &&
327339
node->getFirstChild()->getOpCode().isCall() &&
@@ -354,15 +366,20 @@ TR_JProfilingValue::lowerCalls()
354366
}
355367

356368
backwardAnalyzedAddressNodesToCheck->empty();
357-
TR::Node *child = node->getFirstChild();
358-
dumpOptDetails(comp(), "%s Replacing profiling placeholder n%dn with value profiling trees\n",
359-
optDetailString(), child->getGlobalIndex());
360-
// Extract the arguments and add the profiling trees
361-
TR::Node *value = child->getFirstChild();
362-
TR_AbstractHashTableProfilerInfo *table = (TR_AbstractHashTableProfilerInfo*) child->getSecondChild()->getAddress();
363-
bool needNullTest = comp()->getSymRefTab()->isNonHelper(child->getSymbolReference(), TR::SymbolReferenceTable::jProfileValueWithNullCHKSymbol);
364-
addProfilingTrees(comp(), cursor, value, table, needNullTest, true, trace());
365-
// Remove the original trees and continue from the tree after the profiling
369+
370+
if (!stopProfiling)
371+
{
372+
TR::Node *child = node->getFirstChild();
373+
dumpOptDetails(comp(), "%s Replacing profiling placeholder n%dn with value profiling trees\n",
374+
optDetailString(), child->getGlobalIndex());
375+
// Extract the arguments and add the profiling trees
376+
TR::Node *value = child->getFirstChild();
377+
TR_AbstractHashTableProfilerInfo *table = (TR_AbstractHashTableProfilerInfo*) child->getSecondChild()->getAddress();
378+
bool needNullTest = comp()->getSymRefTab()->isNonHelper(child->getSymbolReference(), TR::SymbolReferenceTable::jProfileValueWithNullCHKSymbol);
379+
addProfilingTrees(comp(), cursor, value, table, needNullTest, true, trace());
380+
// Remove the original trees and continue from the tree after the profiling
381+
}
382+
366383
TR::TransformUtil::removeTree(comp(), cursor);
367384
if (trace())
368385
comp()->dumpMethodTrees("After Adding Profiling Trees");

0 commit comments

Comments
 (0)