--- old/src/share/vm/opto/addnode.cpp 2016-07-11 22:46:10.285504227 +0900 +++ new/src/share/vm/opto/addnode.cpp 2016-07-11 22:46:10.147504710 +0900 @@ -47,7 +47,7 @@ // (commute) inputs to AddNodes willy-nilly so the hash function must return // the same value in the presence of edge swapping. uint AddNode::hash() const { - return (uintptr_t)in(1) + (uintptr_t)in(2) + Opcode(); + return (uintptr_t)in(1) + (uintptr_t)in(2) + static_cast(Opcode()); } //------------------------------Identity--------------------------------------- @@ -123,8 +123,8 @@ // expression tree. Node *add1 = in(1); Node *add2 = in(2); - int add1_op = add1->Opcode(); - int this_op = Opcode(); + Opcodes add1_op = add1->Opcode(); + Opcodes this_op = Opcode(); if( con_right && t2 != Type::TOP && // Right input is a constant? add1_op == this_op ) { // Left input is an Add? @@ -135,7 +135,7 @@ // unreachable loops. In these cases the computation is undefined. #ifdef ASSERT Node *add11 = add1->in(1); - int add11_op = add11->Opcode(); + Opcodes add11_op = add11->Opcode(); if( (add1 == add1->in(1)) || (add11_op == this_op && add11->in(1) == add1) ) { assert(false, "dead loop in AddNode::Ideal"); @@ -176,7 +176,7 @@ } // Convert "x+(y+1)" into "(x+y)+1". Push constants down the expression tree. - int add2_op = add2->Opcode(); + Opcodes add2_op = add2->Opcode(); if( add2_op == this_op && !con_left ) { Node *a22 = add2->in(2); const Type *t22 = phase->type( a22 ); @@ -240,23 +240,23 @@ Node *AddINode::Ideal(PhaseGVN *phase, bool can_reshape) { Node* in1 = in(1); Node* in2 = in(2); - int op1 = in1->Opcode(); - int op2 = in2->Opcode(); + Opcodes op1 = in1->Opcode(); + Opcodes op2 = in2->Opcode(); // Fold (con1-x)+con2 into (con1+con2)-x - if ( op1 == Op_AddI && op2 == Op_SubI ) { + if ( op1 == Opcodes::Op_AddI && op2 == Opcodes::Op_SubI ) { // Swap edges to try optimizations below in1 = in2; in2 = in(1); op1 = op2; op2 = in2->Opcode(); } - if( op1 == Op_SubI ) { + if( op1 == Opcodes::Op_SubI ) { const Type *t_sub1 = phase->type( in1->in(1) ); const Type *t_2 = phase->type( in2 ); if( t_sub1->singleton() && t_2->singleton() && t_sub1 != Type::TOP && t_2 != Type::TOP ) return new SubINode(phase->makecon( add_ring( t_sub1, t_2 ) ), in1->in(2) ); // Convert "(a-b)+(c-d)" into "(a+c)-(b+d)" - if( op2 == Op_SubI ) { + if( op2 == Opcodes::Op_SubI ) { // Check for dead cycle: d = (a-b)+(c-d) assert( in1->in(2) != this && in2->in(2) != this, "dead loop in AddINode::Ideal" ); @@ -266,33 +266,33 @@ return sub; } // Convert "(a-b)+(b+c)" into "(a+c)" - if( op2 == Op_AddI && in1->in(2) == in2->in(1) ) { + if( op2 == Opcodes::Op_AddI && in1->in(2) == in2->in(1) ) { assert(in1->in(1) != this && in2->in(2) != this,"dead loop in AddINode::Ideal"); return new AddINode(in1->in(1), in2->in(2)); } // Convert "(a-b)+(c+b)" into "(a+c)" - if( op2 == Op_AddI && in1->in(2) == in2->in(2) ) { + if( op2 == Opcodes::Op_AddI && in1->in(2) == in2->in(2) ) { assert(in1->in(1) != this && in2->in(1) != this,"dead loop in AddINode::Ideal"); return new AddINode(in1->in(1), in2->in(1)); } // Convert "(a-b)+(b-c)" into "(a-c)" - if( op2 == Op_SubI && in1->in(2) == in2->in(1) ) { + if( op2 == Opcodes::Op_SubI && in1->in(2) == in2->in(1) ) { assert(in1->in(1) != this && in2->in(2) != this,"dead loop in AddINode::Ideal"); return new SubINode(in1->in(1), in2->in(2)); } // Convert "(a-b)+(c-a)" into "(c-b)" - if( op2 == Op_SubI && in1->in(1) == in2->in(2) ) { + if( op2 == Opcodes::Op_SubI && in1->in(1) == in2->in(2) ) { assert(in1->in(2) != this && in2->in(1) != this,"dead loop in AddINode::Ideal"); return new SubINode(in2->in(1), in1->in(2)); } } // Convert "x+(0-y)" into "(x-y)" - if( op2 == Op_SubI && phase->type(in2->in(1)) == TypeInt::ZERO ) + if( op2 == Opcodes::Op_SubI && phase->type(in2->in(1)) == TypeInt::ZERO ) return new SubINode(in1, in2->in(2) ); // Convert "(0-y)+x" into "(x-y)" - if( op1 == Op_SubI && phase->type(in1->in(1)) == TypeInt::ZERO ) + if( op1 == Opcodes::Op_SubI && phase->type(in1->in(1)) == TypeInt::ZERO ) return new SubINode( in2, in1->in(2) ); // Convert (x>>>z)+y into (x+(y<>>z for small constant z and y. @@ -306,8 +306,8 @@ // Implement support for negative y and (x >= -(y << z)) // Have not observed cases where type information exists to support // positive y and (x <= -(y << z)) - if( op1 == Op_URShiftI && op2 == Op_ConI && - in1->in(2)->Opcode() == Op_ConI ) { + if( op1 == Opcodes::Op_URShiftI && op2 == Opcodes::Op_ConI && + in1->in(2)->Opcode() == Opcodes::Op_ConI ) { jint z = phase->type( in1->in(2) )->is_int()->get_con() & 0x1f; // only least significant 5 bits matter jint y = phase->type( in2 )->is_int()->get_con(); @@ -327,10 +327,10 @@ //------------------------------Identity--------------------------------------- // Fold (x-y)+y OR y+(x-y) into x Node* AddINode::Identity(PhaseGVN* phase) { - if( in(1)->Opcode() == Op_SubI && phase->eqv(in(1)->in(2),in(2)) ) { + if( in(1)->Opcode() == Opcodes::Op_SubI && phase->eqv(in(1)->in(2),in(2)) ) { return in(1)->in(1); } - else if( in(2)->Opcode() == Op_SubI && phase->eqv(in(2)->in(2),in(1)) ) { + else if( in(2)->Opcode() == Opcodes::Op_SubI && phase->eqv(in(2)->in(2),in(1)) ) { return in(2)->in(1); } return AddNode::Identity(phase); @@ -371,10 +371,10 @@ Node *AddLNode::Ideal(PhaseGVN *phase, bool can_reshape) { Node* in1 = in(1); Node* in2 = in(2); - int op1 = in1->Opcode(); - int op2 = in2->Opcode(); + Opcodes op1 = in1->Opcode(); + Opcodes op2 = in2->Opcode(); // Fold (con1-x)+con2 into (con1+con2)-x - if ( op1 == Op_AddL && op2 == Op_SubL ) { + if ( op1 == Opcodes::Op_AddL && op2 == Opcodes::Op_SubL ) { // Swap edges to try optimizations below in1 = in2; in2 = in(1); @@ -382,13 +382,13 @@ op2 = in2->Opcode(); } // Fold (con1-x)+con2 into (con1+con2)-x - if( op1 == Op_SubL ) { + if( op1 == Opcodes::Op_SubL ) { const Type *t_sub1 = phase->type( in1->in(1) ); const Type *t_2 = phase->type( in2 ); if( t_sub1->singleton() && t_2->singleton() && t_sub1 != Type::TOP && t_2 != Type::TOP ) return new SubLNode(phase->makecon( add_ring( t_sub1, t_2 ) ), in1->in(2) ); // Convert "(a-b)+(c-d)" into "(a+c)-(b+d)" - if( op2 == Op_SubL ) { + if( op2 == Opcodes::Op_SubL ) { // Check for dead cycle: d = (a-b)+(c-d) assert( in1->in(2) != this && in2->in(2) != this, "dead loop in AddLNode::Ideal" ); @@ -398,40 +398,40 @@ return sub; } // Convert "(a-b)+(b+c)" into "(a+c)" - if( op2 == Op_AddL && in1->in(2) == in2->in(1) ) { + if( op2 == Opcodes::Op_AddL && in1->in(2) == in2->in(1) ) { assert(in1->in(1) != this && in2->in(2) != this,"dead loop in AddLNode::Ideal"); return new AddLNode(in1->in(1), in2->in(2)); } // Convert "(a-b)+(c+b)" into "(a+c)" - if( op2 == Op_AddL && in1->in(2) == in2->in(2) ) { + if( op2 == Opcodes::Op_AddL && in1->in(2) == in2->in(2) ) { assert(in1->in(1) != this && in2->in(1) != this,"dead loop in AddLNode::Ideal"); return new AddLNode(in1->in(1), in2->in(1)); } // Convert "(a-b)+(b-c)" into "(a-c)" - if( op2 == Op_SubL && in1->in(2) == in2->in(1) ) { + if( op2 == Opcodes::Op_SubL && in1->in(2) == in2->in(1) ) { assert(in1->in(1) != this && in2->in(2) != this,"dead loop in AddLNode::Ideal"); return new SubLNode(in1->in(1), in2->in(2)); } // Convert "(a-b)+(c-a)" into "(c-b)" - if( op2 == Op_SubL && in1->in(1) == in1->in(2) ) { + if( op2 == Opcodes::Op_SubL && in1->in(1) == in1->in(2) ) { assert(in1->in(2) != this && in2->in(1) != this,"dead loop in AddLNode::Ideal"); return new SubLNode(in2->in(1), in1->in(2)); } } // Convert "x+(0-y)" into "(x-y)" - if( op2 == Op_SubL && phase->type(in2->in(1)) == TypeLong::ZERO ) + if( op2 == Opcodes::Op_SubL && phase->type(in2->in(1)) == TypeLong::ZERO ) return new SubLNode( in1, in2->in(2) ); // Convert "(0-y)+x" into "(x-y)" - if( op1 == Op_SubL && phase->type(in1->in(1)) == TypeInt::ZERO ) + if( op1 == Opcodes::Op_SubL && phase->type(in1->in(1)) == TypeInt::ZERO ) return new SubLNode( in2, in1->in(2) ); // Convert "X+X+X+X+X...+X+Y" into "k*X+Y" or really convert "X+(X+Y)" // into "(X<<1)+Y" and let shift-folding happen. - if( op2 == Op_AddL && + if( op2 == Opcodes::Op_AddL && in2->in(1) == in1 && - op1 != Op_ConL && + op1 != Opcodes::Op_ConL && 0 ) { Node *shift = phase->transform(new LShiftLNode(in1,phase->intcon(1))); return new AddLNode(shift,in2->in(2)); @@ -444,10 +444,10 @@ //------------------------------Identity--------------------------------------- // Fold (x-y)+y OR y+(x-y) into x Node* AddLNode::Identity(PhaseGVN* phase) { - if( in(1)->Opcode() == Op_SubL && phase->eqv(in(1)->in(2),in(2)) ) { + if( in(1)->Opcode() == Opcodes::Op_SubL && phase->eqv(in(1)->in(2),in(2)) ) { return in(1)->in(1); } - else if( in(2)->Opcode() == Op_SubL && phase->eqv(in(2)->in(2),in(1)) ) { + else if( in(2)->Opcode() == Opcodes::Op_SubL && phase->eqv(in(2)->in(2),in(1)) ) { return in(2)->in(1); } return AddNode::Identity(phase); @@ -623,7 +623,7 @@ // The idea is to merge array_base+scaled_index groups together, // and only have different constant offsets from the same base. const Node *add = in(Offset); - if( add->Opcode() == Op_AddX && add->in(1) != add ) { + if( add->Opcode() == Opcodes::Op_AddX && add->in(1) != add ) { const Type *t22 = phase->type( add->in(2) ); if( t22->singleton() && (t22 != Type::TOP) ) { // Right input is an add of a constant? set_req(Address, phase->transform(new AddPNode(in(Base),in(Address),add->in(1)))); @@ -646,7 +646,7 @@ if (in(Address) == NULL) return TypePtr::BOTTOM; const TypePtr *tp = in(Address)->bottom_type()->isa_ptr(); if( !tp ) return Type::TOP; // TOP input means TOP output - assert( in(Offset)->Opcode() != Op_ConP, "" ); + assert( in(Offset)->Opcode() != Opcodes::Op_ConP, "" ); const Type *t = in(Offset)->bottom_type(); if( t == Type::TOP ) return tp->add_offset(Type::OffsetTop); @@ -854,7 +854,7 @@ Node *r = in(2); // Transform MinI1( MinI2(a,b), c) into MinI1( a, MinI2(b,c) ) // to force a right-spline graph for the rest of MinINode::Ideal(). - if( l->Opcode() == Op_MinI ) { + if( l->Opcode() == Opcodes::Op_MinI ) { assert( l != l->in(1), "dead loop in MinINode::Ideal" ); r = phase->transform(new MinINode(l->in(2),r)); l = l->in(1); @@ -866,7 +866,7 @@ // Get left input & constant Node *x = l; int x_off = 0; - if( x->Opcode() == Op_AddI && // Check for "x+c0" and collect constant + if( x->Opcode() == Opcodes::Op_AddI && // Check for "x+c0" and collect constant x->in(2)->is_Con() ) { const Type *t = x->in(2)->bottom_type(); if( t == Type::TOP ) return NULL; // No progress @@ -878,24 +878,24 @@ Node *y = r; int y_off = 0; // Check final part of MIN tree - if( y->Opcode() == Op_AddI && // Check for "y+c1" and collect constant + if( y->Opcode() == Opcodes::Op_AddI && // Check for "y+c1" and collect constant y->in(2)->is_Con() ) { const Type *t = y->in(2)->bottom_type(); if( t == Type::TOP ) return NULL; // No progress y_off = t->is_int()->get_con(); y = y->in(1); } - if( x->_idx > y->_idx && r->Opcode() != Op_MinI ) { + if( x->_idx > y->_idx && r->Opcode() != Opcodes::Op_MinI ) { swap_edges(1, 2); return this; } - if( r->Opcode() == Op_MinI ) { + if( r->Opcode() == Opcodes::Op_MinI ) { assert( r != r->in(2), "dead loop in MinINode::Ideal" ); y = r->in(1); // Check final part of MIN tree - if( y->Opcode() == Op_AddI &&// Check for "y+c1" and collect constant + if( y->Opcode() == Opcodes::Op_AddI &&// Check for "y+c1" and collect constant y->in(2)->is_Con() ) { const Type *t = y->in(2)->bottom_type(); if( t == Type::TOP ) return NULL; // No progress