--- old/src/share/vm/opto/memnode.cpp 2017-07-06 17:28:46.707328593 +0200 +++ new/src/share/vm/opto/memnode.cpp 2017-07-06 17:28:42.695346607 +0200 @@ -42,6 +42,7 @@ #include "opto/narrowptrnode.hpp" #include "opto/phaseX.hpp" #include "opto/regmask.hpp" +#include "opto/valuetypenode.hpp" #include "utilities/copy.hpp" // Portions of code courtesy of Clifford Click @@ -1094,6 +1095,18 @@ Node* LoadNode::Identity(PhaseGVN* phase) { // If the previous store-maker is the right kind of Store, and the store is // to the same address, then we are equal to the value stored. + Node* addr = in(Address); + intptr_t offset; + Node* base = AddPNode::Ideal_base_and_offset(addr, phase, offset); + if (base != NULL && base->Opcode() == Op_ValueTypePtr) { + Node* value = base->as_ValueTypeBase()->field_value_by_offset((int)offset, true); + if (bottom_type()->isa_narrowoop()) { + assert(!phase->type(value)->isa_narrowoop(), "should already be decoded"); + value = phase->transform(new EncodePNode(value, bottom_type())); + } + return value; + } + Node* mem = in(Memory); Node* value = can_see_stored_value(mem, phase); if( value ) {