@@ -139,9 +139,6 @@ TR_EscapeAnalysis::TR_EscapeAnalysis(TR::OptimizationManager *manager)
139
139
/* monitors */
140
140
_removeMonitors = true ;
141
141
#endif
142
-
143
- static char *disableLoopAliasAllocationChecking = feGetEnv (" TR_disableEALoopAliasAllocationChecking" );
144
- _doLoopAllocationAliasChecking = (disableLoopAliasAllocationChecking == NULL );
145
142
}
146
143
147
144
char *TR_EscapeAnalysis::getClassName (TR::Node *classNode)
@@ -657,7 +654,7 @@ int32_t TR_EscapeAnalysis::performAnalysisOnce()
657
654
_fixedVirtualCallSites.setFirst (NULL );
658
655
659
656
_parms = NULL ;
660
- _ignoreableUses = NULL ;
657
+ _ignorableUses = NULL ;
661
658
_nonColdLocalObjectsValueNumbers = NULL ;
662
659
_allLocalObjectsValueNumbers = NULL ;
663
660
_visitedNodes = NULL ;
@@ -678,12 +675,8 @@ int32_t TR_EscapeAnalysis::performAnalysisOnce()
678
675
_useDefInfo = optimizer ()->getUseDefInfo ();
679
676
_blocksWithFlushOnEntry = new (trStackMemory ()) TR_BitVector (comp ()->getFlowGraph ()->getNextNodeNumber (), trMemory (), stackAlloc);
680
677
_visitedNodes = new (trStackMemory ()) TR_BitVector (comp ()->getNodeCount (), trMemory (), stackAlloc, growable);
681
- _aliasesOfAllocNode =
682
- _doLoopAllocationAliasChecking
683
- ? new (trStackMemory ()) TR_BitVector (0 , trMemory (), stackAlloc, growable) : NULL ;
684
- _aliasesOfOtherAllocNode =
685
- _doLoopAllocationAliasChecking
686
- ? new (trStackMemory ()) TR_BitVector (0 , trMemory (), stackAlloc, growable) : NULL ;
678
+ _aliasesOfAllocNode = new (trStackMemory ()) TR_BitVector (0 , trMemory (), stackAlloc, growable);
679
+ _aliasesOfOtherAllocNode = new (trStackMemory ()) TR_BitVector (0 , trMemory (), stackAlloc, growable);
687
680
688
681
if (!_useDefInfo)
689
682
{
@@ -701,7 +694,7 @@ int32_t TR_EscapeAnalysis::performAnalysisOnce()
701
694
}
702
695
else
703
696
{
704
- _ignoreableUses = new (trStackMemory ()) TR_BitVector (0 , trMemory (), stackAlloc);
697
+ _ignorableUses = new (trStackMemory ()) TR_BitVector (0 , trMemory (), stackAlloc);
705
698
_nonColdLocalObjectsValueNumbers = new (trStackMemory ()) TR_BitVector (_valueNumberInfo->getNumberOfValues (), trMemory (), stackAlloc);
706
699
_allLocalObjectsValueNumbers = new (trStackMemory ()) TR_BitVector (_valueNumberInfo->getNumberOfValues (), trMemory (), stackAlloc);
707
700
_notOptimizableLocalObjectsValueNumbers = new (trStackMemory ()) TR_BitVector (_valueNumberInfo->getNumberOfValues (), trMemory (), stackAlloc);
@@ -712,7 +705,7 @@ int32_t TR_EscapeAnalysis::performAnalysisOnce()
712
705
if ( !_candidates.isEmpty ())
713
706
{
714
707
findLocalObjectsValueNumbers ();
715
- findIgnoreableUses ();
708
+ findIgnorableUses ();
716
709
}
717
710
718
711
// Complete the candidate info by finding all uses and defs that are reached
@@ -1410,15 +1403,15 @@ int32_t TR_EscapeAnalysis::performAnalysisOnce()
1410
1403
return cost; // actual cost
1411
1404
}
1412
1405
1413
- void TR_EscapeAnalysis::findIgnoreableUses ()
1406
+ void TR_EscapeAnalysis::findIgnorableUses ()
1414
1407
{
1415
1408
if (comp ()->getOSRMode () != TR::voluntaryOSR)
1416
1409
return ;
1417
1410
1418
1411
TR::NodeChecklist visited (comp ());
1419
1412
bool inOSRCodeBlock = false ;
1420
1413
1421
- // Gather all uses under fake prepareForOSR calls - they will be tracked as ignoreable
1414
+ // Gather all uses under fake prepareForOSR calls - they will be tracked as ignorable
1422
1415
for (TR::TreeTop *treeTop = comp ()->getStartTree (); treeTop; treeTop = treeTop->getNextTreeTop ())
1423
1416
{
1424
1417
if (treeTop->getNode ()->getOpCodeValue () == TR::BBStart)
@@ -1427,28 +1420,30 @@ void TR_EscapeAnalysis::findIgnoreableUses()
1427
1420
&& treeTop->getNode ()->getNumChildren () > 0
1428
1421
&& treeTop->getNode ()->getFirstChild ()->getOpCodeValue () == TR::call
1429
1422
&& treeTop->getNode ()->getFirstChild ()->getSymbolReference ()->getReferenceNumber () == TR_prepareForOSR)
1430
- {
1431
- TR::Node *callNode = treeTop->getNode ()->getFirstChild ();
1432
- for (int i = 0 ; i < callNode->getNumChildren (); ++i)
1433
- findIgnoreableUses (callNode->getChild (i), visited);
1434
- }
1423
+ {
1424
+ TR::Node *callNode = treeTop->getNode ()->getFirstChild ();
1425
+ for (int i = 0 ; i < callNode->getNumChildren (); ++i)
1426
+ {
1427
+ markUsesAsIgnorable (callNode->getChild (i), visited);
1428
+ }
1429
+ }
1435
1430
}
1436
1431
}
1437
1432
1438
- void TR_EscapeAnalysis::findIgnoreableUses (TR::Node *node, TR::NodeChecklist &visited)
1433
+ void TR_EscapeAnalysis::markUsesAsIgnorable (TR::Node *node, TR::NodeChecklist &visited)
1439
1434
{
1440
1435
if (visited.contains (node))
1441
1436
return ;
1442
1437
visited.add (node);
1443
1438
if (trace ())
1444
- traceMsg (comp (), " Marking n%dn as an ignoreable use\n " , node->getGlobalIndex ());
1445
- _ignoreableUses ->set (node->getGlobalIndex ());
1439
+ traceMsg (comp (), " Marking n%dn as an ignorable use\n " , node->getGlobalIndex ());
1440
+ _ignorableUses ->set (node->getGlobalIndex ());
1446
1441
1447
1442
int32_t i;
1448
1443
for (i = 0 ; i < node->getNumChildren (); i++)
1449
1444
{
1450
1445
TR::Node *child = node->getChild (i);
1451
- findIgnoreableUses (child, visited);
1446
+ markUsesAsIgnorable (child, visited);
1452
1447
}
1453
1448
}
1454
1449
@@ -2494,7 +2489,7 @@ bool TR_EscapeAnalysis::checkDefsAndUses(TR::Node *node, Candidate *candidate)
2494
2489
TR::Node *useNode = _useDefInfo->getNode (useIndex+_useDefInfo->getFirstUseIndex ());
2495
2490
2496
2491
// Only add this value number if it's not to be ignored
2497
- if (_ignoreableUses ->get (useNode->getGlobalIndex ()))
2492
+ if (_ignorableUses ->get (useNode->getGlobalIndex ()))
2498
2493
{
2499
2494
continue ;
2500
2495
}
@@ -2622,16 +2617,7 @@ bool TR_EscapeAnalysis::checkOtherDefsOfLoopAllocation(TR::Node *useNode, Candid
2622
2617
if (trace ())
2623
2618
traceMsg (comp (), " Look at def node [%p] for use node [%p]\n " , defNode, useNode);
2624
2619
2625
- bool allnewsonrhs;
2626
-
2627
- if (_doLoopAllocationAliasChecking)
2628
- {
2629
- allnewsonrhs = checkAllNewsOnRHSInLoopWithAliasing (defIndex, useNode, candidate);
2630
- }
2631
- else
2632
- {
2633
- allnewsonrhs = checkAllNewsOnRHSInLoop (defNode, useNode, candidate);
2634
- }
2620
+ bool allnewsonrhs = checkAllNewsOnRHSInLoopWithAliasing (defIndex, useNode, candidate);
2635
2621
2636
2622
2637
2623
if (!allnewsonrhs &&
@@ -2673,8 +2659,6 @@ bool TR_EscapeAnalysis::checkOtherDefsOfLoopAllocation(TR::Node *useNode, Candid
2673
2659
2674
2660
bool TR_EscapeAnalysis::checkAllNewsOnRHSInLoopWithAliasing (int32_t defIndex, TR::Node *useNode, Candidate *candidate)
2675
2661
{
2676
- TR_ASSERT (_doLoopAllocationAliasChecking, " Reached checkAllNewsOnRHSInLoopWithAliasing unexpectedly" );
2677
-
2678
2662
// _aliasesOfAllocNode contains sym refs that are just aliases for a fresh allocation
2679
2663
// i.e. it is just a simple attempt at tracking allocations in cases such as :
2680
2664
// ...
@@ -2760,7 +2744,7 @@ bool TR_EscapeAnalysis::checkAllNewsOnRHSInLoopWithAliasing(int32_t defIndex, TR
2760
2744
2761
2745
if (trace ())
2762
2746
{
2763
- traceMsg (comp (), " Look at defNode2 [%p] with otherAllocNode [%p]\n " , defNode2, otherAllocNode);
2747
+ traceMsg (comp (), " Look at defNode2 [%p] with otherAllocNode [%p]\n " , defNode2, otherAllocNode-> _node );
2764
2748
}
2765
2749
2766
2750
if (!rhsIsHarmless &&
@@ -2800,7 +2784,7 @@ bool TR_EscapeAnalysis::checkAllNewsOnRHSInLoopWithAliasing(int32_t defIndex, TR
2800
2784
{
2801
2785
if (trace ())
2802
2786
{
2803
- traceMsg (comp (), " rhs is harmless for defNode2 [%p] with otherAllocNode [%p]\n " , defNode2, otherAllocNode);
2787
+ traceMsg (comp (), " rhs is harmless for defNode2 [%p] with otherAllocNode [%p]\n " , defNode2, otherAllocNode-> _node );
2804
2788
}
2805
2789
rhsIsHarmless = true ;
2806
2790
break ;
@@ -2880,83 +2864,6 @@ bool TR_EscapeAnalysis::checkAllNewsOnRHSInLoopWithAliasing(int32_t defIndex, TR
2880
2864
return allnewsonrhs;
2881
2865
}
2882
2866
2883
- bool TR_EscapeAnalysis::checkAllNewsOnRHSInLoop (TR::Node *defNode, TR::Node *useNode, Candidate *candidate)
2884
- {
2885
- TR_ASSERT (!_doLoopAllocationAliasChecking, " Reached checkAllNewsOnRHSInLoop unexpectedly" );
2886
-
2887
- int32_t useIndex = useNode->getUseDefIndex ();
2888
- bool allnewsonrhs = false ;
2889
-
2890
- if ((_valueNumberInfo->getValueNumber (defNode) == _valueNumberInfo->getValueNumber (candidate->_node )))
2891
- {
2892
- if ((defNode->getFirstChild () == candidate->_node ) &&
2893
- (_valueNumberInfo->getValueNumber (defNode) == _valueNumberInfo->getValueNumber (useNode)))
2894
- allnewsonrhs = true ;
2895
- else
2896
- {
2897
- allnewsonrhs = true ;
2898
- TR_UseDefInfo::BitVector defs2 (comp ()->allocator ());
2899
- _useDefInfo->getUseDef (defs2, useIndex);
2900
- TR_UseDefInfo::BitVector::Cursor cursor2 (defs2);
2901
- for (cursor2.SetToFirstOne (); cursor2.Valid (); cursor2.SetToNextOne ())
2902
- {
2903
- int32_t defIndex2 = cursor2;
2904
- if (defIndex2 == 0 )
2905
- {
2906
- allnewsonrhs = false ;
2907
- break ;
2908
- }
2909
-
2910
- TR::Node *defNode2 = _useDefInfo->getNode (defIndex2);
2911
- TR::Node *firstChild = defNode2->getFirstChild ();
2912
- bool rhsIsHarmless = false ;
2913
- for (Candidate *candidate = _candidates.getFirst (); candidate; candidate = candidate->getNext ())
2914
- {
2915
- if (candidate->_node == firstChild)
2916
- {
2917
- rhsIsHarmless = true ;
2918
- break ;
2919
- }
2920
- }
2921
-
2922
-
2923
- if (!rhsIsHarmless)
2924
- {
2925
- if (firstChild->getOpCode ().hasSymbolReference () &&
2926
- firstChild->getSymbol ()->isArrayShadowSymbol ())
2927
- {
2928
- TR::Node *addr = firstChild->getFirstChild ();
2929
- if (addr->getOpCode ().isArrayRef ())
2930
- {
2931
- TR::Node *underlyingArray = addr->getFirstChild ();
2932
-
2933
- int32_t fieldNameLen = -1 ;
2934
- char *fieldName = NULL ;
2935
- if (underlyingArray && underlyingArray->getOpCode ().hasSymbolReference () &&
2936
- underlyingArray->getSymbolReference ()->getSymbol ()->isStaticField ())
2937
- {
2938
- fieldName = underlyingArray->getSymbolReference ()->getOwningMethod (comp ())->staticName (underlyingArray->getSymbolReference ()->getCPIndex (), fieldNameLen, comp ()->trMemory ());
2939
- }
2940
-
2941
- if (fieldName && (fieldNameLen > 0 ) &&
2942
- !strncmp (fieldName, " java/lang/Integer$IntegerCache.cache" , 36 ))
2943
- rhsIsHarmless = true ;
2944
- }
2945
- }
2946
- }
2947
-
2948
- if (!rhsIsHarmless)
2949
- {
2950
- allnewsonrhs = false ;
2951
- break ;
2952
- }
2953
- }
2954
- }
2955
- }
2956
-
2957
- return allnewsonrhs;
2958
- }
2959
-
2960
2867
bool TR_EscapeAnalysis::checkOverlappingLoopAllocation (TR::Node *useNode, Candidate *candidate)
2961
2868
{
2962
2869
// The allocation is inside a loop and a use has been found that has other
@@ -2968,10 +2875,7 @@ bool TR_EscapeAnalysis::checkOverlappingLoopAllocation(TR::Node *useNode, Candid
2968
2875
//
2969
2876
TR::TreeTop *treeTop;
2970
2877
_visitedNodes->empty ();
2971
- if (_doLoopAllocationAliasChecking)
2972
- {
2973
- _aliasesOfAllocNode->empty ();
2974
- }
2878
+ _aliasesOfAllocNode->empty ();
2975
2879
rcount_t numReferences = 0 ; // candidate->_node->getReferenceCount()-1;
2976
2880
for (treeTop = candidate->_treeTop ->getEnclosingBlock ()->getEntry (); treeTop; treeTop = treeTop->getNextTreeTop ())
2977
2881
{
@@ -2998,8 +2902,7 @@ bool TR_EscapeAnalysis::checkOverlappingLoopAllocation(TR::Node *node, TR::Node
2998
2902
2999
2903
_visitedNodes->set (node->getGlobalIndex ());
3000
2904
3001
- if (_doLoopAllocationAliasChecking
3002
- && node->getOpCode ().isStore () && node->getSymbol ()->isAutoOrParm ())
2905
+ if (node->getOpCode ().isStore () && node->getSymbol ()->isAutoOrParm ())
3003
2906
{
3004
2907
if (node->getFirstChild () == allocNode)
3005
2908
{
@@ -3021,10 +2924,9 @@ bool TR_EscapeAnalysis::checkOverlappingLoopAllocation(TR::Node *node, TR::Node
3021
2924
if ((node != allocNode)
3022
2925
&& (_valueNumberInfo->getValueNumber (node) == _valueNumberInfo->getValueNumber (useNode)))
3023
2926
{
3024
- if (!_doLoopAllocationAliasChecking
3025
- || (!(node->getOpCode ().isLoadVarDirect ()
3026
- && _aliasesOfAllocNode->get (node->getSymbolReference ()->getReferenceNumber ()))
3027
- && (numReferences > 0 )))
2927
+ if (!(node->getOpCode ().isLoadVarDirect ()
2928
+ && _aliasesOfAllocNode->get (node->getSymbolReference ()->getReferenceNumber ()))
2929
+ && (numReferences > 0 ))
3028
2930
{
3029
2931
return false ;
3030
2932
}
@@ -3060,7 +2962,6 @@ void TR_EscapeAnalysis::visitTree(TR::Node *node)
3060
2962
3061
2963
void TR_EscapeAnalysis::collectAliasesOfAllocations (TR::Node *node, TR::Node *allocNode)
3062
2964
{
3063
- TR_ASSERT (_doLoopAllocationAliasChecking, " Reached collectAliasesOfAllocations unexpectedly" );
3064
2965
if (_visitedNodes->get (node->getGlobalIndex ()))
3065
2966
{
3066
2967
return ;
0 commit comments