comparison src/share/vm/opto/loopnode.cpp @ 2403:1927db75dd85

7024475: loop doesn't terminate when compiled Reviewed-by: kvn
author never
date Sun, 27 Mar 2011 00:00:14 -0700
parents 9dc311b8473e
children 08eb13460b3a
comparison
equal deleted inserted replaced
2402:244bf8afbbd3 2403:1927db75dd85
1061 // Return TRUE if loop tree is structurally changed. 1061 // Return TRUE if loop tree is structurally changed.
1062 bool IdealLoopTree::beautify_loops( PhaseIdealLoop *phase ) { 1062 bool IdealLoopTree::beautify_loops( PhaseIdealLoop *phase ) {
1063 bool result = false; 1063 bool result = false;
1064 // Cache parts in locals for easy 1064 // Cache parts in locals for easy
1065 PhaseIterGVN &igvn = phase->_igvn; 1065 PhaseIterGVN &igvn = phase->_igvn;
1066
1067 phase->C->print_method("Before beautify loops", 3);
1068 1066
1069 igvn.hash_delete(_head); // Yank from hash before hacking edges 1067 igvn.hash_delete(_head); // Yank from hash before hacking edges
1070 1068
1071 // Check for multiple fall-in paths. Peel off a landing pad if need be. 1069 // Check for multiple fall-in paths. Peel off a landing pad if need be.
1072 int fall_in_cnt = 0; 1070 int fall_in_cnt = 0;
1545 // its corresponding LoopNode. If 'optimize' is true, do some loop cleanups. 1543 // its corresponding LoopNode. If 'optimize' is true, do some loop cleanups.
1546 void PhaseIdealLoop::build_and_optimize(bool do_split_ifs, bool do_loop_pred) { 1544 void PhaseIdealLoop::build_and_optimize(bool do_split_ifs, bool do_loop_pred) {
1547 ResourceMark rm; 1545 ResourceMark rm;
1548 1546
1549 int old_progress = C->major_progress(); 1547 int old_progress = C->major_progress();
1548 uint orig_worklist_size = _igvn._worklist.size();
1550 1549
1551 // Reset major-progress flag for the driver's heuristics 1550 // Reset major-progress flag for the driver's heuristics
1552 C->clear_major_progress(); 1551 C->clear_major_progress();
1553 1552
1554 #ifndef PRODUCT 1553 #ifndef PRODUCT
1608 _ltree_root->set_nest( 0 ); 1607 _ltree_root->set_nest( 0 );
1609 1608
1610 // Split shared headers and insert loop landing pads. 1609 // Split shared headers and insert loop landing pads.
1611 // Do not bother doing this on the Root loop of course. 1610 // Do not bother doing this on the Root loop of course.
1612 if( !_verify_me && !_verify_only && _ltree_root->_child ) { 1611 if( !_verify_me && !_verify_only && _ltree_root->_child ) {
1612 C->print_method("Before beautify loops", 3);
1613 if( _ltree_root->_child->beautify_loops( this ) ) { 1613 if( _ltree_root->_child->beautify_loops( this ) ) {
1614 // Re-build loop tree! 1614 // Re-build loop tree!
1615 _ltree_root->_child = NULL; 1615 _ltree_root->_child = NULL;
1616 _nodes.clear(); 1616 _nodes.clear();
1617 reallocate_preorders(); 1617 reallocate_preorders();
1692 if (_verify_only) { 1692 if (_verify_only) {
1693 // restore major progress flag 1693 // restore major progress flag
1694 for (int i = 0; i < old_progress; i++) 1694 for (int i = 0; i < old_progress; i++)
1695 C->set_major_progress(); 1695 C->set_major_progress();
1696 assert(C->unique() == unique, "verification mode made Nodes? ? ?"); 1696 assert(C->unique() == unique, "verification mode made Nodes? ? ?");
1697 assert(_igvn._worklist.size() == 0, "shouldn't push anything"); 1697 assert(_igvn._worklist.size() == orig_worklist_size, "shouldn't push anything");
1698 return; 1698 return;
1699 } 1699 }
1700 1700
1701 // some parser-inserted loop predicates could never be used by loop 1701 // some parser-inserted loop predicates could never be used by loop
1702 // predication. Eliminate them before loop optimization 1702 // predication. Eliminate them before loop optimization