comparison src/share/vm/opto/cfgnode.cpp @ 6848:8e47bac5643a

7054512: Compress class pointers after perm gen removal Summary: support of compress class pointers in the compilers. Reviewed-by: kvn, twisti
author roland
date Tue, 09 Oct 2012 10:11:38 +0200
parents e626685e9f6c
children ad5dd04754ee
comparison
equal deleted inserted replaced
6847:65d07d9ee446 6848:8e47bac5643a
1384 uint i; 1384 uint i;
1385 for( i = 1; i < phi->req()-1; i++ ) { 1385 for( i = 1; i < phi->req()-1; i++ ) {
1386 Node *n = phi->in(i); 1386 Node *n = phi->in(i);
1387 if( !n ) return NULL; 1387 if( !n ) return NULL;
1388 if( phase->type(n) == Type::TOP ) return NULL; 1388 if( phase->type(n) == Type::TOP ) return NULL;
1389 if( n->Opcode() == Op_ConP || n->Opcode() == Op_ConN ) 1389 if( n->Opcode() == Op_ConP || n->Opcode() == Op_ConN || n->Opcode() == Op_ConNKlass )
1390 break; 1390 break;
1391 } 1391 }
1392 if( i >= phi->req() ) // Only split for constants 1392 if( i >= phi->req() ) // Only split for constants
1393 return NULL; 1393 return NULL;
1394 1394
1873 } 1873 }
1874 } 1874 }
1875 } 1875 }
1876 1876
1877 #ifdef _LP64 1877 #ifdef _LP64
1878 // Push DecodeN down through phi. 1878 // Push DecodeN/DecodeNKlass down through phi.
1879 // The rest of phi graph will transform by split EncodeP node though phis up. 1879 // The rest of phi graph will transform by split EncodeP node though phis up.
1880 if (UseCompressedOops && can_reshape && progress == NULL) { 1880 if ((UseCompressedOops || UseCompressedKlassPointers) && can_reshape && progress == NULL) {
1881 bool may_push = true; 1881 bool may_push = true;
1882 bool has_decodeN = false; 1882 bool has_decodeN = false;
1883 bool is_decodeN = false;
1883 for (uint i=1; i<req(); ++i) {// For all paths in 1884 for (uint i=1; i<req(); ++i) {// For all paths in
1884 Node *ii = in(i); 1885 Node *ii = in(i);
1885 if (ii->is_DecodeN() && ii->bottom_type() == bottom_type()) { 1886 if (ii->is_DecodeNarrowPtr() && ii->bottom_type() == bottom_type()) {
1886 // Do optimization if a non dead path exist. 1887 // Do optimization if a non dead path exist.
1887 if (ii->in(1)->bottom_type() != Type::TOP) { 1888 if (ii->in(1)->bottom_type() != Type::TOP) {
1888 has_decodeN = true; 1889 has_decodeN = true;
1890 is_decodeN = ii->is_DecodeN();
1889 } 1891 }
1890 } else if (!ii->is_Phi()) { 1892 } else if (!ii->is_Phi()) {
1891 may_push = false; 1893 may_push = false;
1892 } 1894 }
1893 } 1895 }
1894 1896
1895 if (has_decodeN && may_push) { 1897 if (has_decodeN && may_push) {
1896 PhaseIterGVN *igvn = phase->is_IterGVN(); 1898 PhaseIterGVN *igvn = phase->is_IterGVN();
1897 // Make narrow type for new phi. 1899 // Make narrow type for new phi.
1898 const Type* narrow_t = TypeNarrowOop::make(this->bottom_type()->is_ptr()); 1900 const Type* narrow_t;
1901 if (is_decodeN) {
1902 narrow_t = TypeNarrowOop::make(this->bottom_type()->is_ptr());
1903 } else {
1904 narrow_t = TypeNarrowKlass::make(this->bottom_type()->is_ptr());
1905 }
1899 PhiNode* new_phi = new (phase->C) PhiNode(r, narrow_t); 1906 PhiNode* new_phi = new (phase->C) PhiNode(r, narrow_t);
1900 uint orig_cnt = req(); 1907 uint orig_cnt = req();
1901 for (uint i=1; i<req(); ++i) {// For all paths in 1908 for (uint i=1; i<req(); ++i) {// For all paths in
1902 Node *ii = in(i); 1909 Node *ii = in(i);
1903 Node* new_ii = NULL; 1910 Node* new_ii = NULL;
1904 if (ii->is_DecodeN()) { 1911 if (ii->is_DecodeNarrowPtr()) {
1905 assert(ii->bottom_type() == bottom_type(), "sanity"); 1912 assert(ii->bottom_type() == bottom_type(), "sanity");
1906 new_ii = ii->in(1); 1913 new_ii = ii->in(1);
1907 } else { 1914 } else {
1908 assert(ii->is_Phi(), "sanity"); 1915 assert(ii->is_Phi(), "sanity");
1909 if (ii->as_Phi() == this) { 1916 if (ii->as_Phi() == this) {
1910 new_ii = new_phi; 1917 new_ii = new_phi;
1911 } else { 1918 } else {
1912 new_ii = new (phase->C) EncodePNode(ii, narrow_t); 1919 if (is_decodeN) {
1920 new_ii = new (phase->C) EncodePNode(ii, narrow_t);
1921 } else {
1922 new_ii = new (phase->C) EncodePKlassNode(ii, narrow_t);
1923 }
1913 igvn->register_new_node_with_optimizer(new_ii); 1924 igvn->register_new_node_with_optimizer(new_ii);
1914 } 1925 }
1915 } 1926 }
1916 new_phi->set_req(i, new_ii); 1927 new_phi->set_req(i, new_ii);
1917 } 1928 }
1918 igvn->register_new_node_with_optimizer(new_phi, this); 1929 igvn->register_new_node_with_optimizer(new_phi, this);
1919 progress = new (phase->C) DecodeNNode(new_phi, bottom_type()); 1930 if (is_decodeN) {
1931 progress = new (phase->C) DecodeNNode(new_phi, bottom_type());
1932 } else {
1933 progress = new (phase->C) DecodeNKlassNode(new_phi, bottom_type());
1934 }
1920 } 1935 }
1921 } 1936 }
1922 #endif 1937 #endif
1923 1938
1924 return progress; // Return any progress 1939 return progress; // Return any progress