< prev index next >

src/hotspot/share/opto/loopTransform.cpp

Print this page




2775 }
2776 
2777 
2778 //------------------------------adjust_loop_exit_prob--------------------------
2779 // Look for loop-exit tests with the 50/50 (or worse) guesses from the parsing stage.
2780 // Replace with a 1-in-10 exit guess.
2781 void IdealLoopTree::adjust_loop_exit_prob( PhaseIdealLoop *phase ) {
2782   Node *test = tail();
2783   while( test != _head ) {
2784     uint top = test->Opcode();
2785     if( top == Op_IfTrue || top == Op_IfFalse ) {
2786       int test_con = ((ProjNode*)test)->_con;
2787       assert(top == (uint)(test_con? Op_IfTrue: Op_IfFalse), "sanity");
2788       IfNode *iff = test->in(0)->as_If();
2789       if( iff->outcnt() == 2 ) {        // Ignore dead tests
2790         Node *bol = iff->in(1);
2791         if( bol && bol->req() > 1 && bol->in(1) &&
2792             ((bol->in(1)->Opcode() == Op_StorePConditional ) ||
2793              (bol->in(1)->Opcode() == Op_StoreIConditional ) ||
2794              (bol->in(1)->Opcode() == Op_StoreLConditional ) ||








2795              (bol->in(1)->Opcode() == Op_CompareAndExchangeB ) ||
2796              (bol->in(1)->Opcode() == Op_CompareAndExchangeS ) ||
2797              (bol->in(1)->Opcode() == Op_CompareAndExchangeI ) ||
2798              (bol->in(1)->Opcode() == Op_CompareAndExchangeL ) ||
2799              (bol->in(1)->Opcode() == Op_CompareAndExchangeP ) ||
2800              (bol->in(1)->Opcode() == Op_CompareAndExchangeN ) ||
2801              (bol->in(1)->Opcode() == Op_WeakCompareAndSwapB ) ||
2802              (bol->in(1)->Opcode() == Op_WeakCompareAndSwapS ) ||
2803              (bol->in(1)->Opcode() == Op_WeakCompareAndSwapI ) ||
2804              (bol->in(1)->Opcode() == Op_WeakCompareAndSwapL ) ||
2805              (bol->in(1)->Opcode() == Op_WeakCompareAndSwapP ) ||
2806              (bol->in(1)->Opcode() == Op_WeakCompareAndSwapN ) ||
2807              (bol->in(1)->Opcode() == Op_CompareAndSwapB ) ||
2808              (bol->in(1)->Opcode() == Op_CompareAndSwapS ) ||
2809              (bol->in(1)->Opcode() == Op_CompareAndSwapI ) ||
2810              (bol->in(1)->Opcode() == Op_CompareAndSwapL ) ||
2811              (bol->in(1)->Opcode() == Op_CompareAndSwapP ) ||
2812              (bol->in(1)->Opcode() == Op_CompareAndSwapN )))
2813           return;               // Allocation loops RARELY take backedge
2814         // Find the OTHER exit path from the IF




2775 }
2776 
2777 
2778 //------------------------------adjust_loop_exit_prob--------------------------
2779 // Look for loop-exit tests with the 50/50 (or worse) guesses from the parsing stage.
2780 // Replace with a 1-in-10 exit guess.
2781 void IdealLoopTree::adjust_loop_exit_prob( PhaseIdealLoop *phase ) {
2782   Node *test = tail();
2783   while( test != _head ) {
2784     uint top = test->Opcode();
2785     if( top == Op_IfTrue || top == Op_IfFalse ) {
2786       int test_con = ((ProjNode*)test)->_con;
2787       assert(top == (uint)(test_con? Op_IfTrue: Op_IfFalse), "sanity");
2788       IfNode *iff = test->in(0)->as_If();
2789       if( iff->outcnt() == 2 ) {        // Ignore dead tests
2790         Node *bol = iff->in(1);
2791         if( bol && bol->req() > 1 && bol->in(1) &&
2792             ((bol->in(1)->Opcode() == Op_StorePConditional ) ||
2793              (bol->in(1)->Opcode() == Op_StoreIConditional ) ||
2794              (bol->in(1)->Opcode() == Op_StoreLConditional ) ||
2795 #if INCLUDE_SHENANDOAHGC
2796              (bol->in(1)->Opcode() == Op_ShenandoahCompareAndExchangeP ) ||
2797              (bol->in(1)->Opcode() == Op_ShenandoahCompareAndExchangeN ) ||
2798              (bol->in(1)->Opcode() == Op_ShenandoahWeakCompareAndSwapP ) ||
2799              (bol->in(1)->Opcode() == Op_ShenandoahWeakCompareAndSwapN ) ||
2800              (bol->in(1)->Opcode() == Op_ShenandoahCompareAndSwapP ) ||
2801              (bol->in(1)->Opcode() == Op_ShenandoahCompareAndSwapN ) ||
2802 #endif
2803              (bol->in(1)->Opcode() == Op_CompareAndExchangeB ) ||
2804              (bol->in(1)->Opcode() == Op_CompareAndExchangeS ) ||
2805              (bol->in(1)->Opcode() == Op_CompareAndExchangeI ) ||
2806              (bol->in(1)->Opcode() == Op_CompareAndExchangeL ) ||
2807              (bol->in(1)->Opcode() == Op_CompareAndExchangeP ) ||
2808              (bol->in(1)->Opcode() == Op_CompareAndExchangeN ) ||
2809              (bol->in(1)->Opcode() == Op_WeakCompareAndSwapB ) ||
2810              (bol->in(1)->Opcode() == Op_WeakCompareAndSwapS ) ||
2811              (bol->in(1)->Opcode() == Op_WeakCompareAndSwapI ) ||
2812              (bol->in(1)->Opcode() == Op_WeakCompareAndSwapL ) ||
2813              (bol->in(1)->Opcode() == Op_WeakCompareAndSwapP ) ||
2814              (bol->in(1)->Opcode() == Op_WeakCompareAndSwapN ) ||
2815              (bol->in(1)->Opcode() == Op_CompareAndSwapB ) ||
2816              (bol->in(1)->Opcode() == Op_CompareAndSwapS ) ||
2817              (bol->in(1)->Opcode() == Op_CompareAndSwapI ) ||
2818              (bol->in(1)->Opcode() == Op_CompareAndSwapL ) ||
2819              (bol->in(1)->Opcode() == Op_CompareAndSwapP ) ||
2820              (bol->in(1)->Opcode() == Op_CompareAndSwapN )))
2821           return;               // Allocation loops RARELY take backedge
2822         // Find the OTHER exit path from the IF


< prev index next >