Mercurial > hg > truffle
comparison src/share/vm/opto/loopPredicate.cpp @ 6804:e626685e9f6c
7193318: C2: remove number of inputs requirement from Node's new operator
Summary: Deleted placement new operator of Node - node(size_t, Compile *, int).
Reviewed-by: kvn, twisti
Contributed-by: bharadwaj.yadavalli@oracle.com
author | kvn |
---|---|
date | Thu, 27 Sep 2012 09:38:42 -0700 |
parents | 5e990493719e |
children | b9a9ed0f8eeb |
comparison
equal
deleted
inserted
replaced
6803:06f52c4d0e18 | 6804:e626685e9f6c |
---|---|
157 uint proj_index = 1; // region's edge corresponding to uncommon_proj | 157 uint proj_index = 1; // region's edge corresponding to uncommon_proj |
158 if (!rgn->is_Region()) { // create a region to guard the call | 158 if (!rgn->is_Region()) { // create a region to guard the call |
159 assert(rgn->is_Call(), "must be call uct"); | 159 assert(rgn->is_Call(), "must be call uct"); |
160 CallNode* call = rgn->as_Call(); | 160 CallNode* call = rgn->as_Call(); |
161 IdealLoopTree* loop = get_loop(call); | 161 IdealLoopTree* loop = get_loop(call); |
162 rgn = new (C, 1) RegionNode(1); | 162 rgn = new (C) RegionNode(1); |
163 rgn->add_req(uncommon_proj); | 163 rgn->add_req(uncommon_proj); |
164 register_control(rgn, loop, uncommon_proj); | 164 register_control(rgn, loop, uncommon_proj); |
165 _igvn.hash_delete(call); | 165 _igvn.hash_delete(call); |
166 call->set_req(0, rgn); | 166 call->set_req(0, rgn); |
167 // When called from beautify_loops() idom is not constructed yet. | 167 // When called from beautify_loops() idom is not constructed yet. |
183 // Create new_iff | 183 // Create new_iff |
184 IdealLoopTree* lp = get_loop(entry); | 184 IdealLoopTree* lp = get_loop(entry); |
185 IfNode *new_iff = iff->clone()->as_If(); | 185 IfNode *new_iff = iff->clone()->as_If(); |
186 new_iff->set_req(0, entry); | 186 new_iff->set_req(0, entry); |
187 register_control(new_iff, lp, entry); | 187 register_control(new_iff, lp, entry); |
188 Node *if_cont = new (C, 1) IfTrueNode(new_iff); | 188 Node *if_cont = new (C) IfTrueNode(new_iff); |
189 Node *if_uct = new (C, 1) IfFalseNode(new_iff); | 189 Node *if_uct = new (C) IfFalseNode(new_iff); |
190 if (cont_proj->is_IfFalse()) { | 190 if (cont_proj->is_IfFalse()) { |
191 // Swap | 191 // Swap |
192 Node* tmp = if_uct; if_uct = if_cont; if_cont = tmp; | 192 Node* tmp = if_uct; if_uct = if_cont; if_cont = tmp; |
193 } | 193 } |
194 register_control(if_cont, lp, new_iff); | 194 register_control(if_cont, lp, new_iff); |
244 | 244 |
245 uint proj_index = 1; // region's edge corresponding to uncommon_proj | 245 uint proj_index = 1; // region's edge corresponding to uncommon_proj |
246 if (!rgn->is_Region()) { // create a region to guard the call | 246 if (!rgn->is_Region()) { // create a region to guard the call |
247 assert(rgn->is_Call(), "must be call uct"); | 247 assert(rgn->is_Call(), "must be call uct"); |
248 CallNode* call = rgn->as_Call(); | 248 CallNode* call = rgn->as_Call(); |
249 rgn = new (C, 1) RegionNode(1); | 249 rgn = new (C) RegionNode(1); |
250 register_new_node_with_optimizer(rgn); | 250 register_new_node_with_optimizer(rgn); |
251 rgn->add_req(uncommon_proj); | 251 rgn->add_req(uncommon_proj); |
252 hash_delete(call); | 252 hash_delete(call); |
253 call->set_req(0, rgn); | 253 call->set_req(0, rgn); |
254 } else { | 254 } else { |
261 // Create new_iff in new location. | 261 // Create new_iff in new location. |
262 IfNode *new_iff = iff->clone()->as_If(); | 262 IfNode *new_iff = iff->clone()->as_If(); |
263 new_iff->set_req(0, new_entry); | 263 new_iff->set_req(0, new_entry); |
264 | 264 |
265 register_new_node_with_optimizer(new_iff); | 265 register_new_node_with_optimizer(new_iff); |
266 Node *if_cont = new (C, 1) IfTrueNode(new_iff); | 266 Node *if_cont = new (C) IfTrueNode(new_iff); |
267 Node *if_uct = new (C, 1) IfFalseNode(new_iff); | 267 Node *if_uct = new (C) IfFalseNode(new_iff); |
268 if (cont_proj->is_IfFalse()) { | 268 if (cont_proj->is_IfFalse()) { |
269 // Swap | 269 // Swap |
270 Node* tmp = if_uct; if_uct = if_cont; if_cont = tmp; | 270 Node* tmp = if_uct; if_uct = if_cont; if_cont = tmp; |
271 } | 271 } |
272 register_new_node_with_optimizer(if_cont); | 272 register_new_node_with_optimizer(if_cont); |
307 IfNode* iff = new_predicate_proj->in(0)->as_If(); | 307 IfNode* iff = new_predicate_proj->in(0)->as_If(); |
308 Node* ctrl = iff->in(0); | 308 Node* ctrl = iff->in(0); |
309 | 309 |
310 // Match original condition since predicate's projections could be swapped. | 310 // Match original condition since predicate's projections could be swapped. |
311 assert(predicate_proj->in(0)->in(1)->in(1)->Opcode()==Op_Opaque1, "must be"); | 311 assert(predicate_proj->in(0)->in(1)->in(1)->Opcode()==Op_Opaque1, "must be"); |
312 Node* opq = new (igvn->C, 2) Opaque1Node(igvn->C, predicate_proj->in(0)->in(1)->in(1)->in(1)); | 312 Node* opq = new (igvn->C) Opaque1Node(igvn->C, predicate_proj->in(0)->in(1)->in(1)->in(1)); |
313 igvn->C->add_predicate_opaq(opq); | 313 igvn->C->add_predicate_opaq(opq); |
314 | 314 |
315 Node* bol = new (igvn->C, 2) Conv2BNode(opq); | 315 Node* bol = new (igvn->C) Conv2BNode(opq); |
316 if (loop_phase != NULL) { | 316 if (loop_phase != NULL) { |
317 loop_phase->register_new_node(opq, ctrl); | 317 loop_phase->register_new_node(opq, ctrl); |
318 loop_phase->register_new_node(bol, ctrl); | 318 loop_phase->register_new_node(bol, ctrl); |
319 } else { | 319 } else { |
320 igvn->register_new_node_with_optimizer(opq); | 320 igvn->register_new_node_with_optimizer(opq); |
658 if (LoopLimitCheck) { | 658 if (LoopLimitCheck) { |
659 // With LoopLimitCheck limit is not exact. | 659 // With LoopLimitCheck limit is not exact. |
660 // Calculate exact limit here. | 660 // Calculate exact limit here. |
661 // Note, counted loop's test is '<' or '>'. | 661 // Note, counted loop's test is '<' or '>'. |
662 limit = exact_limit(loop); | 662 limit = exact_limit(loop); |
663 max_idx_expr = new (C, 3) SubINode(limit, stride); | 663 max_idx_expr = new (C) SubINode(limit, stride); |
664 register_new_node(max_idx_expr, ctrl); | 664 register_new_node(max_idx_expr, ctrl); |
665 if (TraceLoopPredicate) predString->print("(limit - stride) "); | 665 if (TraceLoopPredicate) predString->print("(limit - stride) "); |
666 } else { | 666 } else { |
667 max_idx_expr = new (C, 3) SubINode(limit, stride); | 667 max_idx_expr = new (C) SubINode(limit, stride); |
668 register_new_node(max_idx_expr, ctrl); | 668 register_new_node(max_idx_expr, ctrl); |
669 if (TraceLoopPredicate) predString->print("(limit - stride) "); | 669 if (TraceLoopPredicate) predString->print("(limit - stride) "); |
670 } | 670 } |
671 } else { | 671 } else { |
672 if (TraceLoopPredicate) predString->print("init "); | 672 if (TraceLoopPredicate) predString->print("init "); |
673 } | 673 } |
674 | 674 |
675 if (scale != 1) { | 675 if (scale != 1) { |
676 ConNode* con_scale = _igvn.intcon(scale); | 676 ConNode* con_scale = _igvn.intcon(scale); |
677 max_idx_expr = new (C, 3) MulINode(max_idx_expr, con_scale); | 677 max_idx_expr = new (C) MulINode(max_idx_expr, con_scale); |
678 register_new_node(max_idx_expr, ctrl); | 678 register_new_node(max_idx_expr, ctrl); |
679 if (TraceLoopPredicate) predString->print("* %d ", scale); | 679 if (TraceLoopPredicate) predString->print("* %d ", scale); |
680 } | 680 } |
681 | 681 |
682 if (offset && (!offset->is_Con() || offset->get_int() != 0)){ | 682 if (offset && (!offset->is_Con() || offset->get_int() != 0)){ |
683 max_idx_expr = new (C, 3) AddINode(max_idx_expr, offset); | 683 max_idx_expr = new (C) AddINode(max_idx_expr, offset); |
684 register_new_node(max_idx_expr, ctrl); | 684 register_new_node(max_idx_expr, ctrl); |
685 if (TraceLoopPredicate) | 685 if (TraceLoopPredicate) |
686 if (offset->is_Con()) predString->print("+ %d ", offset->get_int()); | 686 if (offset->is_Con()) predString->print("+ %d ", offset->get_int()); |
687 else predString->print("+ offset "); | 687 else predString->print("+ offset "); |
688 } | 688 } |
689 | 689 |
690 CmpUNode* cmp = new (C, 3) CmpUNode(max_idx_expr, range); | 690 CmpUNode* cmp = new (C) CmpUNode(max_idx_expr, range); |
691 register_new_node(cmp, ctrl); | 691 register_new_node(cmp, ctrl); |
692 BoolNode* bol = new (C, 2) BoolNode(cmp, BoolTest::lt); | 692 BoolNode* bol = new (C) BoolNode(cmp, BoolTest::lt); |
693 register_new_node(bol, ctrl); | 693 register_new_node(bol, ctrl); |
694 | 694 |
695 if (TraceLoopPredicate) { | 695 if (TraceLoopPredicate) { |
696 predString->print_cr("<u range"); | 696 predString->print_cr("<u range"); |
697 tty->print(predString->as_string()); | 697 tty->print(predString->as_string()); |
803 BoolNode* new_predicate_bol = invar.clone(bol, ctrl)->as_Bool(); | 803 BoolNode* new_predicate_bol = invar.clone(bol, ctrl)->as_Bool(); |
804 | 804 |
805 // Negate test if necessary | 805 // Negate test if necessary |
806 bool negated = false; | 806 bool negated = false; |
807 if (proj->_con != predicate_proj->_con) { | 807 if (proj->_con != predicate_proj->_con) { |
808 new_predicate_bol = new (C, 2) BoolNode(new_predicate_bol->in(1), new_predicate_bol->_test.negate()); | 808 new_predicate_bol = new (C) BoolNode(new_predicate_bol->in(1), new_predicate_bol->_test.negate()); |
809 register_new_node(new_predicate_bol, ctrl); | 809 register_new_node(new_predicate_bol, ctrl); |
810 negated = true; | 810 negated = true; |
811 } | 811 } |
812 IfNode* new_predicate_iff = new_predicate_proj->in(0)->as_If(); | 812 IfNode* new_predicate_iff = new_predicate_proj->in(0)->as_If(); |
813 _igvn.hash_delete(new_predicate_iff); | 813 _igvn.hash_delete(new_predicate_iff); |