Mercurial > hg > graal-compiler
diff src/share/vm/opto/loopTransform.cpp @ 8701:b95ad0610fef
Merge
author | asaha |
---|---|
date | Fri, 26 Oct 2012 09:27:25 -0700 |
parents | 521c82b9cbf8 d804e148cff8 |
children | b5cb079ecaa4 |
line wrap: on
line diff
--- a/src/share/vm/opto/loopTransform.cpp Wed Sep 26 09:54:11 2012 -0700 +++ b/src/share/vm/opto/loopTransform.cpp Fri Oct 26 09:27:25 2012 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -92,10 +92,10 @@ limit_n != NULL && limit_n->is_Con()) { // Use longs to avoid integer overflow. int stride_con = cl->stride_con(); - long init_con = cl->init_trip()->get_int(); - long limit_con = cl->limit()->get_int(); + jlong init_con = cl->init_trip()->get_int(); + jlong limit_con = cl->limit()->get_int(); int stride_m = stride_con - (stride_con > 0 ? 1 : -1); - long trip_count = (limit_con - init_con + stride_m)/stride_con; + jlong trip_count = (limit_con - init_con + stride_m)/stride_con; if (trip_count > 0 && (julong)trip_count < (julong)max_juint) { // Set exact trip count. cl->set_exact_trip_count((uint)trip_count); @@ -224,24 +224,24 @@ if (neg_inv1) { Node *zero = phase->_igvn.intcon(0); phase->set_ctrl(zero, phase->C->root()); - n_inv1 = new (phase->C, 3) SubINode(zero, inv1); + n_inv1 = new (phase->C) SubINode(zero, inv1); phase->register_new_node(n_inv1, inv1_c); } else { n_inv1 = inv1; } Node* inv; if (neg_inv2) { - inv = new (phase->C, 3) SubINode(n_inv1, inv2); + inv = new (phase->C) SubINode(n_inv1, inv2); } else { - inv = new (phase->C, 3) AddINode(n_inv1, inv2); + inv = new (phase->C) AddINode(n_inv1, inv2); } phase->register_new_node(inv, phase->get_early_ctrl(inv)); Node* addx; if (neg_x) { - addx = new (phase->C, 3) SubINode(inv, x); + addx = new (phase->C) SubINode(inv, x); } else { - addx = new (phase->C, 3) AddINode(x, inv); + addx = new (phase->C) AddINode(x, inv); } phase->register_new_node(addx, phase->get_ctrl(x)); phase->_igvn.replace_node(n1, addx); @@ -932,7 +932,7 @@ post_end->_prob = PROB_FAIR; // Build the main-loop normal exit. - IfFalseNode *new_main_exit = new (C, 1) IfFalseNode(main_end); + IfFalseNode *new_main_exit = new (C) IfFalseNode(main_end); _igvn.register_new_node_with_optimizer( new_main_exit ); set_idom(new_main_exit, main_end, dd_main_exit ); set_loop(new_main_exit, loop->_parent); @@ -942,15 +942,15 @@ // (the main-loop trip-counter exit value) because we will be changing // the exit value (via unrolling) so we cannot constant-fold away the zero // trip guard until all unrolling is done. - Node *zer_opaq = new (C, 2) Opaque1Node(C, incr); - Node *zer_cmp = new (C, 3) CmpINode( zer_opaq, limit ); - Node *zer_bol = new (C, 2) BoolNode( zer_cmp, b_test ); + Node *zer_opaq = new (C) Opaque1Node(C, incr); + Node *zer_cmp = new (C) CmpINode( zer_opaq, limit ); + Node *zer_bol = new (C) BoolNode( zer_cmp, b_test ); register_new_node( zer_opaq, new_main_exit ); register_new_node( zer_cmp , new_main_exit ); register_new_node( zer_bol , new_main_exit ); // Build the IfNode - IfNode *zer_iff = new (C, 2) IfNode( new_main_exit, zer_bol, PROB_FAIR, COUNT_UNKNOWN ); + IfNode *zer_iff = new (C) IfNode( new_main_exit, zer_bol, PROB_FAIR, COUNT_UNKNOWN ); _igvn.register_new_node_with_optimizer( zer_iff ); set_idom(zer_iff, new_main_exit, dd_main_exit); set_loop(zer_iff, loop->_parent); @@ -960,7 +960,7 @@ set_idom(main_exit, zer_iff, dd_main_exit); set_idom(main_exit->unique_out(), zer_iff, dd_main_exit); // Make the true-path, must enter the post loop - Node *zer_taken = new (C, 1) IfTrueNode( zer_iff ); + Node *zer_taken = new (C) IfTrueNode( zer_iff ); _igvn.register_new_node_with_optimizer( zer_taken ); set_idom(zer_taken, zer_iff, dd_main_exit); set_loop(zer_taken, loop->_parent); @@ -1008,7 +1008,7 @@ // Find the pre-loop normal exit. Node* pre_exit = pre_end->proj_out(false); assert( pre_exit->Opcode() == Op_IfFalse, "" ); - IfFalseNode *new_pre_exit = new (C, 1) IfFalseNode(pre_end); + IfFalseNode *new_pre_exit = new (C) IfFalseNode(pre_end); _igvn.register_new_node_with_optimizer( new_pre_exit ); set_idom(new_pre_exit, pre_end, dd_main_head); set_loop(new_pre_exit, loop->_parent); @@ -1017,15 +1017,15 @@ // pre-loop, the main-loop may not execute at all. Later in life this // zero-trip guard will become the minimum-trip guard when we unroll // the main-loop. - Node *min_opaq = new (C, 2) Opaque1Node(C, limit); - Node *min_cmp = new (C, 3) CmpINode( pre_incr, min_opaq ); - Node *min_bol = new (C, 2) BoolNode( min_cmp, b_test ); + Node *min_opaq = new (C) Opaque1Node(C, limit); + Node *min_cmp = new (C) CmpINode( pre_incr, min_opaq ); + Node *min_bol = new (C) BoolNode( min_cmp, b_test ); register_new_node( min_opaq, new_pre_exit ); register_new_node( min_cmp , new_pre_exit ); register_new_node( min_bol , new_pre_exit ); // Build the IfNode (assume the main-loop is executed always). - IfNode *min_iff = new (C, 2) IfNode( new_pre_exit, min_bol, PROB_ALWAYS, COUNT_UNKNOWN ); + IfNode *min_iff = new (C) IfNode( new_pre_exit, min_bol, PROB_ALWAYS, COUNT_UNKNOWN ); _igvn.register_new_node_with_optimizer( min_iff ); set_idom(min_iff, new_pre_exit, dd_main_head); set_loop(min_iff, loop->_parent); @@ -1036,7 +1036,7 @@ set_idom(pre_exit, min_iff, dd_main_head); set_idom(pre_exit->unique_out(), min_iff, dd_main_head); // Make the true-path, must enter the main loop - Node *min_taken = new (C, 1) IfTrueNode( min_iff ); + Node *min_taken = new (C) IfTrueNode( min_iff ); _igvn.register_new_node_with_optimizer( min_taken ); set_idom(min_taken, min_iff, dd_main_head); set_loop(min_taken, loop->_parent); @@ -1066,11 +1066,11 @@ // RCE and alignment may change this later. Node *cmp_end = pre_end->cmp_node(); assert( cmp_end->in(2) == limit, "" ); - Node *pre_limit = new (C, 3) AddINode( init, stride ); + Node *pre_limit = new (C) AddINode( init, stride ); // Save the original loop limit in this Opaque1 node for // use by range check elimination. - Node *pre_opaq = new (C, 3) Opaque1Node(C, pre_limit, limit); + Node *pre_opaq = new (C) Opaque1Node(C, pre_limit, limit); register_new_node( pre_limit, pre_head->in(0) ); register_new_node( pre_opaq , pre_head->in(0) ); @@ -1095,19 +1095,19 @@ BoolTest::mask new_test = (main_end->stride_con() > 0) ? BoolTest::lt : BoolTest::gt; // Modify pre loop end condition Node* pre_bol = pre_end->in(CountedLoopEndNode::TestValue)->as_Bool(); - BoolNode* new_bol0 = new (C, 2) BoolNode(pre_bol->in(1), new_test); + BoolNode* new_bol0 = new (C) BoolNode(pre_bol->in(1), new_test); register_new_node( new_bol0, pre_head->in(0) ); _igvn.hash_delete(pre_end); pre_end->set_req(CountedLoopEndNode::TestValue, new_bol0); // Modify main loop guard condition assert(min_iff->in(CountedLoopEndNode::TestValue) == min_bol, "guard okay"); - BoolNode* new_bol1 = new (C, 2) BoolNode(min_bol->in(1), new_test); + BoolNode* new_bol1 = new (C) BoolNode(min_bol->in(1), new_test); register_new_node( new_bol1, new_pre_exit ); _igvn.hash_delete(min_iff); min_iff->set_req(CountedLoopEndNode::TestValue, new_bol1); // Modify main loop end condition BoolNode* main_bol = main_end->in(CountedLoopEndNode::TestValue)->as_Bool(); - BoolNode* new_bol2 = new (C, 2) BoolNode(main_bol->in(1), new_test); + BoolNode* new_bol2 = new (C) BoolNode(main_bol->in(1), new_test); register_new_node( new_bol2, main_end->in(CountedLoopEndNode::TestControl) ); _igvn.hash_delete(main_end); main_end->set_req(CountedLoopEndNode::TestValue, new_bol2); @@ -1212,16 +1212,16 @@ } else if (loop_head->has_exact_trip_count() && init->is_Con()) { // Loop's limit is constant. Loop's init could be constant when pre-loop // become peeled iteration. - long init_con = init->get_int(); + jlong init_con = init->get_int(); // We can keep old loop limit if iterations count stays the same: // old_trip_count == new_trip_count * 2 // Note: since old_trip_count >= 2 then new_trip_count >= 1 // so we also don't need to adjust zero trip test. - long limit_con = limit->get_int(); + jlong limit_con = limit->get_int(); // (stride_con*2) not overflow since stride_con <= 8. int new_stride_con = stride_con * 2; int stride_m = new_stride_con - (stride_con > 0 ? 1 : -1); - long trip_count = (limit_con - init_con + stride_m)/new_stride_con; + jlong trip_count = (limit_con - init_con + stride_m)/new_stride_con; // New trip count should satisfy next conditions. assert(trip_count > 0 && (julong)trip_count < (julong)max_juint/2, "sanity"); uint new_trip_count = (uint)trip_count; @@ -1257,13 +1257,13 @@ // zero trip guard limit will be different from loop limit. assert(has_ctrl(opaq), "should have it"); Node* opaq_ctrl = get_ctrl(opaq); - limit = new (C, 2) Opaque2Node( C, limit ); + limit = new (C) Opaque2Node( C, limit ); register_new_node( limit, opaq_ctrl ); } if (stride_con > 0 && ((limit_type->_lo - stride_con) < limit_type->_lo) || stride_con < 0 && ((limit_type->_hi - stride_con) > limit_type->_hi)) { // No underflow. - new_limit = new (C, 3) SubINode(limit, stride); + new_limit = new (C) SubINode(limit, stride); } else { // (limit - stride) may underflow. // Clamp the adjustment value with MININT or MAXINT: @@ -1293,18 +1293,18 @@ old_limit = bol->in(1)->in(1); // Adjust previous adjusted limit. adj_limit = limit->in(CMoveNode::IfFalse); - adj_limit = new (C, 3) SubINode(adj_limit, stride); + adj_limit = new (C) SubINode(adj_limit, stride); } else { old_limit = limit; - adj_limit = new (C, 3) SubINode(limit, stride); + adj_limit = new (C) SubINode(limit, stride); } assert(old_limit != NULL && adj_limit != NULL, ""); register_new_node( adj_limit, ctrl ); // adjust amount - Node* adj_cmp = new (C, 3) CmpINode(old_limit, adj_limit); + Node* adj_cmp = new (C) CmpINode(old_limit, adj_limit); register_new_node( adj_cmp, ctrl ); - Node* adj_bool = new (C, 2) BoolNode(adj_cmp, bt); + Node* adj_bool = new (C) BoolNode(adj_cmp, bt); register_new_node( adj_bool, ctrl ); - new_limit = new (C, 4) CMoveINode(adj_bool, adj_limit, adj_max, TypeInt::INT); + new_limit = new (C) CMoveINode(adj_bool, adj_limit, adj_max, TypeInt::INT); } register_new_node(new_limit, ctrl); } @@ -1366,24 +1366,24 @@ // CountedLoop this is exact (stride divides limit-init exactly). // We are going to double the loop body, so we want to knock off any // odd iteration: (trip_cnt & ~1). Then back compute a new limit. - Node *span = new (C, 3) SubINode( limit, init ); + Node *span = new (C) SubINode( limit, init ); register_new_node( span, ctrl ); - Node *trip = new (C, 3) DivINode( 0, span, stride ); + Node *trip = new (C) DivINode( 0, span, stride ); register_new_node( trip, ctrl ); Node *mtwo = _igvn.intcon(-2); set_ctrl(mtwo, C->root()); - Node *rond = new (C, 3) AndINode( trip, mtwo ); + Node *rond = new (C) AndINode( trip, mtwo ); register_new_node( rond, ctrl ); - Node *spn2 = new (C, 3) MulINode( rond, stride ); + Node *spn2 = new (C) MulINode( rond, stride ); register_new_node( spn2, ctrl ); - new_limit = new (C, 3) AddINode( spn2, init ); + new_limit = new (C) AddINode( spn2, init ); register_new_node( new_limit, ctrl ); // Hammer in the new limit Node *ctrl2 = loop_end->in(0); - Node *cmp2 = new (C, 3) CmpINode( loop_head->incr(), new_limit ); + Node *cmp2 = new (C) CmpINode( loop_head->incr(), new_limit ); register_new_node( cmp2, ctrl2 ); - Node *bol2 = new (C, 2) BoolNode( cmp2, loop_end->test_trip() ); + Node *bol2 = new (C) BoolNode( cmp2, loop_end->test_trip() ); register_new_node( bol2, ctrl2 ); _igvn.hash_delete(loop_end); loop_end->set_req(CountedLoopEndNode::TestValue, bol2); @@ -1489,15 +1489,15 @@ // Helper function for add_constraint(). Node* PhaseIdealLoop::adjust_limit(int stride_con, Node * scale, Node *offset, Node *rc_limit, Node *loop_limit, Node *pre_ctrl) { // Compute "I :: (limit-offset)/scale" - Node *con = new (C, 3) SubINode(rc_limit, offset); + Node *con = new (C) SubINode(rc_limit, offset); register_new_node(con, pre_ctrl); - Node *X = new (C, 3) DivINode(0, con, scale); + Node *X = new (C) DivINode(0, con, scale); register_new_node(X, pre_ctrl); // Adjust loop limit loop_limit = (stride_con > 0) - ? (Node*)(new (C, 3) MinINode(loop_limit, X)) - : (Node*)(new (C, 3) MaxINode(loop_limit, X)); + ? (Node*)(new (C) MinINode(loop_limit, X)) + : (Node*)(new (C) MaxINode(loop_limit, X)); register_new_node(loop_limit, pre_ctrl); return loop_limit; } @@ -1558,9 +1558,9 @@ // to avoid problem with scale == -1 (min_int/(-1) == min_int). Node* shift = _igvn.intcon(31); set_ctrl(shift, C->root()); - Node* sign = new (C, 3) RShiftINode(offset, shift); + Node* sign = new (C) RShiftINode(offset, shift); register_new_node(sign, pre_ctrl); - offset = new (C, 3) AndINode(offset, sign); + offset = new (C) AndINode(offset, sign); register_new_node(offset, pre_ctrl); } else { assert(low_limit->get_int() == 0, "wrong low limit for range check"); @@ -1593,7 +1593,7 @@ Node *one = _igvn.intcon(1); set_ctrl(one, C->root()); - Node *plus_one = new (C, 3) AddINode(offset, one); + Node *plus_one = new (C) AddINode(offset, one); register_new_node( plus_one, pre_ctrl ); // Pass (-stride) to indicate pre_loop_cond = NOT(main_loop_cond); *pre_limit = adjust_limit((-stride_con), scale, plus_one, upper_limit, *pre_limit, pre_ctrl); @@ -1611,9 +1611,9 @@ // to avoid problem with scale == -1 (min_int/(-1) == min_int). Node* shift = _igvn.intcon(31); set_ctrl(shift, C->root()); - Node* sign = new (C, 3) RShiftINode(plus_one, shift); + Node* sign = new (C) RShiftINode(plus_one, shift); register_new_node(sign, pre_ctrl); - plus_one = new (C, 3) AndINode(plus_one, sign); + plus_one = new (C) AndINode(plus_one, sign); register_new_node(plus_one, pre_ctrl); } else { assert(low_limit->get_int() == 0, "wrong low limit for range check"); @@ -1696,7 +1696,7 @@ p_offset != NULL ? &offset2 : NULL, depth+1)) { if (p_offset != NULL) { Node *ctrl_off2 = get_ctrl(offset2); - Node* offset = new (C, 3) AddINode(offset2, exp->in(2)); + Node* offset = new (C) AddINode(offset2, exp->in(2)); register_new_node(offset, ctrl_off2); *p_offset = offset; } @@ -1709,7 +1709,7 @@ Node *zero = _igvn.intcon(0); set_ctrl(zero, C->root()); Node *ctrl_off = get_ctrl(exp->in(2)); - Node* offset = new (C, 3) SubINode(zero, exp->in(2)); + Node* offset = new (C) SubINode(zero, exp->in(2)); register_new_node(offset, ctrl_off); *p_offset = offset; } @@ -1912,15 +1912,15 @@ case BoolTest::ge: // Convert (I*scale+offset) >= Limit to (I*(-scale)+(-offset)) <= -Limit scale_con = -scale_con; - offset = new (C, 3) SubINode( zero, offset ); + offset = new (C) SubINode( zero, offset ); register_new_node( offset, pre_ctrl ); - limit = new (C, 3) SubINode( zero, limit ); + limit = new (C) SubINode( zero, limit ); register_new_node( limit, pre_ctrl ); // Fall into LE case case BoolTest::le: if (b_test._test != BoolTest::gt) { // Convert X <= Y to X < Y+1 - limit = new (C, 3) AddINode( limit, one ); + limit = new (C) AddINode( limit, one ); register_new_node( limit, pre_ctrl ); } // Fall into LT case @@ -1971,8 +1971,8 @@ // Update loop limits if (conditional_rc) { - pre_limit = (stride_con > 0) ? (Node*)new (C,3) MinINode(pre_limit, orig_limit) - : (Node*)new (C,3) MaxINode(pre_limit, orig_limit); + pre_limit = (stride_con > 0) ? (Node*)new (C) MinINode(pre_limit, orig_limit) + : (Node*)new (C) MaxINode(pre_limit, orig_limit); register_new_node(pre_limit, pre_ctrl); } _igvn.hash_delete(pre_opaq); @@ -1987,16 +1987,16 @@ Node *ctrl = get_ctrl(main_limit); Node *stride = cl->stride(); Node *init = cl->init_trip(); - Node *span = new (C, 3) SubINode(main_limit,init); + Node *span = new (C) SubINode(main_limit,init); register_new_node(span,ctrl); Node *rndup = _igvn.intcon(stride_con + ((stride_con>0)?-1:1)); - Node *add = new (C, 3) AddINode(span,rndup); + Node *add = new (C) AddINode(span,rndup); register_new_node(add,ctrl); - Node *div = new (C, 3) DivINode(0,add,stride); + Node *div = new (C) DivINode(0,add,stride); register_new_node(div,ctrl); - Node *mul = new (C, 3) MulINode(div,stride); + Node *mul = new (C) MulINode(div,stride); register_new_node(mul,ctrl); - Node *newlim = new (C, 3) AddINode(mul,init); + Node *newlim = new (C) AddINode(mul,init); register_new_node(newlim,ctrl); main_limit = newlim; } @@ -2167,7 +2167,7 @@ } // Note: the final value after increment should not overflow since // counted loop has limit check predicate. - Node *final = new (phase->C, 3) SubINode( exact_limit, cl->stride() ); + Node *final = new (phase->C) SubINode( exact_limit, cl->stride() ); phase->register_new_node(final,cl->in(LoopNode::EntryControl)); phase->_igvn.replace_node(phi,final); phase->C->set_major_progress(); @@ -2413,7 +2413,7 @@ break; } int opc = n->Opcode(); - if (opc == Op_StoreP || opc == Op_StoreN || opc == Op_StoreCM) { + if (opc == Op_StoreP || opc == Op_StoreN || opc == Op_StoreNKlass || opc == Op_StoreCM) { msg = "oop fills not handled"; break; } @@ -2651,20 +2651,20 @@ // Build an expression for the beginning of the copy region Node* index = head->init_trip(); #ifdef _LP64 - index = new (C, 2) ConvI2LNode(index); + index = new (C) ConvI2LNode(index); _igvn.register_new_node_with_optimizer(index); #endif if (shift != NULL) { // byte arrays don't require a shift but others do. - index = new (C, 3) LShiftXNode(index, shift->in(2)); + index = new (C) LShiftXNode(index, shift->in(2)); _igvn.register_new_node_with_optimizer(index); } - index = new (C, 4) AddPNode(base, base, index); + index = new (C) AddPNode(base, base, index); _igvn.register_new_node_with_optimizer(index); - Node* from = new (C, 4) AddPNode(base, index, offset); + Node* from = new (C) AddPNode(base, index, offset); _igvn.register_new_node_with_optimizer(from); // Compute the number of elements to copy - Node* len = new (C, 3) SubINode(head->limit(), head->init_trip()); + Node* len = new (C) SubINode(head->limit(), head->init_trip()); _igvn.register_new_node_with_optimizer(len); BasicType t = store->as_Mem()->memory_type(); @@ -2681,10 +2681,10 @@ // Convert float/double to int/long for fill routines if (t == T_FLOAT) { - store_value = new (C, 2) MoveF2INode(store_value); + store_value = new (C) MoveF2INode(store_value); _igvn.register_new_node_with_optimizer(store_value); } else if (t == T_DOUBLE) { - store_value = new (C, 2) MoveD2LNode(store_value); + store_value = new (C) MoveD2LNode(store_value); _igvn.register_new_node_with_optimizer(store_value); } @@ -2692,13 +2692,12 @@ Node* result_ctrl; Node* result_mem; const TypeFunc* call_type = OptoRuntime::array_fill_Type(); - int size = call_type->domain()->cnt(); - CallLeafNode *call = new (C, size) CallLeafNoFPNode(call_type, fill, - fill_name, TypeAryPtr::get_array_body_type(t)); + CallLeafNode *call = new (C) CallLeafNoFPNode(call_type, fill, + fill_name, TypeAryPtr::get_array_body_type(t)); call->init_req(TypeFunc::Parms+0, from); call->init_req(TypeFunc::Parms+1, store_value); #ifdef _LP64 - len = new (C, 2) ConvI2LNode(len); + len = new (C) ConvI2LNode(len); _igvn.register_new_node_with_optimizer(len); #endif call->init_req(TypeFunc::Parms+2, len); @@ -2711,9 +2710,9 @@ call->init_req( TypeFunc::ReturnAdr, C->start()->proj_out(TypeFunc::ReturnAdr) ); call->init_req( TypeFunc::FramePtr, C->start()->proj_out(TypeFunc::FramePtr) ); _igvn.register_new_node_with_optimizer(call); - result_ctrl = new (C, 1) ProjNode(call,TypeFunc::Control); + result_ctrl = new (C) ProjNode(call,TypeFunc::Control); _igvn.register_new_node_with_optimizer(result_ctrl); - result_mem = new (C, 1) ProjNode(call,TypeFunc::Memory); + result_mem = new (C) ProjNode(call,TypeFunc::Memory); _igvn.register_new_node_with_optimizer(result_mem); /* Disable following optimization until proper fix (add missing checks).