comparison src/share/vm/opto/loopnode.cpp @ 23474:7c5babab479b

8144935: C2: safepoint is pruned from a non-counted loop Reviewed-by: roland
author vlivanov
date Thu, 10 Dec 2015 14:51:53 +0300
parents cf93dd06db0f
children 501f014415d8
comparison
equal deleted inserted replaced
23473:cf93dd06db0f 23474:7c5babab479b
1809 } 1809 }
1810 } 1810 }
1811 } 1811 }
1812 1812
1813 void IdealLoopTree::remove_safepoints(PhaseIdealLoop* phase, bool keep_one) { 1813 void IdealLoopTree::remove_safepoints(PhaseIdealLoop* phase, bool keep_one) {
1814 // Look for a safepoint on the idom-path.
1815 Node* keep = NULL; 1814 Node* keep = NULL;
1816 if (keep_one) { 1815 if (keep_one) {
1817 // Keep one if possible 1816 // Look for a safepoint on the idom-path.
1818 for (Node* i = tail(); i != _head; i = phase->idom(i)) { 1817 for (Node* i = tail(); i != _head; i = phase->idom(i)) {
1819 if (i->Opcode() == Op_SafePoint && phase->get_loop(i) == this) { 1818 if (i->Opcode() == Op_SafePoint && phase->get_loop(i) == this) {
1820 keep = i; 1819 keep = i;
1821 break; // Found one 1820 break; // Found one
1822 } 1821 }
1823 } 1822 }
1824 } 1823 }
1825 1824
1825 // Don't remove any safepoints if it is requested to keep a single safepoint and
1826 // no safepoint was found on idom-path. It is not safe to remove any safepoint
1827 // in this case since there's no safepoint dominating all paths in the loop body.
1828 bool prune = !keep_one || keep != NULL;
1829
1826 // Delete other safepoints in this loop. 1830 // Delete other safepoints in this loop.
1827 Node_List* sfpts = _safepts; 1831 Node_List* sfpts = _safepts;
1828 if (sfpts != NULL) { 1832 if (prune && sfpts != NULL) {
1829 assert(keep == NULL || keep->Opcode() == Op_SafePoint, "not safepoint"); 1833 assert(keep == NULL || keep->Opcode() == Op_SafePoint, "not safepoint");
1830 for (uint i = 0; i < sfpts->size(); i++) { 1834 for (uint i = 0; i < sfpts->size(); i++) {
1831 Node* n = sfpts->at(i); 1835 Node* n = sfpts->at(i);
1832 assert(phase->get_loop(n) == this, ""); 1836 assert(phase->get_loop(n) == this, "");
1833 if (n != keep && phase->is_deleteable_safept(n)) { 1837 if (n != keep && phase->is_deleteable_safept(n)) {
1915 tty->print(" (%d iters) ", (int)cl->profile_trip_cnt()); 1919 tty->print(" (%d iters) ", (int)cl->profile_trip_cnt());
1916 1920
1917 if (cl->is_pre_loop ()) tty->print(" pre" ); 1921 if (cl->is_pre_loop ()) tty->print(" pre" );
1918 if (cl->is_main_loop()) tty->print(" main"); 1922 if (cl->is_main_loop()) tty->print(" main");
1919 if (cl->is_post_loop()) tty->print(" post"); 1923 if (cl->is_post_loop()) tty->print(" post");
1924 }
1925 if (_has_call) tty->print(" has_call");
1926 if (_has_sfpt) tty->print(" has_sfpt");
1927 if (_rce_candidate) tty->print(" rce");
1928 if (_safepts != NULL && _safepts->size() > 0) {
1929 tty->print(" sfpts={"); _safepts->dump_simple(); tty->print(" }");
1930 }
1931 if (_required_safept != NULL && _required_safept->size() > 0) {
1932 tty->print(" req={"); _required_safept->dump_simple(); tty->print(" }");
1920 } 1933 }
1921 tty->cr(); 1934 tty->cr();
1922 } 1935 }
1923 1936
1924 //------------------------------dump------------------------------------------- 1937 //------------------------------dump-------------------------------------------