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

src/share/vm/opto/escape.cpp

Print this page




 945                n->is_CheckCastPP() ||
 946                n->is_EncodeP() ||
 947                n->is_DecodeN() ||
 948                (n->is_ConstraintCast() && n->Opcode() == Op_CastPP)) {
 949       if (visited.test_set(n->_idx)) {
 950         assert(n->is_Phi(), "loops only through Phi's");
 951         continue;  // already processed
 952       }
 953       ptset.Clear();
 954       PointsTo(ptset, n, igvn);
 955       if (ptset.Size() == 1) {
 956         uint elem = ptset.getelem(); // Allocation node's index
 957         if (elem == _phantom_object)
 958           continue; // Assume the value was set outside this method.
 959         Node *val = get_map(elem);   // CheckCastPP node
 960         TypeNode *tn = n->as_Type();
 961         tinst = igvn->type(val)->isa_oopptr();
 962         assert(tinst != NULL && tinst->is_instance() &&
 963                tinst->instance_id() == elem , "instance type expected.");
 964 
 965         const TypeOopPtr *tn_t = NULL;
 966         const Type *tn_type = igvn->type(tn);
 967         if (tn_type->isa_narrowoop()) {
 968           tn_t = tn_type->is_narrowoop()->make_oopptr()->isa_oopptr();
 969         } else {
 970           tn_t = tn_type->isa_oopptr();
 971         }
 972 
 973         if (tn_t != NULL &&
 974  tinst->cast_to_instance(TypeOopPtr::UNKNOWN_INSTANCE)->higher_equal(tn_t)) {
 975           if (tn_type->isa_narrowoop()) {
 976             tn_type = tinst->make_narrowoop();
 977           } else {
 978             tn_type = tinst;
 979           }
 980           igvn->hash_delete(tn);
 981           igvn->set_type(tn, tn_type);
 982           tn->set_type(tn_type);
 983           igvn->hash_insert(tn);
 984           record_for_optimizer(n);
 985         }
 986       }
 987     } else {
 988       continue;
 989     }
 990     // push users on appropriate worklist
 991     for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) {


1904         // Treat Return value as LocalVar with GlobalEscape escape state.
1905         add_node(n, PointsToNode::LocalVar, PointsToNode::GlobalEscape, false);
1906         int ti = n->in(TypeFunc::Parms)->_idx;
1907         PointsToNode::NodeType nt = _nodes->adr_at(ti)->node_type();
1908         if (nt == PointsToNode::UnknownType) {
1909           _delayed_worklist.push(n); // Process it later.
1910           break;
1911         } else if (nt == PointsToNode::JavaObject) {
1912           add_pointsto_edge(n->_idx, ti);
1913         } else {
1914           add_deferred_edge(n->_idx, ti);
1915         }
1916       }
1917       _processed.set(n->_idx);
1918       break;
1919     }
1920     case Op_StoreP:
1921     case Op_StoreN:
1922     {
1923       const Type *adr_type = phase->type(n->in(MemNode::Address));
1924       if (adr_type->isa_narrowoop()) {
1925         adr_type = adr_type->is_narrowoop()->make_oopptr();
1926       }
1927       if (adr_type->isa_oopptr()) {
1928         add_node(n, PointsToNode::UnknownType, PointsToNode::UnknownEscape, false);
1929       } else {
1930         Node* adr = n->in(MemNode::Address);
1931         if (adr->is_AddP() && phase->type(adr) == TypeRawPtr::NOTNULL &&
1932             adr->in(AddPNode::Address)->is_Proj() &&
1933             adr->in(AddPNode::Address)->in(0)->is_Allocate()) {
1934           add_node(n, PointsToNode::UnknownType, PointsToNode::UnknownEscape, false);
1935           // We are computing a raw address for a store captured
1936           // by an Initialize compute an appropriate address type.
1937           int offs = (int)phase->find_intptr_t_con(adr->in(AddPNode::Offset), Type::OffsetBot);
1938           assert(offs != Type::OffsetBot, "offset must be a constant");
1939         } else {
1940           _processed.set(n->_idx);
1941           return;
1942         }
1943       }
1944       break;
1945     }
1946     case Op_StorePConditional:
1947     case Op_CompareAndSwapP:
1948     case Op_CompareAndSwapN:
1949     {
1950       const Type *adr_type = phase->type(n->in(MemNode::Address));
1951       if (adr_type->isa_narrowoop()) {
1952         adr_type = adr_type->is_narrowoop()->make_oopptr();
1953       }
1954       if (adr_type->isa_oopptr()) {
1955         add_node(n, PointsToNode::UnknownType, PointsToNode::UnknownEscape, false);
1956       } else {
1957         _processed.set(n->_idx);
1958         return;
1959       }
1960       break;
1961     }
1962     case Op_ThreadLocal:
1963     {
1964       add_node(n, PointsToNode::JavaObject, PointsToNode::ArgEscape, true);
1965       break;
1966     }
1967     default:
1968       ;
1969       // nothing to do
1970   }
1971   return;
1972 }
1973 


