--- old/src/share/vm/opto/library_call.cpp 2016-06-29 15:34:14.000000000 +0300 +++ new/src/share/vm/opto/library_call.cpp 2016-06-29 15:34:14.000000000 +0300 @@ -2424,6 +2424,8 @@ return false; } mismatched = (bt != type); + } else if (alias_type->adr_type() == TypeOopPtr::BOTTOM) { + mismatched = true; // conservatively mark all "wide" on-heap accesses as mismatched } // First guess at the value type. --- old/src/share/vm/opto/memnode.cpp 2016-06-29 15:34:15.000000000 +0300 +++ new/src/share/vm/opto/memnode.cpp 2016-06-29 15:34:15.000000000 +0300 @@ -1713,9 +1713,6 @@ } } } else if (tp->base() == Type::InstPtr) { - ciEnv* env = C->env(); - const TypeInstPtr* tinst = tp->is_instptr(); - ciKlass* klass = tinst->klass(); assert( off != Type::OffsetBot || // arrays can be cast to Objects tp->is_oopptr()->klass()->is_java_lang_Object() || @@ -1723,9 +1720,11 @@ C->has_unsafe_access(), "Field accesses must be precise" ); // For oop loads, we expect the _type to be precise. - // Optimizations for constant objects + + // Optimize loads from constant fields. + const TypeInstPtr* tinst = tp->is_instptr(); ciObject* const_oop = tinst->const_oop(); - if (const_oop != NULL && const_oop->is_instance()) { + if (!is_mismatched_access() && off != Type::OffsetBot && const_oop != NULL && const_oop->is_instance()) { const Type* con_type = Type::make_constant_from_field(const_oop->as_instance(), off, is_unsigned(), memory_type()); if (con_type != NULL) { return con_type; --- old/src/share/vm/opto/type.hpp 2016-06-29 15:34:16.000000000 +0300 +++ new/src/share/vm/opto/type.hpp 2016-06-29 15:34:16.000000000 +0300 @@ -936,7 +936,7 @@ }; //------------------------------TypeOopPtr------------------------------------- -// Some kind of oop (Java pointer), either klass or instance or array. +// Some kind of oop (Java pointer), either instance or array. class TypeOopPtr : public TypePtr { protected: TypeOopPtr(TYPES t, PTR ptr, ciKlass* k, bool xk, ciObject* o, int offset, int instance_id,