@@ -72,7 +72,7 @@ int32_t TR_OSRGuardInsertion::perform()
72
72
if (trace ())
73
73
traceMsg (comp (), " No HCR guards to be removed - skipping\n " );
74
74
return 0 ;
75
- }
75
+ }
76
76
77
77
TR_BitVector fearGeneratingNodes (comp ()->getNodeCount (), trMemory (), stackAlloc);
78
78
removeHCRGuards (fearGeneratingNodes);
@@ -194,7 +194,7 @@ void TR_OSRGuardInsertion::removeHCRGuards(TR_BitVector &fearGeneratingNodes)
194
194
cursor->removeBranch (comp ());
195
195
196
196
// Check whether there is another virtual guard, with the same branch destination
197
- // Based on the inliner, this guard should be in the prior block and there should
197
+ // Based on the inliner, this guard should be in the prior block and there should
198
198
// be no other predecessors
199
199
//
200
200
TR::Node *potentialGuard = NULL ;
@@ -278,7 +278,7 @@ int32_t TR_OSRGuardInsertion::insertOSRGuards(TR_BitVector &fearGeneratingNodes)
278
278
cursor = block->getEntry ();
279
279
continue ;
280
280
}
281
-
281
+
282
282
// set the fearful state based on all successors - anyone who has an OSR edge is a source
283
283
// of fear and we must add a patch point if we encounter a yield otherwise we are safe
284
284
TR_SuccessorIterator sit (block);
@@ -325,7 +325,8 @@ int32_t TR_OSRGuardInsertion::insertOSRGuards(TR_BitVector &fearGeneratingNodes)
325
325
326
326
// If something went wrong with bookkeeping, due to the nature of the implicit OSR point,
327
327
// this will return false
328
- bool induceOSR = comp ()->getMethodSymbol ()->induceOSRAfter (cursor, nodeBCI, guard, false , 0 , &cfgEnd);
328
+ bool induceOSR = comp ()->allowRecompilation () ? comp ()->getMethodSymbol ()->induceOSRAfterAndRecompile (cursor, nodeBCI, guard, false , 0 , &cfgEnd):
329
+ comp ()->getMethodSymbol ()->induceOSRAfter (cursor, nodeBCI, guard, false , 0 , &cfgEnd);
329
330
330
331
if (trace ())
331
332
{
@@ -426,7 +427,8 @@ int32_t TR_OSRGuardInsertion::insertOSRGuards(TR_BitVector &fearGeneratingNodes)
426
427
guard->getNode ()->getFirstChild ()->setByteCodeInfo (guardBCI);
427
428
guard->getNode ()->getSecondChild ()->setByteCodeInfo (guardBCI);
428
429
429
- bool induceOSR = targetMethod->induceOSRAfter (inductionPoint, nodeBCI, guard, false , comp ()->getOSRInductionOffset (cursor->getNode ()), &cfgEnd);
430
+ bool induceOSR = comp ()->allowRecompilation () ? targetMethod->induceOSRAfterAndRecompile (inductionPoint, nodeBCI, guard, false , comp ()->getOSRInductionOffset (cursor->getNode ()), &cfgEnd):
431
+ targetMethod->induceOSRAfter (inductionPoint, nodeBCI, guard, false , comp ()->getOSRInductionOffset (cursor->getNode ()), &cfgEnd);
430
432
431
433
if (trace () && induceOSR)
432
434
traceMsg (comp (), " OSR induction added successfully\n " );
@@ -497,7 +499,7 @@ void TR_OSRGuardInsertion::generateTriggeringRecompilationTrees(TR::TreeTop *osr
497
499
void TR_OSRGuardInsertion::performRemat (TR::TreeTop *osrPoint, TR::TreeTop *osrGuard,
498
500
TR::TreeTop *rematDest)
499
501
{
500
- static const char *p = feGetEnv (" TR_OSRRematBlockLimit" );
502
+ static const char *p = feGetEnv (" TR_OSRRematBlockLimit" );
501
503
static uint32_t rematBlockLimit = p ? atoi (p) : defaultRematBlockLimit;
502
504
503
505
// The block containing the OSR point and the guard
@@ -524,7 +526,7 @@ void TR_OSRGuardInsertion::performRemat(TR::TreeTop *osrPoint, TR::TreeTop *osrG
524
526
525
527
// Collect remat candidates
526
528
//
527
- uint32_t rematBlocks = 1 ;
529
+ uint32_t rematBlocks = 1 ;
528
530
TR::SparseBitVector seen (comp ()->allocator ());
529
531
for (TR::TreeTop *cursor = realStart; cursor; cursor = cursor->getPrevTreeTop ())
530
532
{
@@ -544,7 +546,7 @@ void TR_OSRGuardInsertion::performRemat(TR::TreeTop *osrPoint, TR::TreeTop *osrG
544
546
{
545
547
if (trace ())
546
548
traceMsg (comp (), " remat block limit %d reached at block_%d, starting remat\n " , rematBlockLimit, block->getNumber ());
547
- break ;
549
+ break ;
548
550
}
549
551
550
552
TR::Block *next;
@@ -623,7 +625,7 @@ void TR_OSRGuardInsertion::performRemat(TR::TreeTop *osrPoint, TR::TreeTop *osrG
623
625
// partially rematerialize the argument
624
626
if (!*iter)
625
627
continue ;
626
-
628
+
627
629
TR::TreeTop *storeTree = *iter;
628
630
TR::Node *store = storeTree->getNode ();
629
631
if (trace ())
0 commit comments