1790 // Push DecodeN down through phi. |
1790 // Push DecodeN down through phi. |
1791 // The rest of phi graph will transform by split EncodeP node though phis up. |
1791 // The rest of phi graph will transform by split EncodeP node though phis up. |
1792 if (UseCompressedOops && can_reshape && progress == NULL) { |
1792 if (UseCompressedOops && can_reshape && progress == NULL) { |
1793 bool may_push = true; |
1793 bool may_push = true; |
1794 bool has_decodeN = false; |
1794 bool has_decodeN = false; |
1795 Node* in_decodeN = NULL; |
|
1796 for (uint i=1; i<req(); ++i) {// For all paths in |
1795 for (uint i=1; i<req(); ++i) {// For all paths in |
1797 Node *ii = in(i); |
1796 Node *ii = in(i); |
1798 if (ii->is_DecodeN() && ii->bottom_type() == bottom_type()) { |
1797 if (ii->is_DecodeN() && ii->bottom_type() == bottom_type()) { |
1799 // Note: in_decodeN is used only to define the type of new phi. |
1798 // Do optimization if a non dead path exist. |
1800 // Find a non dead path otherwise phi type will be wrong. |
|
1801 if (ii->in(1)->bottom_type() != Type::TOP) { |
1799 if (ii->in(1)->bottom_type() != Type::TOP) { |
1802 has_decodeN = true; |
1800 has_decodeN = true; |
1803 in_decodeN = ii->in(1); |
|
1804 } |
1801 } |
1805 } else if (!ii->is_Phi()) { |
1802 } else if (!ii->is_Phi()) { |
1806 may_push = false; |
1803 may_push = false; |
1807 } |
1804 } |
1808 } |
1805 } |
1809 |
1806 |
1810 if (has_decodeN && may_push) { |
1807 if (has_decodeN && may_push) { |
1811 PhaseIterGVN *igvn = phase->is_IterGVN(); |
1808 PhaseIterGVN *igvn = phase->is_IterGVN(); |
1812 PhiNode *new_phi = PhiNode::make_blank(in(0), in_decodeN); |
1809 // Make narrow type for new phi. |
|
1810 const Type* narrow_t = TypeNarrowOop::make(this->bottom_type()->is_ptr()); |
|
1811 PhiNode* new_phi = new (phase->C, r->req()) PhiNode(r, narrow_t); |
1813 uint orig_cnt = req(); |
1812 uint orig_cnt = req(); |
1814 for (uint i=1; i<req(); ++i) {// For all paths in |
1813 for (uint i=1; i<req(); ++i) {// For all paths in |
1815 Node *ii = in(i); |
1814 Node *ii = in(i); |
1816 Node* new_ii = NULL; |
1815 Node* new_ii = NULL; |
1817 if (ii->is_DecodeN()) { |
1816 if (ii->is_DecodeN()) { |
1820 } else { |
1819 } else { |
1821 assert(ii->is_Phi(), "sanity"); |
1820 assert(ii->is_Phi(), "sanity"); |
1822 if (ii->as_Phi() == this) { |
1821 if (ii->as_Phi() == this) { |
1823 new_ii = new_phi; |
1822 new_ii = new_phi; |
1824 } else { |
1823 } else { |
1825 new_ii = new (phase->C, 2) EncodePNode(ii, in_decodeN->bottom_type()); |
1824 new_ii = new (phase->C, 2) EncodePNode(ii, narrow_t); |
1826 igvn->register_new_node_with_optimizer(new_ii); |
1825 igvn->register_new_node_with_optimizer(new_ii); |
1827 } |
1826 } |
1828 } |
1827 } |
1829 new_phi->set_req(i, new_ii); |
1828 new_phi->set_req(i, new_ii); |
1830 } |
1829 } |