1696 if (phase->C->eliminate_boxing() && adr->is_AddP()) { 1697 // The pointers in the autobox arrays are always non-null 1698 Node* base = adr->in(AddPNode::Base); 1699 if ((base != NULL) && base->is_DecodeN()) { 1700 // Get LoadN node which loads IntegerCache.cache field 1701 base = base->in(1); 1702 } 1703 if ((base != NULL) && base->is_Con()) { 1704 const TypeAryPtr* base_type = base->bottom_type()->isa_aryptr(); 1705 if ((base_type != NULL) && base_type->is_autobox_cache()) { 1706 // It could be narrow oop 1707 assert(jt->make_ptr()->ptr() == TypePtr::NotNull,"sanity"); 1708 } 1709 } 1710 } 1711 #endif 1712 return jt; 1713 } 1714 } 1715 } else if (tp->base() == Type::InstPtr) { 1716 ciEnv* env = C->env(); 1717 const TypeInstPtr* tinst = tp->is_instptr(); 1718 ciKlass* klass = tinst->klass(); 1719 assert( off != Type::OffsetBot || 1720 // arrays can be cast to Objects 1721 tp->is_oopptr()->klass()->is_java_lang_Object() || 1722 // unsafe field access may not have a constant offset 1723 C->has_unsafe_access(), 1724 "Field accesses must be precise" ); 1725 // For oop loads, we expect the _type to be precise. 1726 // Optimizations for constant objects 1727 ciObject* const_oop = tinst->const_oop(); 1728 if (const_oop != NULL && const_oop->is_instance()) { 1729 const Type* con_type = Type::make_constant_from_field(const_oop->as_instance(), off, is_unsigned(), memory_type()); 1730 if (con_type != NULL) { 1731 return con_type; 1732 } 1733 } 1734 } else if (tp->base() == Type::KlassPtr) { 1735 assert( off != Type::OffsetBot || 1736 // arrays can be cast to Objects 1737 tp->is_klassptr()->klass()->is_java_lang_Object() || 1738 // also allow array-loading from the primary supertype 1739 // array during subtype checks 1740 Opcode() == Op_LoadKlass, 1741 "Field accesses must be precise" ); 1742 // For klass/static loads, we expect the _type to be precise 1743 } 1744 1745 const TypeKlassPtr *tkls = tp->isa_klassptr(); 1746 if (tkls != NULL && !StressReflectiveCode) { 1747 ciKlass* klass = tkls->klass(); 1748 if (klass->is_loaded() && tkls->klass_is_exact()) { | 1696 if (phase->C->eliminate_boxing() && adr->is_AddP()) { 1697 // The pointers in the autobox arrays are always non-null 1698 Node* base = adr->in(AddPNode::Base); 1699 if ((base != NULL) && base->is_DecodeN()) { 1700 // Get LoadN node which loads IntegerCache.cache field 1701 base = base->in(1); 1702 } 1703 if ((base != NULL) && base->is_Con()) { 1704 const TypeAryPtr* base_type = base->bottom_type()->isa_aryptr(); 1705 if ((base_type != NULL) && base_type->is_autobox_cache()) { 1706 // It could be narrow oop 1707 assert(jt->make_ptr()->ptr() == TypePtr::NotNull,"sanity"); 1708 } 1709 } 1710 } 1711 #endif 1712 return jt; 1713 } 1714 } 1715 } else if (tp->base() == Type::InstPtr) { 1716 assert( off != Type::OffsetBot || 1717 // arrays can be cast to Objects 1718 tp->is_oopptr()->klass()->is_java_lang_Object() || 1719 // unsafe field access may not have a constant offset 1720 C->has_unsafe_access(), 1721 "Field accesses must be precise" ); 1722 // For oop loads, we expect the _type to be precise. 1723 1724 // Optimize loads from constant fields. 1725 const TypeInstPtr* tinst = tp->is_instptr(); 1726 ciObject* const_oop = tinst->const_oop(); 1727 if (!is_mismatched_access() && off != Type::OffsetBot && const_oop != NULL && const_oop->is_instance()) { 1728 const Type* con_type = Type::make_constant_from_field(const_oop->as_instance(), off, is_unsigned(), memory_type()); 1729 if (con_type != NULL) { 1730 return con_type; 1731 } 1732 } 1733 } else if (tp->base() == Type::KlassPtr) { 1734 assert( off != Type::OffsetBot || 1735 // arrays can be cast to Objects 1736 tp->is_klassptr()->klass()->is_java_lang_Object() || 1737 // also allow array-loading from the primary supertype 1738 // array during subtype checks 1739 Opcode() == Op_LoadKlass, 1740 "Field accesses must be precise" ); 1741 // For klass/static loads, we expect the _type to be precise 1742 } 1743 1744 const TypeKlassPtr *tkls = tp->isa_klassptr(); 1745 if (tkls != NULL && !StressReflectiveCode) { 1746 ciKlass* klass = tkls->klass(); 1747 if (klass->is_loaded() && tkls->klass_is_exact()) { |