< prev index next >

src/hotspot/share/opto/escape.cpp

Print this page



2096       }
2097     } else if (adr_type->isa_aryptr()) {
2098       if (offset == arrayOopDesc::length_offset_in_bytes()) {
2099         // Ignore array length load.
2100       } else if (find_second_addp(n, n->in(AddPNode::Base)) != NULL) {
2101         // Ignore first AddP.
2102       } else {
2103         const Type* elemtype = adr_type->isa_aryptr()->elem();
2104         bt = elemtype->array_element_basic_type();
2105       }
2106     } else if (adr_type->isa_rawptr() || adr_type->isa_klassptr()) {
2107       // Allocation initialization, ThreadLocal field access, unsafe access
2108       if (n->has_out_with(Op_StoreP, Op_LoadP, Op_StoreN, Op_LoadN) ||
2109           n->has_out_with(Op_GetAndSetP, Op_GetAndSetN, Op_CompareAndExchangeP, Op_CompareAndExchangeN) ||
2110           n->has_out_with(Op_CompareAndSwapP, Op_CompareAndSwapN, Op_WeakCompareAndSwapP, Op_WeakCompareAndSwapN) ||
2111           BarrierSet::barrier_set()->barrier_set_c2()->escape_has_out_with_unsafe_object(n)) {
2112         bt = T_OBJECT;
2113       }
2114     }
2115   }
2116   return (bt == T_OBJECT || bt == T_NARROWOOP || bt == T_ARRAY);

2117 }
2118 
2119 // Returns unique pointed java object or NULL.
2120 JavaObjectNode* ConnectionGraph::unique_java_object(Node *n) {
2121   assert(!_collecting, "should not call when contructed graph");
2122   // If the node was created after the escape computation we can't answer.
2123   uint idx = n->_idx;
2124   if (idx >= nodes_size()) {
2125     return NULL;
2126   }
2127   PointsToNode* ptn = ptnode_adr(idx);
2128   if (ptn == NULL) {
2129     return NULL;
2130   }
2131   if (ptn->is_JavaObject()) {
2132     return ptn->as_JavaObject();
2133   }
2134   assert(ptn->is_LocalVar(), "sanity");
2135   // Check all java objects it points to.
2136   JavaObjectNode* jobj = NULL;



2096       }
2097     } else if (adr_type->isa_aryptr()) {
2098       if (offset == arrayOopDesc::length_offset_in_bytes()) {
2099         // Ignore array length load.
2100       } else if (find_second_addp(n, n->in(AddPNode::Base)) != NULL) {
2101         // Ignore first AddP.
2102       } else {
2103         const Type* elemtype = adr_type->isa_aryptr()->elem();
2104         bt = elemtype->array_element_basic_type();
2105       }
2106     } else if (adr_type->isa_rawptr() || adr_type->isa_klassptr()) {
2107       // Allocation initialization, ThreadLocal field access, unsafe access
2108       if (n->has_out_with(Op_StoreP, Op_LoadP, Op_StoreN, Op_LoadN) ||
2109           n->has_out_with(Op_GetAndSetP, Op_GetAndSetN, Op_CompareAndExchangeP, Op_CompareAndExchangeN) ||
2110           n->has_out_with(Op_CompareAndSwapP, Op_CompareAndSwapN, Op_WeakCompareAndSwapP, Op_WeakCompareAndSwapN) ||
2111           BarrierSet::barrier_set()->barrier_set_c2()->escape_has_out_with_unsafe_object(n)) {
2112         bt = T_OBJECT;
2113       }
2114     }
2115   }
2116   // Note: T_NARROWOOP is not classed as a real reference type
2117   return (is_reference_type(bt) || bt == T_NARROWOOP);
2118 }
2119 
2120 // Returns unique pointed java object or NULL.
2121 JavaObjectNode* ConnectionGraph::unique_java_object(Node *n) {
2122   assert(!_collecting, "should not call when contructed graph");
2123   // If the node was created after the escape computation we can't answer.
2124   uint idx = n->_idx;
2125   if (idx >= nodes_size()) {
2126     return NULL;
2127   }
2128   PointsToNode* ptn = ptnode_adr(idx);
2129   if (ptn == NULL) {
2130     return NULL;
2131   }
2132   if (ptn->is_JavaObject()) {
2133     return ptn->as_JavaObject();
2134   }
2135   assert(ptn->is_LocalVar(), "sanity");
2136   // Check all java objects it points to.
2137   JavaObjectNode* jobj = NULL;


< prev index next >