1657 if (C->macro_count() == 0)
1658 return false;
1659 // attempt to eliminate allocations
1660 bool progress = true;
1661 while (progress) {
1662 progress = false;
1663 for (int i = C->macro_count(); i > 0; i--) {
1664 Node * n = C->macro_node(i-1);
1665 bool success = false;
1666 debug_only(int old_macro_count = C->macro_count(););
1667 switch (n->class_id()) {
1668 case Node::Class_Allocate:
1669 case Node::Class_AllocateArray:
1670 success = eliminate_allocate_node(n->as_Allocate());
1671 break;
1672 case Node::Class_Lock:
1673 case Node::Class_Unlock:
1674 success = eliminate_locking_node(n->as_AbstractLock());
1675 break;
1676 default:
1677 assert(false, "unknown node type in macro list");
1678 }
1679 assert(success == (C->macro_count() < old_macro_count), "elimination reduces macro count");
1680 progress = progress || success;
1681 }
1682 }
1683 // Make sure expansion will not cause node limit to be exceeded.
1684 // Worst case is a macro node gets expanded into about 50 nodes.
1685 // Allow 50% more for optimization.
1686 if (C->check_node_count(C->macro_count() * 75, "out of nodes before macro expansion" ) )
1687 return true;
1688
1689 // expand "macro" nodes
1690 // nodes are removed from the macro list as they are processed
1691 while (C->macro_count() > 0) {
1692 int macro_count = C->macro_count();
1693 Node * n = C->macro_node(macro_count-1);
1694 assert(n->is_macro(), "only macro nodes expected here");
1695 if (_igvn.type(n) == Type::TOP || n->in(0)->is_top() ) {
1696 // node is unreachable, so don't try to expand it
1697 C->remove_macro_node(n);
1698 continue;
|
1657 if (C->macro_count() == 0)
1658 return false;
1659 // attempt to eliminate allocations
1660 bool progress = true;
1661 while (progress) {
1662 progress = false;
1663 for (int i = C->macro_count(); i > 0; i--) {
1664 Node * n = C->macro_node(i-1);
1665 bool success = false;
1666 debug_only(int old_macro_count = C->macro_count(););
1667 switch (n->class_id()) {
1668 case Node::Class_Allocate:
1669 case Node::Class_AllocateArray:
1670 success = eliminate_allocate_node(n->as_Allocate());
1671 break;
1672 case Node::Class_Lock:
1673 case Node::Class_Unlock:
1674 success = eliminate_locking_node(n->as_AbstractLock());
1675 break;
1676 default:
1677 if (n->Opcode() == Op_Opaque1 || n->Opcode() == Op_Opaque2) {
1678 _igvn.add_users_to_worklist(n);
1679 _igvn.hash_delete(n);
1680 _igvn.subsume_node(n, n->in(1));
1681 success = true;
1682 } else {
1683 assert(false, "unknown node type in macro list");
1684 }
1685 }
1686 assert(success == (C->macro_count() < old_macro_count), "elimination reduces macro count");
1687 progress = progress || success;
1688 }
1689 }
1690 // Make sure expansion will not cause node limit to be exceeded.
1691 // Worst case is a macro node gets expanded into about 50 nodes.
1692 // Allow 50% more for optimization.
1693 if (C->check_node_count(C->macro_count() * 75, "out of nodes before macro expansion" ) )
1694 return true;
1695
1696 // expand "macro" nodes
1697 // nodes are removed from the macro list as they are processed
1698 while (C->macro_count() > 0) {
1699 int macro_count = C->macro_count();
1700 Node * n = C->macro_node(macro_count-1);
1701 assert(n->is_macro(), "only macro nodes expected here");
1702 if (_igvn.type(n) == Type::TOP || n->in(0)->is_top() ) {
1703 // node is unreachable, so don't try to expand it
1704 C->remove_macro_node(n);
1705 continue;
|