< prev index next >
src/share/vm/opto/memnode.cpp
Print this page
*** 40,49 ****
--- 40,50 ----
#include "opto/memnode.hpp"
#include "opto/mulnode.hpp"
#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
// Optimization - Graph Style
*** 1092,1101 ****
--- 1093,1114 ----
//------------------------------Identity---------------------------------------
// Loads are identity if previous store is to same address
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 ) {
// byte, short & char stores truncate naturally.
// A load has to load the truncated value which requires
< prev index next >