1497 for (DUIterator_Fast i2max, i2 = m->fast_outs(i2max); i2 < i2max; i2++) { 1498 Node* p = m->fast_out(i2); // Propagate changes to uses 1499 if (p->is_Proj() && p->as_Proj()->_con == TypeFunc::Control && p->outcnt() == 1) 1500 worklist.push(p->unique_out()); 1501 } 1502 } 1503 if( m->bottom_type() != type(m) ) // If not already bottomed out 1504 worklist.push(m); // Propagate change to user 1505 } 1506 } 1507 } 1508 } 1509 1510 //------------------------------do_transform----------------------------------- 1511 // Top level driver for the recursive transformer 1512 void PhaseCCP::do_transform() { 1513 // Correct leaves of new-space Nodes; they point to old-space. 1514 C->set_root( transform(C->root())->as_Root() ); 1515 assert( C->top(), "missing TOP node" ); 1516 assert( C->root(), "missing root" ); 1517 } 1518 1519 //------------------------------transform-------------------------------------- 1520 // Given a Node in old-space, clone him into new-space. 1521 // Convert any of his old-space children into new-space children. 1522 Node *PhaseCCP::transform( Node *n ) { 1523 Node *new_node = _nodes[n->_idx]; // Check for transformed node 1524 if( new_node != NULL ) 1525 return new_node; // Been there, done that, return old answer 1526 new_node = transform_once(n); // Check for constant 1527 _nodes.map( n->_idx, new_node ); // Flag as having been cloned 1528 1529 // Allocate stack of size _nodes.Size()/2 to avoid frequent realloc 1530 GrowableArray <Node *> trstack(C->unique() >> 1); 1531 1532 trstack.push(new_node); // Process children of cloned node 1533 while ( trstack.is_nonempty() ) { 1534 Node *clone = trstack.pop(); 1535 uint cnt = clone->req(); 1536 for( uint i = 0; i < cnt; i++ ) { // For all inputs do | 1497 for (DUIterator_Fast i2max, i2 = m->fast_outs(i2max); i2 < i2max; i2++) { 1498 Node* p = m->fast_out(i2); // Propagate changes to uses 1499 if (p->is_Proj() && p->as_Proj()->_con == TypeFunc::Control && p->outcnt() == 1) 1500 worklist.push(p->unique_out()); 1501 } 1502 } 1503 if( m->bottom_type() != type(m) ) // If not already bottomed out 1504 worklist.push(m); // Propagate change to user 1505 } 1506 } 1507 } 1508 } 1509 1510 //------------------------------do_transform----------------------------------- 1511 // Top level driver for the recursive transformer 1512 void PhaseCCP::do_transform() { 1513 // Correct leaves of new-space Nodes; they point to old-space. 1514 C->set_root( transform(C->root())->as_Root() ); 1515 assert( C->top(), "missing TOP node" ); 1516 assert( C->root(), "missing root" ); 1517 1518 // Eagerly remove castPP nodes here. CastPP nodes might not be 1519 // removed in the subsequent IGVN phase if a node that changes 1520 // in(1) of a castPP is processed prior to the castPP node. 1521 Unique_Node_List to_remove; 1522 for (uint i = 0; i < _worklist.size(); i++) { 1523 Node* n = _worklist.at(i); 1524 1525 if (n->is_ConstraintCast()) { 1526 Node* nn = n->Identity(this); 1527 if (nn != n) { 1528 replace_node(n, nn); 1529 to_remove.push(n); 1530 } 1531 } 1532 } 1533 1534 while (to_remove.size() > 0) { 1535 _worklist.remove(to_remove.pop()); 1536 } 1537 } 1538 1539 //------------------------------transform-------------------------------------- 1540 // Given a Node in old-space, clone him into new-space. 1541 // Convert any of his old-space children into new-space children. 1542 Node *PhaseCCP::transform( Node *n ) { 1543 Node *new_node = _nodes[n->_idx]; // Check for transformed node 1544 if( new_node != NULL ) 1545 return new_node; // Been there, done that, return old answer 1546 new_node = transform_once(n); // Check for constant 1547 _nodes.map( n->_idx, new_node ); // Flag as having been cloned 1548 1549 // Allocate stack of size _nodes.Size()/2 to avoid frequent realloc 1550 GrowableArray <Node *> trstack(C->unique() >> 1); 1551 1552 trstack.push(new_node); // Process children of cloned node 1553 while ( trstack.is_nonempty() ) { 1554 Node *clone = trstack.pop(); 1555 uint cnt = clone->req(); 1556 for( uint i = 0; i < cnt; i++ ) { // For all inputs do |