2114           !phase->type(n->in(TypeFunc::Parms))->isa_oopptr() ) {
2115         assert(false, "Op_Return");
2116       }
2117 #endif
2118       int ti = n->in(TypeFunc::Parms)->_idx;
2119       if (_nodes->adr_at(ti)->node_type() == PointsToNode::JavaObject) {
2120         add_pointsto_edge(n->_idx, ti);
2121       } else {
2122         add_deferred_edge(n->_idx, ti);
2123       }
2124       _processed.set(n->_idx);
2125       break;
2126     }
2127     case Op_StoreP:
2128     case Op_StoreN:
2129     case Op_StorePConditional:
2130     case Op_CompareAndSwapP:
2131     case Op_CompareAndSwapN:
2132     {
2133       Node *adr = n->in(MemNode::Address);
2134       const Type *adr_type = phase->type(adr);
2135       if (adr_type->isa_narrowoop()) {
2136         adr_type = adr_type->is_narrowoop()->make_oopptr();
2137       }
2138 #ifdef ASSERT
2139       if (!adr_type->isa_oopptr())
2140         assert(phase->type(adr) == TypeRawPtr::NOTNULL, "Op_StoreP");
2141 #endif
2142 
2143       assert(adr->is_AddP(), "expecting an AddP");
2144       Node *adr_base = get_addp_base(adr);
2145       Node *val = n->in(MemNode::ValueIn)->uncast();
2146       // For everything "adr_base" could point to, create a deferred edge
2147       // to "val" from each field with the same offset.
2148       VectorSet ptset(Thread::current()->resource_area());
2149       PointsTo(ptset, adr_base, phase);
2150       for( VectorSetI i(&ptset); i.test(); ++i ) {
2151         uint pt = i.elem;
2152         add_edge_from_fields(pt, val->_idx, address_offset(adr, phase));
2153       }
2154       break;
2155     }
2156     case Op_ThreadLocal:
2157     {




 945                n->is_CheckCastPP() ||
 946                n->is_EncodeP() ||
 947                n->is_DecodeN() ||
 948                (n->is_ConstraintCast() && n->Opcode() == Op_CastPP)) {
 949       if (visited.test_set(n->_idx)) {
 950         assert(n->is_Phi(), "loops only through Phi's");
 951         continue;  // already processed
 952       }
 953       ptset.Clear();
 954       PointsTo(ptset, n, igvn);
 955       if (ptset.Size() == 1) {
 956         uint elem = ptset.getelem(); // Allocation node's index
 957         if (elem == _phantom_object)
 958           continue; // Assume the value was set outside this method.
 959         Node *val = get_map(elem);   // CheckCastPP node
 960         TypeNode *tn = n->as_Type();
 961         tinst = igvn->type(val)->isa_oopptr();
 962         assert(tinst != NULL && tinst->is_instance() &&
 963                tinst->instance_id() == elem , "instance type expected.");
 964 

 965         const Type *tn_type = igvn->type(tn);
 966         const TypeOopPtr *tn_t = tn_type->make_ptr()->isa_oopptr();




 967 
 968         if (tn_t != NULL &&
 969  tinst->cast_to_instance(TypeOopPtr::UNKNOWN_INSTANCE)->higher_equal(tn_t)) {
 970           if (tn_type->isa_narrowoop()) {
 971             tn_type = tinst->make_narrowoop();
 972           } else {
 973             tn_type = tinst;
 974           }
 975           igvn->hash_delete(tn);
 976           igvn->set_type(tn, tn_type);
 977           tn->set_type(tn_type);
 978           igvn->hash_insert(tn);
 979           record_for_optimizer(n);
 980         }
 981       }
 982     } else {
 983       continue;
 984     }
 985     // push users on appropriate worklist
 986     for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) {


1899         // Treat Return value as LocalVar with GlobalEscape escape state.
1900         add_node(n, PointsToNode::LocalVar, PointsToNode::GlobalEscape, false);
1901         int ti = n->in(TypeFunc::Parms)->_idx;
1902         PointsToNode::NodeType nt = _nodes->adr_at(ti)->node_type();
1903         if (nt == PointsToNode::UnknownType) {
1904           _delayed_worklist.push(n); // Process it later.
1905           break;
1906         } else if (nt == PointsToNode::JavaObject) {
1907           add_pointsto_edge(n->_idx, ti);
1908         } else {
1909           add_deferred_edge(n->_idx, ti);
1910         }
1911       }
1912       _processed.set(n->_idx);
1913       break;
1914     }
1915     case Op_StoreP:
1916     case Op_StoreN:
1917     {
1918       const Type *adr_type = phase->type(n->in(MemNode::Address));
1919       adr_type = adr_type->make_ptr();


1920       if (adr_type->isa_oopptr()) {
1921         add_node(n, PointsToNode::UnknownType, PointsToNode::UnknownEscape, false);
1922       } else {
1923         Node* adr = n->in(MemNode::Address);
1924         if (adr->is_AddP() && phase->type(adr) == TypeRawPtr::NOTNULL &&
1925             adr->in(AddPNode::Address)->is_Proj() &&
1926             adr->in(AddPNode::Address)->in(0)->is_Allocate()) {
1927           add_node(n, PointsToNode::UnknownType, PointsToNode::UnknownEscape, false);
1928           // We are computing a raw address for a store captured
1929           // by an Initialize compute an appropriate address type.
1930           int offs = (int)phase->find_intptr_t_con(adr->in(AddPNode::Offset), Type::OffsetBot);
1931           assert(offs != Type::OffsetBot, "offset must be a constant");
1932         } else {
1933           _processed.set(n->_idx);
1934           return;
1935         }
1936       }
1937       break;
1938     }
1939     case Op_StorePConditional:
1940     case Op_CompareAndSwapP:
1941     case Op_CompareAndSwapN:
1942     {
1943       const Type *adr_type = phase->type(n->in(MemNode::Address));
1944       adr_type = adr_type->make_ptr();


1945       if (adr_type->isa_oopptr()) {
1946         add_node(n, PointsToNode::UnknownType, PointsToNode::UnknownEscape, false);
1947       } else {
1948         _processed.set(n->_idx);
1949         return;
1950       }
1951       break;
1952     }
1953     case Op_ThreadLocal:
1954     {
1955       add_node(n, PointsToNode::JavaObject, PointsToNode::ArgEscape, true);
1956       break;
1957     }
1958     default:
1959       ;
1960       // nothing to do
1961   }
1962   return;
1963 }
1964 


