< prev index next >

src/hotspot/share/opto/memnode.cpp

Print this page
rev 55127 : 8223351: [lworld] Primary mirror and nullable mirror for inline type
Reviewed-by: tbd


1837 #endif
1838         return jt;
1839       }
1840     }
1841   } else if (tp->base() == Type::InstPtr) {
1842     assert( off != Type::OffsetBot ||
1843             // arrays can be cast to Objects
1844             tp->is_oopptr()->klass()->is_java_lang_Object() ||
1845             tp->is_oopptr()->klass() == ciEnv::current()->Class_klass() ||
1846             // unsafe field access may not have a constant offset
1847             C->has_unsafe_access(),
1848             "Field accesses must be precise" );
1849     // For oop loads, we expect the _type to be precise.
1850 
1851     const TypeInstPtr* tinst = tp->is_instptr();
1852     BasicType bt = memory_type();
1853 
1854     // Fold component and value mirror loads
1855     ciInstanceKlass* ik = tinst->klass()->as_instance_klass();
1856     if (ik == phase->C->env()->Class_klass() && (off == java_lang_Class::component_mirror_offset_in_bytes() ||
1857                                                  off == java_lang_Class::value_mirror_offset_in_bytes())) {
1858       ciType* mirror_type = tinst->java_mirror_type();
1859       if (mirror_type != NULL) {
1860         const Type* const_oop = TypePtr::NULL_PTR;
1861         if (mirror_type->is_array_klass()) {
1862           const_oop = TypeInstPtr::make(mirror_type->as_array_klass()->component_mirror_instance());
1863         } else if (mirror_type->is_valuetype()) {
1864           const_oop = TypeInstPtr::make(mirror_type->as_value_klass()->value_mirror_instance());
1865         }
1866         return (bt == T_NARROWOOP) ? const_oop->make_narrowoop() : const_oop;
1867       }
1868     }
1869 
1870     // Optimize loads from constant fields.
1871     ciObject* const_oop = tinst->const_oop();
1872     if (!is_mismatched_access() && off != Type::OffsetBot && const_oop != NULL && const_oop->is_instance()) {
1873       ciType* mirror_type = const_oop->as_instance()->java_mirror_type();
1874       if (mirror_type != NULL && mirror_type->is_valuetype()) {
1875         ciValueKlass* vk = mirror_type->as_value_klass();
1876         if (off == vk->default_value_offset()) {
1877           // Loading a special hidden field that contains the oop of the default value type




1837 #endif
1838         return jt;
1839       }
1840     }
1841   } else if (tp->base() == Type::InstPtr) {
1842     assert( off != Type::OffsetBot ||
1843             // arrays can be cast to Objects
1844             tp->is_oopptr()->klass()->is_java_lang_Object() ||
1845             tp->is_oopptr()->klass() == ciEnv::current()->Class_klass() ||
1846             // unsafe field access may not have a constant offset
1847             C->has_unsafe_access(),
1848             "Field accesses must be precise" );
1849     // For oop loads, we expect the _type to be precise.
1850 
1851     const TypeInstPtr* tinst = tp->is_instptr();
1852     BasicType bt = memory_type();
1853 
1854     // Fold component and value mirror loads
1855     ciInstanceKlass* ik = tinst->klass()->as_instance_klass();
1856     if (ik == phase->C->env()->Class_klass() && (off == java_lang_Class::component_mirror_offset_in_bytes() ||
1857                                                  off == java_lang_Class::inline_mirror_offset_in_bytes())) {
1858       ciType* mirror_type = tinst->java_mirror_type();
1859       if (mirror_type != NULL) {
1860         const Type* const_oop = TypePtr::NULL_PTR;
1861         if (mirror_type->is_array_klass()) {
1862           const_oop = TypeInstPtr::make(mirror_type->as_array_klass()->component_mirror_instance());
1863         } else if (mirror_type->is_valuetype()) {
1864           const_oop = TypeInstPtr::make(mirror_type->as_value_klass()->value_mirror_instance());
1865         }
1866         return (bt == T_NARROWOOP) ? const_oop->make_narrowoop() : const_oop;
1867       }
1868     }
1869 
1870     // Optimize loads from constant fields.
1871     ciObject* const_oop = tinst->const_oop();
1872     if (!is_mismatched_access() && off != Type::OffsetBot && const_oop != NULL && const_oop->is_instance()) {
1873       ciType* mirror_type = const_oop->as_instance()->java_mirror_type();
1874       if (mirror_type != NULL && mirror_type->is_valuetype()) {
1875         ciValueKlass* vk = mirror_type->as_value_klass();
1876         if (off == vk->default_value_offset()) {
1877           // Loading a special hidden field that contains the oop of the default value type


< prev index next >