2108 } else {
2109 const Type* elemtype = adr_type->isa_aryptr()->elem();
2110 if (elemtype->isa_valuetype() && field_offset != Type::OffsetBot) {
2111 ciValueKlass* vk = elemtype->is_valuetype()->value_klass();
2112 field_offset += vk->first_field_offset();
2113 bt = vk->get_field_by_offset(field_offset, false)->layout_type();
2114 } else {
2115 bt = elemtype->array_element_basic_type();
2116 }
2117 }
2118 } else if (adr_type->isa_rawptr() || adr_type->isa_klassptr()) {
2119 // Allocation initialization, ThreadLocal field access, unsafe access
2120 if (n->has_out_with(Op_StoreP, Op_LoadP, Op_StoreN, Op_LoadN) ||
2121 n->has_out_with(Op_GetAndSetP, Op_GetAndSetN, Op_CompareAndExchangeP, Op_CompareAndExchangeN) ||
2122 n->has_out_with(Op_CompareAndSwapP, Op_CompareAndSwapN, Op_WeakCompareAndSwapP, Op_WeakCompareAndSwapN) ||
2123 BarrierSet::barrier_set()->barrier_set_c2()->escape_has_out_with_unsafe_object(n)) {
2124 bt = T_OBJECT;
2125 }
2126 }
2127 }
2128 // TODO enable when using T_VALUETYPEPTR
2129 //assert(bt != T_VALUETYPE, "should not have valuetype here");
2130 return (bt == T_OBJECT || bt == T_VALUETYPE || bt == T_VALUETYPEPTR || bt == T_NARROWOOP || bt == T_ARRAY);
2131 }
2132
2133 // Returns unique pointed java object or NULL.
2134 JavaObjectNode* ConnectionGraph::unique_java_object(Node *n) {
2135 assert(!_collecting, "should not call when constructed graph");
2136 // If the node was created after the escape computation we can't answer.
2137 uint idx = n->_idx;
2138 if (idx >= nodes_size()) {
2139 return NULL;
2140 }
2141 PointsToNode* ptn = ptnode_adr(idx);
2142 if (ptn->is_JavaObject()) {
2143 return ptn->as_JavaObject();
2144 }
2145 assert(ptn->is_LocalVar(), "sanity");
2146 // Check all java objects it points to.
2147 JavaObjectNode* jobj = NULL;
2148 for (EdgeIterator i(ptn); i.has_next(); i.next()) {
2149 PointsToNode* e = i.get();
2150 if (e->is_JavaObject()) {
|
2108 } else {
2109 const Type* elemtype = adr_type->isa_aryptr()->elem();
2110 if (elemtype->isa_valuetype() && field_offset != Type::OffsetBot) {
2111 ciValueKlass* vk = elemtype->is_valuetype()->value_klass();
2112 field_offset += vk->first_field_offset();
2113 bt = vk->get_field_by_offset(field_offset, false)->layout_type();
2114 } else {
2115 bt = elemtype->array_element_basic_type();
2116 }
2117 }
2118 } else if (adr_type->isa_rawptr() || adr_type->isa_klassptr()) {
2119 // Allocation initialization, ThreadLocal field access, unsafe access
2120 if (n->has_out_with(Op_StoreP, Op_LoadP, Op_StoreN, Op_LoadN) ||
2121 n->has_out_with(Op_GetAndSetP, Op_GetAndSetN, Op_CompareAndExchangeP, Op_CompareAndExchangeN) ||
2122 n->has_out_with(Op_CompareAndSwapP, Op_CompareAndSwapN, Op_WeakCompareAndSwapP, Op_WeakCompareAndSwapN) ||
2123 BarrierSet::barrier_set()->barrier_set_c2()->escape_has_out_with_unsafe_object(n)) {
2124 bt = T_OBJECT;
2125 }
2126 }
2127 }
2128 return (bt == T_OBJECT || bt == T_VALUETYPE || bt == T_NARROWOOP || bt == T_ARRAY);
2129 }
2130
2131 // Returns unique pointed java object or NULL.
2132 JavaObjectNode* ConnectionGraph::unique_java_object(Node *n) {
2133 assert(!_collecting, "should not call when constructed graph");
2134 // If the node was created after the escape computation we can't answer.
2135 uint idx = n->_idx;
2136 if (idx >= nodes_size()) {
2137 return NULL;
2138 }
2139 PointsToNode* ptn = ptnode_adr(idx);
2140 if (ptn->is_JavaObject()) {
2141 return ptn->as_JavaObject();
2142 }
2143 assert(ptn->is_LocalVar(), "sanity");
2144 // Check all java objects it points to.
2145 JavaObjectNode* jobj = NULL;
2146 for (EdgeIterator i(ptn); i.has_next(); i.next()) {
2147 PointsToNode* e = i.get();
2148 if (e->is_JavaObject()) {
|