--- old/src/share/vm/opto/type.cpp 2017-05-05 11:33:42.426987684 +0200 +++ new/src/share/vm/opto/type.cpp 2017-05-05 11:33:42.290987688 +0200 @@ -2996,7 +2996,7 @@ const TypeOopPtr *TypeOopPtr::BOTTOM; //------------------------------TypeOopPtr------------------------------------- -TypeOopPtr::TypeOopPtr(TYPES t, PTR ptr, ciKlass* k, bool xk, ciObject* o, Offset offset, +TypeOopPtr::TypeOopPtr(TYPES t, PTR ptr, ciKlass* k, bool xk, ciObject* o, Offset offset, Offset field_offset, int instance_id, const TypePtr* speculative, int inline_depth) : TypePtr(t, ptr, offset, speculative, inline_depth), _const_oop(o), _klass(k), @@ -3017,9 +3017,19 @@ // Array with unknown body type assert(this->isa_aryptr(), "only arrays without klass"); _is_ptr_to_narrowoop = UseCompressedOops; - } else if (this->isa_aryptr()) { - _is_ptr_to_narrowoop = (UseCompressedOops && klass()->is_obj_array_klass() && - this->offset() != arrayOopDesc::length_offset_in_bytes()); + } else if (UseCompressedOops && this->isa_aryptr() && this->offset() != arrayOopDesc::length_offset_in_bytes()) { + if (klass()->is_obj_array_klass()) { + _is_ptr_to_narrowoop = true; + } else if (klass()->is_value_array_klass() && field_offset != Offset::top && field_offset != Offset::bottom) { + // Check if the field of the value type array element contains oops + ciValueKlass* vk = klass()->as_value_array_klass()->element_klass()->as_value_klass(); + int foffset = field_offset.get() + vk->first_field_offset(); + ciField* field = vk->get_field_by_offset(foffset, false); + assert(field != NULL, "missing field"); + BasicType bt = field->layout_type(); + assert(bt != T_VALUETYPE, "should be flattened"); + _is_ptr_to_narrowoop = (bt == T_OBJECT || bt == T_ARRAY); + } } else if (klass()->is_instance_klass()) { ciInstanceKlass* ik = klass()->as_instance_klass(); ciField* field = NULL; @@ -3076,7 +3086,7 @@ ciKlass* k = Compile::current()->env()->Object_klass(); bool xk = false; ciObject* o = NULL; - return (TypeOopPtr*)(new TypeOopPtr(OopPtr, ptr, k, xk, o, offset, instance_id, speculative, inline_depth))->hashcons(); + return (TypeOopPtr*)(new TypeOopPtr(OopPtr, ptr, k, xk, o, offset, Offset::bottom, instance_id, speculative, inline_depth))->hashcons(); } @@ -3192,7 +3202,7 @@ const Type *TypeOopPtr::xdual() const { assert(klass() == Compile::current()->env()->Object_klass(), "no klasses here"); assert(const_oop() == NULL, "no constants here"); - return new TypeOopPtr(_base, dual_ptr(), klass(), klass_is_exact(), const_oop(), dual_offset(), dual_instance_id(), dual_speculative(), dual_inline_depth()); + return new TypeOopPtr(_base, dual_ptr(), klass(), klass_is_exact(), const_oop(), dual_offset(), Offset::bottom, dual_instance_id(), dual_speculative(), dual_inline_depth()); } //--------------------------make_from_klass_common----------------------------- @@ -3527,7 +3537,7 @@ //------------------------------TypeInstPtr------------------------------------- TypeInstPtr::TypeInstPtr(PTR ptr, ciKlass* k, bool xk, ciObject* o, Offset off, int instance_id, const TypePtr* speculative, int inline_depth) - : TypeOopPtr(InstPtr, ptr, k, xk, o, off, instance_id, speculative, inline_depth), + : TypeOopPtr(InstPtr, ptr, k, xk, o, off, Offset::bottom, instance_id, speculative, inline_depth), _name(k->name()) { assert(k != NULL && (k->is_loaded() || o == NULL), @@ -3711,7 +3721,7 @@ // below the centerline when the superclass is exact. We need to // do the same here. if (klass()->equals(ciEnv::current()->Object_klass()) && !klass_is_exact()) { - return TypeAryPtr::make(ptr, tp->ary(), tp->klass(), tp->klass_is_exact(), offset, tp->_field_offset, instance_id, speculative, depth); + return TypeAryPtr::make(ptr, tp->ary(), tp->klass(), tp->klass_is_exact(), offset, tp->field_offset(), instance_id, speculative, depth); } else { // cannot subclass, so the meet has to fall badly below the centerline ptr = NotNull; @@ -3731,7 +3741,7 @@ if (klass()->equals(ciEnv::current()->Object_klass()) && !klass_is_exact()) { // that is, tp's array type is a subtype of my klass return TypeAryPtr::make(ptr, (ptr == Constant ? tp->const_oop() : NULL), - tp->ary(), tp->klass(), tp->klass_is_exact(), offset, tp->_field_offset, instance_id, speculative, depth); + tp->ary(), tp->klass(), tp->klass_is_exact(), offset, tp->field_offset(), instance_id, speculative, depth); } } // The other case cannot happen, since I cannot be a subtype of an array. @@ -4254,7 +4264,7 @@ //------------------------------hash------------------------------------------- // Type-specific hashing function. int TypeAryPtr::hash(void) const { - return (intptr_t)_ary + TypeOopPtr::hash() + field_offset(); + return (intptr_t)_ary + TypeOopPtr::hash() + _field_offset.get(); } //------------------------------meet------------------------------------------- @@ -4440,7 +4450,7 @@ // cannot subclass, so the meet has to fall badly below the centerline ptr = NotNull; instance_id = InstanceBot; - return TypeInstPtr::make(ptr, ciEnv::current()->Object_klass(), false, NULL,offset, instance_id, speculative, depth); + return TypeInstPtr::make(ptr, ciEnv::current()->Object_klass(), false, NULL, offset, instance_id, speculative, depth); } case Constant: case NotNull: @@ -4474,11 +4484,11 @@ //------------------------------xdual------------------------------------------ // Dual: compute field-by-field dual const Type *TypeAryPtr::xdual() const { - return new TypeAryPtr(dual_ptr(), _const_oop, _ary->dual()->is_ary(),_klass, _klass_is_exact, dual_offset(), dual_field_offset(), dual_instance_id(), is_autobox_cache(), dual_speculative(), dual_inline_depth()); + return new TypeAryPtr(dual_ptr(), _const_oop, _ary->dual()->is_ary(), _klass, _klass_is_exact, dual_offset(), dual_field_offset(), dual_instance_id(), is_autobox_cache(), dual_speculative(), dual_inline_depth()); } -Type::Offset TypeAryPtr::meet_field_offset(int field_offset) const { - return _field_offset.meet(Offset(field_offset)); +Type::Offset TypeAryPtr::meet_field_offset(const Type::Offset offset) const { + return _field_offset.meet(offset); } //------------------------------dual_offset------------------------------------