1816 } |
1816 } |
1817 } |
1817 } |
1818 } |
1818 } |
1819 |
1819 |
1820 void IdealLoopTree::remove_safepoints(PhaseIdealLoop* phase, bool keep_one) { |
1820 void IdealLoopTree::remove_safepoints(PhaseIdealLoop* phase, bool keep_one) { |
1821 // Look for a safepoint on the idom-path. |
|
1822 Node* keep = NULL; |
1821 Node* keep = NULL; |
1823 if (keep_one) { |
1822 if (keep_one) { |
1824 // Keep one if possible |
1823 // Look for a safepoint on the idom-path. |
1825 for (Node* i = tail(); i != _head; i = phase->idom(i)) { |
1824 for (Node* i = tail(); i != _head; i = phase->idom(i)) { |
1826 if (i->Opcode() == Op_SafePoint && phase->get_loop(i) == this) { |
1825 if (i->Opcode() == Op_SafePoint && phase->get_loop(i) == this) { |
1827 keep = i; |
1826 keep = i; |
1828 break; // Found one |
1827 break; // Found one |
1829 } |
1828 } |
1830 } |
1829 } |
1831 } |
1830 } |
1832 |
1831 |
|
1832 // Don't remove any safepoints if it is requested to keep a single safepoint and |
|
1833 // no safepoint was found on idom-path. It is not safe to remove any safepoint |
|
1834 // in this case since there's no safepoint dominating all paths in the loop body. |
|
1835 bool prune = !keep_one || keep != NULL; |
|
1836 |
1833 // Delete other safepoints in this loop. |
1837 // Delete other safepoints in this loop. |
1834 Node_List* sfpts = _safepts; |
1838 Node_List* sfpts = _safepts; |
1835 if (sfpts != NULL) { |
1839 if (prune && sfpts != NULL) { |
1836 assert(keep == NULL || keep->Opcode() == Op_SafePoint, "not safepoint"); |
1840 assert(keep == NULL || keep->Opcode() == Op_SafePoint, "not safepoint"); |
1837 for (uint i = 0; i < sfpts->size(); i++) { |
1841 for (uint i = 0; i < sfpts->size(); i++) { |
1838 Node* n = sfpts->at(i); |
1842 Node* n = sfpts->at(i); |
1839 assert(phase->get_loop(n) == this, ""); |
1843 assert(phase->get_loop(n) == this, ""); |
1840 if (n != keep && phase->is_deleteable_safept(n)) { |
1844 if (n != keep && phase->is_deleteable_safept(n)) { |
1922 tty->print(" (%0.f iters) ", cl->profile_trip_cnt()); |
1926 tty->print(" (%0.f iters) ", cl->profile_trip_cnt()); |
1923 |
1927 |
1924 if (cl->is_pre_loop ()) tty->print(" pre" ); |
1928 if (cl->is_pre_loop ()) tty->print(" pre" ); |
1925 if (cl->is_main_loop()) tty->print(" main"); |
1929 if (cl->is_main_loop()) tty->print(" main"); |
1926 if (cl->is_post_loop()) tty->print(" post"); |
1930 if (cl->is_post_loop()) tty->print(" post"); |
|
1931 } |
|
1932 if (_has_call) tty->print(" has_call"); |
|
1933 if (_has_sfpt) tty->print(" has_sfpt"); |
|
1934 if (_rce_candidate) tty->print(" rce"); |
|
1935 if (_safepts != NULL && _safepts->size() > 0) { |
|
1936 tty->print(" sfpts={"); _safepts->dump_simple(); tty->print(" }"); |
|
1937 } |
|
1938 if (_required_safept != NULL && _required_safept->size() > 0) { |
|
1939 tty->print(" req={"); _required_safept->dump_simple(); tty->print(" }"); |
1927 } |
1940 } |
1928 tty->cr(); |
1941 tty->cr(); |
1929 } |
1942 } |
1930 |
1943 |
1931 //------------------------------dump------------------------------------------- |
1944 //------------------------------dump------------------------------------------- |