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

src/share/vm/opto/cfgnode.cpp

Print this page




1775     //
1776     // Other optimizations on the memory chain
1777     //
1778     const TypePtr* at = adr_type();
1779     for( uint i=1; i<req(); ++i ) {// For all paths in
1780       Node *ii = in(i);
1781       Node *new_in = MemNode::optimize_memory_chain(ii, at, phase);
1782       if (ii != new_in ) {
1783         set_req(i, new_in);
1784         progress = this;
1785       }
1786     }
1787   }
1788 
1789 #ifdef _LP64
1790   // Push DecodeN down through phi.
1791   // The rest of phi graph will transform by split EncodeP node though phis up.
1792   if (UseCompressedOops && can_reshape && progress == NULL) {
1793     bool may_push = true;
1794     bool has_decodeN = false;
1795     Node* in_decodeN = NULL;
1796     for (uint i=1; i<req(); ++i) {// For all paths in
1797       Node *ii = in(i);
1798       if (ii->is_DecodeN() && ii->bottom_type() == bottom_type()) {
1799         // Note: in_decodeN is used only to define the type of new phi.
1800         // Find a non dead path otherwise phi type will be wrong.
1801         if (ii->in(1)->bottom_type() != Type::TOP) {
1802           has_decodeN = true;
1803           in_decodeN = ii->in(1);
1804         }
1805       } else if (!ii->is_Phi()) {
1806         may_push = false;
1807       }
1808     }
1809 
1810     if (has_decodeN && may_push) {
1811       PhaseIterGVN *igvn = phase->is_IterGVN();
1812       PhiNode *new_phi = PhiNode::make_blank(in(0), in_decodeN);


1813       uint orig_cnt = req();
1814       for (uint i=1; i<req(); ++i) {// For all paths in
1815         Node *ii = in(i);
1816         Node* new_ii = NULL;
1817         if (ii->is_DecodeN()) {
1818           assert(ii->bottom_type() == bottom_type(), "sanity");
1819           new_ii = ii->in(1);
1820         } else {
1821           assert(ii->is_Phi(), "sanity");
1822           if (ii->as_Phi() == this) {
1823             new_ii = new_phi;
1824           } else {
1825             new_ii = new (phase->C, 2) EncodePNode(ii, in_decodeN->bottom_type());
1826             igvn->register_new_node_with_optimizer(new_ii);
1827           }
1828         }
1829         new_phi->set_req(i, new_ii);
1830       }
1831       igvn->register_new_node_with_optimizer(new_phi, this);
1832       progress = new (phase->C, 2) DecodeNNode(new_phi, bottom_type());
1833     }
1834   }
1835 #endif
1836 
1837   return progress;              // Return any progress
1838 }
1839 
1840 //------------------------------is_tripcount-----------------------------------
1841 bool PhiNode::is_tripcount() const {
1842   return (in(0) != NULL && in(0)->is_CountedLoop() &&
1843           in(0)->as_CountedLoop()->phi() == this);
1844 }
1845 




1775     //
1776     // Other optimizations on the memory chain
1777     //
1778     const TypePtr* at = adr_type();
1779     for( uint i=1; i<req(); ++i ) {// For all paths in
1780       Node *ii = in(i);
1781       Node *new_in = MemNode::optimize_memory_chain(ii, at, phase);
1782       if (ii != new_in ) {
1783         set_req(i, new_in);
1784         progress = this;
1785       }
1786     }
1787   }
1788 
1789 #ifdef _LP64
1790   // Push DecodeN down through phi.
1791   // The rest of phi graph will transform by split EncodeP node though phis up.
1792   if (UseCompressedOops && can_reshape && progress == NULL) {
1793     bool may_push = true;
1794     bool has_decodeN = false;

1795     for (uint i=1; i<req(); ++i) {// For all paths in
1796       Node *ii = in(i);
1797       if (ii->is_DecodeN() && ii->bottom_type() == bottom_type()) {
1798         // Do optimization if a non dead path exist.

1799         if (ii->in(1)->bottom_type() != Type::TOP) {
1800           has_decodeN = true;

1801         }
1802       } else if (!ii->is_Phi()) {
1803         may_push = false;
1804       }
1805     }
1806 
1807     if (has_decodeN && may_push) {
1808       PhaseIterGVN *igvn = phase->is_IterGVN();
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);
1812       uint orig_cnt = req();
1813       for (uint i=1; i<req(); ++i) {// For all paths in
1814         Node *ii = in(i);
1815         Node* new_ii = NULL;
1816         if (ii->is_DecodeN()) {
1817           assert(ii->bottom_type() == bottom_type(), "sanity");
1818           new_ii = ii->in(1);
1819         } else {
1820           assert(ii->is_Phi(), "sanity");
1821           if (ii->as_Phi() == this) {
1822             new_ii = new_phi;
1823           } else {
1824             new_ii = new (phase->C, 2) EncodePNode(ii, narrow_t);
1825             igvn->register_new_node_with_optimizer(new_ii);
1826           }
1827         }
1828         new_phi->set_req(i, new_ii);
1829       }
1830       igvn->register_new_node_with_optimizer(new_phi, this);
1831       progress = new (phase->C, 2) DecodeNNode(new_phi, bottom_type());
1832     }
1833   }
1834 #endif
1835 
1836   return progress;              // Return any progress
1837 }
1838 
1839 //------------------------------is_tripcount-----------------------------------
1840 bool PhiNode::is_tripcount() const {
1841   return (in(0) != NULL && in(0)->is_CountedLoop() &&
1842           in(0)->as_CountedLoop()->phi() == this);
1843 }
1844 


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