--- old/src/share/vm/opto/addnode.cpp 2017-03-16 19:06:15.000000000 +0300 +++ new/src/share/vm/opto/addnode.cpp 2017-03-16 19:06:15.000000000 +0300 @@ -616,6 +616,17 @@ Node* offset = in(Offset); return new CastX2PNode(offset); } + // Mixed unsafe access with non-null base. Convert to on-heap access. + if (in(Address)->is_CheckCastPP() && + in(Address)->bottom_type()->isa_rawptr()) { + Node* base = in(Address)->in(1); + const TypePtr* base_type = phase->type(base)->isa_oopptr(); + if (base_type != NULL && + !TypePtr::NULL_PTR->higher_equal(base_type) && + base_type->offset() == 0 /* always? convert to assert? */) { + return new AddPNode(base, base, in(Offset)); + } + } } // If the right is an add of a constant, push the offset down.