--- old/src/share/vm/opto/loopTransform.cpp 2016-07-11 22:46:32.998424705 +0900 +++ new/src/share/vm/opto/loopTransform.cpp 2016-07-11 22:46:32.858425195 +0900 @@ -124,7 +124,7 @@ Node* back = head->in(LoopNode::LoopBackControl); while (back != head) { - if ((back->Opcode() == Op_IfTrue || back->Opcode() == Op_IfFalse) && + if ((back->Opcode() == Opcodes::Op_IfTrue || back->Opcode() == Opcodes::Op_IfFalse) && back->in(0) && back->in(0)->is_If() && back->in(0)->as_If()->_fcnt != COUNT_UNKNOWN && @@ -134,7 +134,7 @@ back = phase->idom(back); } if (back != head) { - assert((back->Opcode() == Op_IfTrue || back->Opcode() == Op_IfFalse) && + assert((back->Opcode() == Opcodes::Op_IfTrue || back->Opcode() == Opcodes::Op_IfFalse) && back->in(0), "if-projection exists"); IfNode* back_if = back->in(0)->as_If(); float loop_back_cnt = back_if->_fcnt * back_if->_prob; @@ -149,7 +149,7 @@ Node *exit = is_loop_exit(iff); if( exit ) { float exit_prob = iff->_prob; - if (exit->Opcode() == Op_IfFalse) exit_prob = 1.0 - exit_prob; + if (exit->Opcode() == Opcodes::Op_IfFalse) exit_prob = 1.0 - exit_prob; if (exit_prob > PROB_MIN) { float exit_cnt = iff->_fcnt * exit_prob; loop_exit_cnt += exit_cnt; @@ -177,8 +177,8 @@ // Return nonzero index of invariant operand for an Add or Sub // of (nonconstant) invariant and variant values. Helper for reassociate_invariants. int IdealLoopTree::is_invariant_addition(Node* n, PhaseIdealLoop *phase) { - int op = n->Opcode(); - if (op == Op_AddI || op == Op_SubI) { + Opcodes op = n->Opcode(); + if (op == Opcodes::Op_AddI || op == Opcodes::Op_SubI) { bool in1_invar = this->is_invariant(n->in(1)); bool in2_invar = this->is_invariant(n->in(2)); if (in1_invar && !in2_invar) return 1; @@ -290,7 +290,7 @@ if (ctrl->is_top()) return false; // Found dead test on live IF? No peeling! // Standard IF only has one input value to check for loop invariance - assert(test->Opcode() == Op_If || test->Opcode() == Op_CountedLoopEnd || test->Opcode() == Op_RangeCheck, "Check this code when new subtype is added"); + assert(test->Opcode() == Opcodes::Op_If || test->Opcode() == Opcodes::Op_CountedLoopEnd || test->Opcode() == Opcodes::Op_RangeCheck, "Check this code when new subtype is added"); // Condition is not a member of this loop? if( !is_member(phase->get_loop(ctrl)) && is_loop_exit(test) ) @@ -315,8 +315,8 @@ Node *test = prev->in(0); while( test != loop->_head ) { // Scan till run off top of loop - int p_op = prev->Opcode(); - if( (p_op == Op_IfFalse || p_op == Op_IfTrue) && + Opcodes p_op = prev->Opcode(); + if( (p_op == Opcodes::Op_IfFalse || p_op == Opcodes::Op_IfTrue) && test->is_If() && // Test? !test->in(1)->is_Con() && // And not already obvious? // Condition is not a member of this loop? @@ -619,18 +619,18 @@ for (uint k = 0; k < _body.size(); k++) { Node* n = _body.at(k); switch (n->Opcode()) { - case Op_StrComp: - case Op_StrEquals: - case Op_StrIndexOf: - case Op_StrIndexOfChar: - case Op_EncodeISOArray: - case Op_AryEq: - case Op_HasNegatives: { + case Opcodes::Op_StrComp: + case Opcodes::Op_StrEquals: + case Opcodes::Op_StrIndexOf: + case Opcodes::Op_StrIndexOfChar: + case Opcodes::Op_EncodeISOArray: + case Opcodes::Op_AryEq: + case Opcodes::Op_HasNegatives: { return false; } #if INCLUDE_RTM_OPT - case Op_FastLock: - case Op_FastUnlock: { + case Opcodes::Op_FastLock: + case Opcodes::Op_FastUnlock: { // Don't unroll RTM locking code because it is large. if (UseRTMLocking) { return false; @@ -737,24 +737,24 @@ for (uint k = 0; k < _body.size(); k++) { Node* n = _body.at(k); switch (n->Opcode()) { - case Op_XorI: xors_in_loop++; break; // CRC32 java code - case Op_ModL: body_size += 30; break; - case Op_DivL: body_size += 30; break; - case Op_MulL: body_size += 10; break; - case Op_StrComp: - case Op_StrEquals: - case Op_StrIndexOf: - case Op_StrIndexOfChar: - case Op_EncodeISOArray: - case Op_AryEq: - case Op_HasNegatives: { + case Opcodes::Op_XorI: xors_in_loop++; break; // CRC32 java code + case Opcodes::Op_ModL: body_size += 30; break; + case Opcodes::Op_DivL: body_size += 30; break; + case Opcodes::Op_MulL: body_size += 10; break; + case Opcodes::Op_StrComp: + case Opcodes::Op_StrEquals: + case Opcodes::Op_StrIndexOf: + case Opcodes::Op_StrIndexOfChar: + case Opcodes::Op_EncodeISOArray: + case Opcodes::Op_AryEq: + case Opcodes::Op_HasNegatives: { // Do not unroll a loop with String intrinsics code. // String intrinsics are large and have loops. return false; } #if INCLUDE_RTM_OPT - case Op_FastLock: - case Op_FastUnlock: { + case Opcodes::Op_FastLock: + case Opcodes::Op_FastUnlock: { // Don't unroll RTM locking code because it is large. if (UseRTMLocking) { return false; @@ -861,14 +861,14 @@ // loop-invariant. for (uint i = 0; i < _body.size(); i++) { Node *iff = _body[i]; - if (iff->Opcode() == Op_If || - iff->Opcode() == Op_RangeCheck) { // Test? + if (iff->Opcode() == Opcodes::Op_If || + iff->Opcode() == Opcodes::Op_RangeCheck) { // Test? // Comparing trip+off vs limit Node *bol = iff->in(1); if (bol->req() != 2) continue; // dead constant test if (!bol->is_Bool()) { - assert(bol->Opcode() == Op_Conv2B, "predicate check only"); + assert(bol->Opcode() == Opcodes::Op_Conv2B, "predicate check only"); continue; } if (bol->as_Bool()->_test._test == BoolTest::ne) @@ -1047,7 +1047,7 @@ // Find the pre-loop normal exit. Node* pre_exit = pre_end->proj_out(false); - assert( pre_exit->Opcode() == Op_IfFalse, "" ); + assert( pre_exit->Opcode() == Opcodes::Op_IfFalse, "" ); IfFalseNode *new_pre_exit = new IfFalseNode(pre_end); _igvn.register_new_node_with_optimizer( new_pre_exit ); set_idom(new_pre_exit, pre_end, dd_main_head); @@ -1302,13 +1302,13 @@ //------------------------------ // Step A: Create a new post-Loop. Node* main_exit = main_end->proj_out(false); - assert(main_exit->Opcode() == Op_IfFalse, ""); + assert(main_exit->Opcode() == Opcodes::Op_IfFalse, ""); int dd_main_exit = dom_depth(main_exit); // Step A1: Clone the loop body of main. The clone becomes the vector post-loop. // The main loop pre-header illegally has 2 control users (old & new loops). clone_loop(loop, old_new, dd_main_exit); - assert(old_new[main_end->_idx]->Opcode() == Op_CountedLoopEnd, ""); + assert(old_new[main_end->_idx]->Opcode() == Opcodes::Op_CountedLoopEnd, ""); post_head = old_new[main_head->_idx]->as_CountedLoop(); post_head->set_normal_loop(); post_head->set_post_loop(main_head); @@ -1534,10 +1534,10 @@ Node* adj_limit = NULL; Node* bol = limit->is_CMove() ? limit->in(CMoveNode::Condition) : NULL; if (loop_head->unrolled_count() > 1 && - limit->is_CMove() && limit->Opcode() == Op_CMoveI && + limit->is_CMove() && limit->Opcode() == Opcodes::Op_CMoveI && limit->in(CMoveNode::IfTrue) == adj_max && bol->as_Bool()->_test._test == bt && - bol->in(1)->Opcode() == Op_CmpI && + bol->in(1)->Opcode() == Opcodes::Op_CmpI && bol->in(1)->in(2) == limit->in(CMoveNode::IfFalse)) { // Loop was unrolled before. // Optimize the limit to avoid nested CMove: @@ -1717,7 +1717,7 @@ Node* n_ctrl = get_ctrl(def_node); if (n_ctrl != NULL && loop->is_member(get_loop(n_ctrl))) { // Now test it to see if it fits the standard pattern for a reduction operator. - int opc = def_node->Opcode(); + Opcodes opc = def_node->Opcode(); if (opc != ReductionNode::opcode(opc, def_node->bottom_type()->basic_type())) { if (!def_node->is_reduction()) { // Not marked yet // To be a reduction, the arithmetic node must have the phi as input and provide a def to it @@ -1918,8 +1918,8 @@ } return true; } - int opc = exp->Opcode(); - if (opc == Op_MulI) { + Opcodes opc = exp->Opcode(); + if (opc == Opcodes::Op_MulI) { if (exp->in(1) == iv && exp->in(2)->is_Con()) { if (p_scale != NULL) { *p_scale = exp->in(2)->get_int(); @@ -1932,7 +1932,7 @@ } return true; } - } else if (opc == Op_LShiftI) { + } else if (opc == Opcodes::Op_LShiftI) { if (exp->in(1) == iv && exp->in(2)->is_Con()) { if (p_scale != NULL) { *p_scale = 1 << exp->in(2)->get_int(); @@ -1954,8 +1954,8 @@ } return true; } - int opc = exp->Opcode(); - if (opc == Op_AddI) { + Opcodes opc = exp->Opcode(); + if (opc == Opcodes::Op_AddI) { if (is_scaled_iv(exp->in(1), iv, p_scale)) { if (p_offset != NULL) { *p_offset = exp->in(2); @@ -1982,7 +1982,7 @@ return true; } } - } else if (opc == Op_SubI) { + } else if (opc == Opcodes::Op_SubI) { if (is_scaled_iv(exp->in(1), iv, p_scale)) { if (p_offset != NULL) { Node *zero = _igvn.intcon(0); @@ -2049,7 +2049,7 @@ // not ever trip low tests. Node *p_f = iffm->in(0); // pre loop may have been optimized out - if (p_f->Opcode() != Op_IfFalse) { + if (p_f->Opcode() != Opcodes::Op_IfFalse) { return closed_range_checks; } CountedLoopEndNode *pre_end = p_f->in(0)->as_CountedLoopEnd(); @@ -2058,7 +2058,7 @@ // Occasionally it's possible for a pre-loop Opaque1 node to be // optimized away and then another round of loop opts attempted. // We can not optimize this particular loop in that case. - if (pre_opaq1->Opcode() != Op_Opaque1) + if (pre_opaq1->Opcode() != Opcodes::Op_Opaque1) return closed_range_checks; Opaque1Node *pre_opaq = (Opaque1Node*)pre_opaq1; Node *pre_limit = pre_opaq->in(1); @@ -2099,14 +2099,14 @@ // loop-invariant. for( uint i = 0; i < loop->_body.size(); i++ ) { Node *iff = loop->_body[i]; - if (iff->Opcode() == Op_If || - iff->Opcode() == Op_RangeCheck) { // Test? + if (iff->Opcode() == Opcodes::Op_If || + iff->Opcode() == Opcodes::Op_RangeCheck) { // Test? // Test is an IfNode, has 2 projections. If BOTH are in the loop // we need loop unswitching instead of iteration splitting. closed_range_checks++; Node *exit = loop->is_loop_exit(iff); if( !exit ) continue; - int flip = (exit->Opcode() == Op_IfTrue) ? 1 : 0; + int flip = (exit->Opcode() == Opcodes::Op_IfTrue) ? 1 : 0; // Get boolean condition to test Node *i1 = iff->in(1); @@ -2175,7 +2175,7 @@ // sense of the test. // Adjust pre and main loop limits to guard the correct iteration set - if( cmp->Opcode() == Op_CmpU ) {// Unsigned compare is really 2 tests + if( cmp->Opcode() == Opcodes::Op_CmpU ) {// Unsigned compare is really 2 tests if( b_test._test == BoolTest::lt ) { // Range checks always use lt // The underflow and overflow limits: 0 <= scale*I+offset < limit add_constraint( stride_con, scale_con, offset, zero, limit, pre_ctrl, &pre_limit, &main_limit ); @@ -2243,7 +2243,7 @@ --imax; } } - if (limit->Opcode() == Op_LoadRange) { + if (limit->Opcode() == Opcodes::Op_LoadRange) { closed_range_checks--; } @@ -2301,8 +2301,8 @@ // Now check for existance of range checks for (uint i = 0; i < loop->_body.size(); i++) { Node *iff = loop->_body[i]; - int iff_opc = iff->Opcode(); - if (iff_opc == Op_If || iff_opc == Op_RangeCheck) { + Opcodes iff_opc = iff->Opcode(); + if (iff_opc == Opcodes::Op_If || iff_opc == Opcodes::Op_RangeCheck) { cl->mark_has_range_checks(); break; } @@ -2323,8 +2323,8 @@ Unique_Node_List worklist; for (uint i = 0; i < legacy_loop->_body.size(); i++) { Node *iff = legacy_loop->_body[i]; - int iff_opc = iff->Opcode(); - if (iff_opc == Op_If || iff_opc == Op_RangeCheck) { + Opcodes iff_opc = iff->Opcode(); + if (iff_opc == Opcodes::Op_If || iff_opc == Opcodes::Op_RangeCheck) { worklist.push(iff); } } @@ -2382,7 +2382,7 @@ Node *rc_cmpzm = rc_bolzm->in(1); if (rc_cmpzm->is_Cmp()) { Node *rc_left = rc_cmpzm->in(2); - if (rc_left->Opcode() != Op_LoadRange) { + if (rc_left->Opcode() != Opcodes::Op_LoadRange) { multi_version_succeeded = false; break; } @@ -2461,41 +2461,41 @@ void IdealLoopTree::adjust_loop_exit_prob( PhaseIdealLoop *phase ) { Node *test = tail(); while( test != _head ) { - uint top = test->Opcode(); - if( top == Op_IfTrue || top == Op_IfFalse ) { + Opcodes top = test->Opcode(); + if( top == Opcodes::Op_IfTrue || top == Opcodes::Op_IfFalse ) { int test_con = ((ProjNode*)test)->_con; - assert(top == (uint)(test_con? Op_IfTrue: Op_IfFalse), "sanity"); + assert(top == (test_con? Opcodes::Op_IfTrue: Opcodes::Op_IfFalse), "sanity"); IfNode *iff = test->in(0)->as_If(); if( iff->outcnt() == 2 ) { // Ignore dead tests Node *bol = iff->in(1); if( bol && bol->req() > 1 && bol->in(1) && - ((bol->in(1)->Opcode() == Op_StorePConditional ) || - (bol->in(1)->Opcode() == Op_StoreIConditional ) || - (bol->in(1)->Opcode() == Op_StoreLConditional ) || - (bol->in(1)->Opcode() == Op_CompareAndExchangeB ) || - (bol->in(1)->Opcode() == Op_CompareAndExchangeS ) || - (bol->in(1)->Opcode() == Op_CompareAndExchangeI ) || - (bol->in(1)->Opcode() == Op_CompareAndExchangeL ) || - (bol->in(1)->Opcode() == Op_CompareAndExchangeP ) || - (bol->in(1)->Opcode() == Op_CompareAndExchangeN ) || - (bol->in(1)->Opcode() == Op_WeakCompareAndSwapB ) || - (bol->in(1)->Opcode() == Op_WeakCompareAndSwapS ) || - (bol->in(1)->Opcode() == Op_WeakCompareAndSwapI ) || - (bol->in(1)->Opcode() == Op_WeakCompareAndSwapL ) || - (bol->in(1)->Opcode() == Op_WeakCompareAndSwapP ) || - (bol->in(1)->Opcode() == Op_WeakCompareAndSwapN ) || - (bol->in(1)->Opcode() == Op_CompareAndSwapB ) || - (bol->in(1)->Opcode() == Op_CompareAndSwapS ) || - (bol->in(1)->Opcode() == Op_CompareAndSwapI ) || - (bol->in(1)->Opcode() == Op_CompareAndSwapL ) || - (bol->in(1)->Opcode() == Op_CompareAndSwapP ) || - (bol->in(1)->Opcode() == Op_CompareAndSwapN ))) + ((bol->in(1)->Opcode() == Opcodes::Op_StorePConditional ) || + (bol->in(1)->Opcode() == Opcodes::Op_StoreIConditional ) || + (bol->in(1)->Opcode() == Opcodes::Op_StoreLConditional ) || + (bol->in(1)->Opcode() == Opcodes::Op_CompareAndExchangeB ) || + (bol->in(1)->Opcode() == Opcodes::Op_CompareAndExchangeS ) || + (bol->in(1)->Opcode() == Opcodes::Op_CompareAndExchangeI ) || + (bol->in(1)->Opcode() == Opcodes::Op_CompareAndExchangeL ) || + (bol->in(1)->Opcode() == Opcodes::Op_CompareAndExchangeP ) || + (bol->in(1)->Opcode() == Opcodes::Op_CompareAndExchangeN ) || + (bol->in(1)->Opcode() == Opcodes::Op_WeakCompareAndSwapB ) || + (bol->in(1)->Opcode() == Opcodes::Op_WeakCompareAndSwapS ) || + (bol->in(1)->Opcode() == Opcodes::Op_WeakCompareAndSwapI ) || + (bol->in(1)->Opcode() == Opcodes::Op_WeakCompareAndSwapL ) || + (bol->in(1)->Opcode() == Opcodes::Op_WeakCompareAndSwapP ) || + (bol->in(1)->Opcode() == Opcodes::Op_WeakCompareAndSwapN ) || + (bol->in(1)->Opcode() == Opcodes::Op_CompareAndSwapB ) || + (bol->in(1)->Opcode() == Opcodes::Op_CompareAndSwapS ) || + (bol->in(1)->Opcode() == Opcodes::Op_CompareAndSwapI ) || + (bol->in(1)->Opcode() == Opcodes::Op_CompareAndSwapL ) || + (bol->in(1)->Opcode() == Opcodes::Op_CompareAndSwapP ) || + (bol->in(1)->Opcode() == Opcodes::Op_CompareAndSwapN ))) return; // Allocation loops RARELY take backedge // Find the OTHER exit path from the IF Node* ex = iff->proj_out(1-test_con); float p = iff->_prob; if( !phase->is_member( this, ex ) && iff->_fcnt == COUNT_UNKNOWN ) { - if( top == Op_IfTrue ) { + if( top == Opcodes::Op_IfTrue ) { if( p < (PROB_FAIR + PROB_UNLIKELY_MAG(3))) { iff->_prob = PROB_STATIC_FREQUENT; } @@ -2514,11 +2514,11 @@ #ifdef ASSERT static CountedLoopNode* locate_pre_from_main(CountedLoopNode *cl) { Node *ctrl = cl->in(LoopNode::EntryControl); - assert(ctrl->Opcode() == Op_IfTrue || ctrl->Opcode() == Op_IfFalse, ""); + assert(ctrl->Opcode() == Opcodes::Op_IfTrue || ctrl->Opcode() == Opcodes::Op_IfFalse, ""); Node *iffm = ctrl->in(0); - assert(iffm->Opcode() == Op_If, ""); + assert(iffm->Opcode() == Opcodes::Op_If, ""); Node *p_f = iffm->in(0); - assert(p_f->Opcode() == Op_IfFalse, ""); + assert(p_f->Opcode() == Opcodes::Op_IfFalse, ""); CountedLoopEndNode *pre_end = p_f->in(0)->as_CountedLoopEnd(); assert(pre_end->loopnode()->is_pre_loop(), ""); return pre_end->loopnode(); @@ -2530,7 +2530,7 @@ void IdealLoopTree::remove_main_post_loops(CountedLoopNode *cl, PhaseIdealLoop *phase) { CountedLoopEndNode* pre_end = cl->loopexit(); Node* pre_cmp = pre_end->cmp_node(); - if (pre_cmp->in(2)->Opcode() != Op_Opaque1) { + if (pre_cmp->in(2)->Opcode() != Opcodes::Op_Opaque1) { // Only safe to remove the main loop if the compiler optimized it // out based on an unknown number of iterations return; @@ -2558,7 +2558,7 @@ phase->_igvn.replace_input_of(pre_cmp, 2, pre_cmp->in(2)->in(2)); // Remove the Opaque1Node of the main loop so it can be optimized out Node* main_cmp = main_iff->in(1)->in(1); - assert(main_cmp->in(2)->Opcode() == Op_Opaque1, "main loop has no opaque node?"); + assert(main_cmp->in(2)->Opcode() == Opcodes::Op_Opaque1, "main loop has no opaque node?"); phase->_igvn.replace_input_of(main_cmp, 2, main_cmp->in(2)->in(1)); } @@ -2590,7 +2590,7 @@ Node* iv = NULL; for (DUIterator_Fast imax, i = cl->fast_outs(imax); i < imax; i++) { Node* n = cl->fast_out(i); - if (n->Opcode() == Op_Phi) { + if (n->Opcode() == Opcodes::Op_Phi) { assert(iv == NULL, "Too many phis" ); iv = n; } @@ -2614,8 +2614,8 @@ if (needs_guard) { // Check for an obvious zero trip guard. Node* inctrl = PhaseIdealLoop::skip_loop_predicates(cl->in(LoopNode::EntryControl)); - if (inctrl->Opcode() == Op_IfTrue || inctrl->Opcode() == Op_IfFalse) { - bool maybe_swapped = (inctrl->Opcode() == Op_IfFalse); + if (inctrl->Opcode() == Opcodes::Op_IfTrue || inctrl->Opcode() == Opcodes::Op_IfFalse) { + bool maybe_swapped = (inctrl->Opcode() == Opcodes::Op_IfFalse); // The test should look like just the backedge of a CountedLoop Node* iff = inctrl->in(0); if (iff->is_If()) { @@ -2928,8 +2928,8 @@ msg = "multiple stores"; break; } - int opc = n->Opcode(); - if (opc == Op_StoreP || opc == Op_StoreN || opc == Op_StoreNKlass || opc == Op_StoreCM) { + Opcodes opc = n->Opcode(); + if (opc == Opcodes::Op_StoreP || opc == Opcodes::Op_StoreN || opc == Opcodes::Op_StoreNKlass || opc == Opcodes::Op_StoreCM) { msg = "oop fills not handled"; break; } @@ -3003,14 +3003,14 @@ Node* n = elements[e]; if (n->is_Con() && con == NULL) { con = n; - } else if (n->Opcode() == Op_LShiftX && shift == NULL) { + } else if (n->Opcode() == Opcodes::Op_LShiftX && shift == NULL) { Node* value = n->in(1); #ifdef _LP64 - if (value->Opcode() == Op_ConvI2L) { + if (value->Opcode() == Opcodes::Op_ConvI2L) { conv = value; value = value->in(1); } - if (value->Opcode() == Op_CastII && + if (value->Opcode() == Opcodes::Op_CastII && value->as_CastII()->has_range_check()) { // Skip range check dependent CastII nodes cast = value; @@ -3027,10 +3027,10 @@ shift = n; } } - } else if (n->Opcode() == Op_ConvI2L && conv == NULL) { + } else if (n->Opcode() == Opcodes::Op_ConvI2L && conv == NULL) { conv = n; n = n->in(1); - if (n->Opcode() == Op_CastII && + if (n->Opcode() == Opcodes::Op_CastII && n->as_CastII()->has_range_check()) { // Skip range check dependent CastII nodes cast = n;