< prev index next >

src/share/vm/opto/escape.cpp

Print this page




1999   BasicType bt = T_INT;
2000   if (offset == Type::OffsetBot) {
2001     // Check only oop fields.
2002     if (!adr_type->isa_aryptr() ||
2003         (adr_type->isa_aryptr()->klass() == NULL) ||
2004          adr_type->isa_aryptr()->klass()->is_obj_array_klass()) {
2005       // OffsetBot is used to reference array's element. Ignore first AddP.
2006       if (find_second_addp(n, n->in(AddPNode::Base)) == NULL) {
2007         bt = T_OBJECT;
2008       }
2009     }
2010   } else if (offset != oopDesc::klass_offset_in_bytes()) {
2011     if (adr_type->isa_instptr()) {
2012       ciField* field = _compile->alias_type(adr_type->isa_instptr())->field();
2013       if (field != NULL) {
2014         bt = field->layout_type();
2015       } else {
2016         // Check for unsafe oop field access
2017         for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) {
2018           int opcode = n->fast_out(i)->Opcode();
2019           if (opcode == Op_StoreP || opcode == Op_LoadP ||
2020               opcode == Op_StoreN || opcode == Op_LoadN) {


2021             bt = T_OBJECT;
2022             (*unsafe) = true;
2023             break;
2024           }
2025         }
2026       }
2027     } else if (adr_type->isa_aryptr()) {
2028       if (offset == arrayOopDesc::length_offset_in_bytes()) {
2029         // Ignore array length load.
2030       } else if (find_second_addp(n, n->in(AddPNode::Base)) != NULL) {
2031         // Ignore first AddP.
2032       } else {
2033         const Type* elemtype = adr_type->isa_aryptr()->elem();
2034         bt = elemtype->array_element_basic_type();
2035       }
2036     } else if (adr_type->isa_rawptr() || adr_type->isa_klassptr()) {
2037       // Allocation initialization, ThreadLocal field access, unsafe access
2038       for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) {
2039         int opcode = n->fast_out(i)->Opcode();
2040         if (opcode == Op_StoreP || opcode == Op_LoadP ||
2041             opcode == Op_StoreN || opcode == Op_LoadN) {


2042           bt = T_OBJECT;
2043           break;
2044         }
2045       }
2046     }
2047   }
2048   return (bt == T_OBJECT || bt == T_NARROWOOP || bt == T_ARRAY);
2049 }
2050 
2051 // Returns unique pointed java object or NULL.
2052 JavaObjectNode* ConnectionGraph::unique_java_object(Node *n) {
2053   assert(!_collecting, "should not call when contructed graph");
2054   // If the node was created after the escape computation we can't answer.
2055   uint idx = n->_idx;
2056   if (idx >= nodes_size()) {
2057     return NULL;
2058   }
2059   PointsToNode* ptn = ptnode_adr(idx);
2060   if (ptn->is_JavaObject()) {
2061     return ptn->as_JavaObject();




1999   BasicType bt = T_INT;
2000   if (offset == Type::OffsetBot) {
2001     // Check only oop fields.
2002     if (!adr_type->isa_aryptr() ||
2003         (adr_type->isa_aryptr()->klass() == NULL) ||
2004          adr_type->isa_aryptr()->klass()->is_obj_array_klass()) {
2005       // OffsetBot is used to reference array's element. Ignore first AddP.
2006       if (find_second_addp(n, n->in(AddPNode::Base)) == NULL) {
2007         bt = T_OBJECT;
2008       }
2009     }
2010   } else if (offset != oopDesc::klass_offset_in_bytes()) {
2011     if (adr_type->isa_instptr()) {
2012       ciField* field = _compile->alias_type(adr_type->isa_instptr())->field();
2013       if (field != NULL) {
2014         bt = field->layout_type();
2015       } else {
2016         // Check for unsafe oop field access
2017         for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) {
2018           int opcode = n->fast_out(i)->Opcode();
2019           if (opcode == Op_StoreP          || opcode == Op_StoreN ||
2020               opcode == Op_LoadP           || opcode == Op_LoadN  ||
2021               opcode == Op_GetAndSetP      || opcode == Op_GetAndSetN ||
2022               opcode == Op_CompareAndSwapP || opcode == Op_CompareAndSwapN) {
2023             bt = T_OBJECT;
2024             (*unsafe) = true;
2025             break;
2026           }
2027         }
2028       }
2029     } else if (adr_type->isa_aryptr()) {
2030       if (offset == arrayOopDesc::length_offset_in_bytes()) {
2031         // Ignore array length load.
2032       } else if (find_second_addp(n, n->in(AddPNode::Base)) != NULL) {
2033         // Ignore first AddP.
2034       } else {
2035         const Type* elemtype = adr_type->isa_aryptr()->elem();
2036         bt = elemtype->array_element_basic_type();
2037       }
2038     } else if (adr_type->isa_rawptr() || adr_type->isa_klassptr()) {
2039       // Allocation initialization, ThreadLocal field access, unsafe access
2040       for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) {
2041         int opcode = n->fast_out(i)->Opcode();
2042         if (opcode == Op_StoreP          || opcode == Op_StoreN ||
2043             opcode == Op_LoadP           || opcode == Op_LoadN  ||
2044             opcode == Op_GetAndSetP      || opcode == Op_GetAndSetN ||
2045             opcode == Op_CompareAndSwapP || opcode == Op_CompareAndSwapN) {
2046           bt = T_OBJECT;
2047           break;
2048         }
2049       }
2050     }
2051   }
2052   return (bt == T_OBJECT || bt == T_NARROWOOP || bt == T_ARRAY);
2053 }
2054 
2055 // Returns unique pointed java object or NULL.
2056 JavaObjectNode* ConnectionGraph::unique_java_object(Node *n) {
2057   assert(!_collecting, "should not call when contructed graph");
2058   // If the node was created after the escape computation we can't answer.
2059   uint idx = n->_idx;
2060   if (idx >= nodes_size()) {
2061     return NULL;
2062   }
2063   PointsToNode* ptn = ptnode_adr(idx);
2064   if (ptn->is_JavaObject()) {
2065     return ptn->as_JavaObject();


< prev index next >