2105           !phase->type(n->in(TypeFunc::Parms))->isa_oopptr() ) {
2106         assert(false, "Op_Return");
2107       }
2108 #endif
2109       int ti = n->in(TypeFunc::Parms)->_idx;
2110       if (_nodes->adr_at(ti)->node_type() == PointsToNode::JavaObject) {
2111         add_pointsto_edge(n->_idx, ti);
2112       } else {
2113         add_deferred_edge(n->_idx, ti);
2114       }
2115       _processed.set(n->_idx);
2116       break;
2117     }
2118     case Op_StoreP:
2119     case Op_StoreN:
2120     case Op_StorePConditional:
2121     case Op_CompareAndSwapP:
2122     case Op_CompareAndSwapN:
2123     {
2124       Node *adr = n->in(MemNode::Address);
2125       const Type *adr_type = phase->type(adr)->make_ptr();



2126 #ifdef ASSERT
2127       if (!adr_type->isa_oopptr())
2128         assert(phase->type(adr) == TypeRawPtr::NOTNULL, "Op_StoreP");
2129 #endif
2130 
2131       assert(adr->is_AddP(), "expecting an AddP");
2132       Node *adr_base = get_addp_base(adr);
2133       Node *val = n->in(MemNode::ValueIn)->uncast();
2134       // For everything "adr_base" could point to, create a deferred edge
2135       // to "val" from each field with the same offset.
2136       VectorSet ptset(Thread::current()->resource_area());
2137       PointsTo(ptset, adr_base, phase);
2138       for( VectorSetI i(&ptset); i.test(); ++i ) {
2139         uint pt = i.elem;
2140         add_edge_from_fields(pt, val->_idx, address_offset(adr, phase));
2141       }
2142       break;
2143     }
2144     case Op_ThreadLocal:
2145     {


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