@@ -317,11 +317,23 @@ void
317
317
TR_JProfilingValue::lowerCalls ()
318
318
{
319
319
TR::TreeTop *cursor = comp ()->getStartTree ();
320
+ bool stopProfiling = false ;
320
321
TR_BitVector *backwardAnalyzedAddressNodesToCheck = new (comp ()->trStackMemory ()) TR_BitVector ();
321
322
while (cursor)
322
323
{
323
324
TR::Node * node = cursor->getNode ();
324
325
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
+
325
337
if (node->isProfilingCode () &&
326
338
node->getOpCodeValue () == TR::treetop &&
327
339
node->getFirstChild ()->getOpCode ().isCall () &&
@@ -354,15 +366,20 @@ TR_JProfilingValue::lowerCalls()
354
366
}
355
367
356
368
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
+
366
383
TR::TransformUtil::removeTree (comp (), cursor);
367
384
if (trace ())
368
385
comp ()->dumpMethodTrees (" After Adding Profiling Trees" );
0 commit comments