src/share/vm/opto/loopnode.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 7017240 Sdiff src/share/vm/opto

src/share/vm/opto/loopnode.cpp

Print this page




1463 
1464   Unique_Node_List useful_predicates; // to store useful predicates
1465   if (C->has_loops()) {
1466     collect_potentially_useful_predicates(_ltree_root->_child, useful_predicates);
1467   }
1468 
1469   for (int i = C->predicate_count(); i > 0; i--) {
1470      Node * n = C->predicate_opaque1_node(i-1);
1471      assert(n->Opcode() == Op_Opaque1, "must be");
1472      if (!useful_predicates.member(n)) { // not in the useful list
1473        _igvn.replace_node(n, n->in(1));
1474      }
1475   }
1476 }
1477 
1478 //=============================================================================
1479 //----------------------------build_and_optimize-------------------------------
1480 // Create a PhaseLoop.  Build the ideal Loop tree.  Map each Ideal Node to
1481 // its corresponding LoopNode.  If 'optimize' is true, do some loop cleanups.
1482 void PhaseIdealLoop::build_and_optimize(bool do_split_ifs, bool do_loop_pred) {


1483   int old_progress = C->major_progress();
1484 
1485   // Reset major-progress flag for the driver's heuristics
1486   C->clear_major_progress();
1487 
1488 #ifndef PRODUCT
1489   // Capture for later assert
1490   uint unique = C->unique();
1491   _loop_invokes++;
1492   _loop_work += unique;
1493 #endif
1494 
1495   // True if the method has at least 1 irreducible loop
1496   _has_irreducible_loops = false;
1497 
1498   _created_loop_node = false;
1499 
1500   Arena *a = Thread::current()->resource_area();
1501   VectorSet visited(a);
1502   // Pre-grow the mapping from Nodes to IdealLoopTrees.


1996 }
1997 
1998 //------------------------------recompute_dom_depth---------------------------------------
1999 // The dominator tree is constructed with only parent pointers.
2000 // This recomputes the depth in the tree by first tagging all
2001 // nodes as "no depth yet" marker.  The next pass then runs up
2002 // the dom tree from each node marked "no depth yet", and computes
2003 // the depth on the way back down.
2004 void PhaseIdealLoop::recompute_dom_depth() {
2005   uint no_depth_marker = C->unique();
2006   uint i;
2007   // Initialize depth to "no depth yet"
2008   for (i = 0; i < _idom_size; i++) {
2009     if (_dom_depth[i] > 0 && _idom[i] != NULL) {
2010      _dom_depth[i] = no_depth_marker;
2011     }
2012   }
2013   if (_dom_stk == NULL) {
2014     uint init_size = C->unique() / 100; // Guess that 1/100 is a reasonable initial size.
2015     if (init_size < 10) init_size = 10;
2016     _dom_stk = new (C->node_arena()) GrowableArray<uint>(C->node_arena(), init_size, 0, 0);
2017   }
2018   // Compute new depth for each node.
2019   for (i = 0; i < _idom_size; i++) {
2020     uint j = i;
2021     // Run up the dom tree to find a node with a depth
2022     while (_dom_depth[j] == no_depth_marker) {
2023       _dom_stk->push(j);
2024       j = _idom[j]->_idx;
2025     }
2026     // Compute the depth on the way back down this tree branch
2027     uint dd = _dom_depth[j] + 1;
2028     while (_dom_stk->length() > 0) {
2029       uint j = _dom_stk->pop();
2030       _dom_depth[j] = dd;
2031       dd++;
2032     }
2033   }
2034 }
2035 
2036 //------------------------------sort-------------------------------------------




1463 
1464   Unique_Node_List useful_predicates; // to store useful predicates
1465   if (C->has_loops()) {
1466     collect_potentially_useful_predicates(_ltree_root->_child, useful_predicates);
1467   }
1468 
1469   for (int i = C->predicate_count(); i > 0; i--) {
1470      Node * n = C->predicate_opaque1_node(i-1);
1471      assert(n->Opcode() == Op_Opaque1, "must be");
1472      if (!useful_predicates.member(n)) { // not in the useful list
1473        _igvn.replace_node(n, n->in(1));
1474      }
1475   }
1476 }
1477 
1478 //=============================================================================
1479 //----------------------------build_and_optimize-------------------------------
1480 // Create a PhaseLoop.  Build the ideal Loop tree.  Map each Ideal Node to
1481 // its corresponding LoopNode.  If 'optimize' is true, do some loop cleanups.
1482 void PhaseIdealLoop::build_and_optimize(bool do_split_ifs, bool do_loop_pred) {
1483   ResourceMark rm;
1484 
1485   int old_progress = C->major_progress();
1486 
1487   // Reset major-progress flag for the driver's heuristics
1488   C->clear_major_progress();
1489 
1490 #ifndef PRODUCT
1491   // Capture for later assert
1492   uint unique = C->unique();
1493   _loop_invokes++;
1494   _loop_work += unique;
1495 #endif
1496 
1497   // True if the method has at least 1 irreducible loop
1498   _has_irreducible_loops = false;
1499 
1500   _created_loop_node = false;
1501 
1502   Arena *a = Thread::current()->resource_area();
1503   VectorSet visited(a);
1504   // Pre-grow the mapping from Nodes to IdealLoopTrees.


1998 }
1999 
2000 //------------------------------recompute_dom_depth---------------------------------------
2001 // The dominator tree is constructed with only parent pointers.
2002 // This recomputes the depth in the tree by first tagging all
2003 // nodes as "no depth yet" marker.  The next pass then runs up
2004 // the dom tree from each node marked "no depth yet", and computes
2005 // the depth on the way back down.
2006 void PhaseIdealLoop::recompute_dom_depth() {
2007   uint no_depth_marker = C->unique();
2008   uint i;
2009   // Initialize depth to "no depth yet"
2010   for (i = 0; i < _idom_size; i++) {
2011     if (_dom_depth[i] > 0 && _idom[i] != NULL) {
2012      _dom_depth[i] = no_depth_marker;
2013     }
2014   }
2015   if (_dom_stk == NULL) {
2016     uint init_size = C->unique() / 100; // Guess that 1/100 is a reasonable initial size.
2017     if (init_size < 10) init_size = 10;
2018     _dom_stk = new GrowableArray<uint>(init_size);
2019   }
2020   // Compute new depth for each node.
2021   for (i = 0; i < _idom_size; i++) {
2022     uint j = i;
2023     // Run up the dom tree to find a node with a depth
2024     while (_dom_depth[j] == no_depth_marker) {
2025       _dom_stk->push(j);
2026       j = _idom[j]->_idx;
2027     }
2028     // Compute the depth on the way back down this tree branch
2029     uint dd = _dom_depth[j] + 1;
2030     while (_dom_stk->length() > 0) {
2031       uint j = _dom_stk->pop();
2032       _dom_depth[j] = dd;
2033       dd++;
2034     }
2035   }
2036 }
2037 
2038 //------------------------------sort-------------------------------------------


src/share/vm/opto/loopnode.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File