< prev index next >

src/share/vm/opto/gcm.cpp

Print this page




1721   if (ch == NULL) {
1722     _child = cl;
1723   } else {
1724     while (ch->_sibling != NULL) { ch = ch->_sibling; }
1725     ch->_sibling = cl;
1726   }
1727 }
1728 
1729 //------------------------------compute_loop_depth-----------------------------
1730 // Store the loop depth in each CFGLoop object.
1731 // Recursively walk the children to do the same for them.
1732 void CFGLoop::compute_loop_depth(int depth) {
1733   _depth = depth;
1734   CFGLoop* ch = _child;
1735   while (ch != NULL) {
1736     ch->compute_loop_depth(depth + 1);
1737     ch = ch->_sibling;
1738   }
1739 }
1740 























1741 //------------------------------compute_freq-----------------------------------
1742 // Compute the frequency of each block and loop, relative to a single entry
1743 // into the dominating loop head.
1744 void CFGLoop::compute_freq() {
1745   // Bottom up traversal of loop tree (visit inner loops first.)
1746   // Set loop head frequency to 1.0, then transitively
1747   // compute frequency for all successors in the loop,
1748   // as well as for each exit edge.  Inner loops are
1749   // treated as single blocks with loop exit targets
1750   // as the successor blocks.
1751 
1752   // Nested loops first
1753   CFGLoop* ch = _child;
1754   while (ch != NULL) {
1755     ch->compute_freq();
1756     ch = ch->_sibling;
1757   }
1758   assert (_members.length() > 0, "no empty loops");
1759   Block* hd = head();
1760   hd->_freq = 1.0;




1721   if (ch == NULL) {
1722     _child = cl;
1723   } else {
1724     while (ch->_sibling != NULL) { ch = ch->_sibling; }
1725     ch->_sibling = cl;
1726   }
1727 }
1728 
1729 //------------------------------compute_loop_depth-----------------------------
1730 // Store the loop depth in each CFGLoop object.
1731 // Recursively walk the children to do the same for them.
1732 void CFGLoop::compute_loop_depth(int depth) {
1733   _depth = depth;
1734   CFGLoop* ch = _child;
1735   while (ch != NULL) {
1736     ch->compute_loop_depth(depth + 1);
1737     ch = ch->_sibling;
1738   }
1739 }
1740 
1741 Block *CFGLoop::backedge_block() {
1742   Block* hd = head();
1743   Block* back_edge = NULL;
1744   assert(_members.length() > 0, "no empty loops");
1745   for (int i = 0; i < _members.length(); i++) {
1746     CFGElement* s = _members.at(i);
1747     if (s->is_block()) {
1748       Block* b = s->as_Block();
1749       if (b == hd) continue;
1750       for (uint j = 0; j < b->_num_succs; j++) {
1751         Block* sb = b->_succs[j];
1752         if (sb == hd) {
1753           back_edge = b;
1754           break;
1755         }
1756       }
1757     }
1758     if (back_edge) break;
1759   }
1760 
1761   return back_edge;
1762 }
1763 
1764 //------------------------------compute_freq-----------------------------------
1765 // Compute the frequency of each block and loop, relative to a single entry
1766 // into the dominating loop head.
1767 void CFGLoop::compute_freq() {
1768   // Bottom up traversal of loop tree (visit inner loops first.)
1769   // Set loop head frequency to 1.0, then transitively
1770   // compute frequency for all successors in the loop,
1771   // as well as for each exit edge.  Inner loops are
1772   // treated as single blocks with loop exit targets
1773   // as the successor blocks.
1774 
1775   // Nested loops first
1776   CFGLoop* ch = _child;
1777   while (ch != NULL) {
1778     ch->compute_freq();
1779     ch = ch->_sibling;
1780   }
1781   assert (_members.length() > 0, "no empty loops");
1782   Block* hd = head();
1783   hd->_freq = 1.0;


< prev index next >