158 AllocateNode* alloc = proj_in->as_Initialize()->allocation();
159 // Stop if this is the initialization for the object instance which
160 // contains this memory slice, otherwise skip over it.
161 if ((alloc == NULL) || (alloc->_idx == instance_id)) {
162 break;
163 }
164 if (is_instance) {
165 result = proj_in->in(TypeFunc::Memory);
166 } else if (is_boxed_value_load) {
167 Node* klass = alloc->in(AllocateNode::KlassNode);
168 const TypeKlassPtr* tklass = phase->type(klass)->is_klassptr();
169 if (tklass->klass_is_exact() && !tklass->klass()->equals(t_oop->klass())) {
170 result = proj_in->in(TypeFunc::Memory); // not related allocation
171 }
172 }
173 } else if (proj_in->is_MemBar()) {
174 ArrayCopyNode* ac = NULL;
175 if (ArrayCopyNode::may_modify(t_oop, proj_in->as_MemBar(), phase, ac)) {
176 break;
177 }
178 result = proj_in->in(TypeFunc::Memory);
179 } else {
180 assert(false, "unexpected projection");
181 }
182 } else if (result->is_ClearArray()) {
183 if (!is_instance || !ClearArrayNode::step_through(&result, instance_id, phase)) {
184 // Can not bypass initialization of the instance
185 // we are looking for.
186 break;
187 }
188 // Otherwise skip it (the call updated 'result' value).
189 } else if (result->is_MergeMem()) {
190 result = step_through_mergemem(phase, result->as_MergeMem(), t_oop, NULL, tty);
191 }
192 }
193 return result;
194 }
195
196 Node *MemNode::optimize_memory_chain(Node *mchain, const TypePtr *t_adr, Node *load, PhaseGVN *phase) {
197 const TypeOopPtr* t_oop = t_adr->isa_oopptr();
198 if (t_oop == NULL)
|
158 AllocateNode* alloc = proj_in->as_Initialize()->allocation();
159 // Stop if this is the initialization for the object instance which
160 // contains this memory slice, otherwise skip over it.
161 if ((alloc == NULL) || (alloc->_idx == instance_id)) {
162 break;
163 }
164 if (is_instance) {
165 result = proj_in->in(TypeFunc::Memory);
166 } else if (is_boxed_value_load) {
167 Node* klass = alloc->in(AllocateNode::KlassNode);
168 const TypeKlassPtr* tklass = phase->type(klass)->is_klassptr();
169 if (tklass->klass_is_exact() && !tklass->klass()->equals(t_oop->klass())) {
170 result = proj_in->in(TypeFunc::Memory); // not related allocation
171 }
172 }
173 } else if (proj_in->is_MemBar()) {
174 ArrayCopyNode* ac = NULL;
175 if (ArrayCopyNode::may_modify(t_oop, proj_in->as_MemBar(), phase, ac)) {
176 break;
177 }
178 result = proj_in->in(TypeFunc::Memory); // FYI: bypasses a membar
179 } else {
180 assert(false, "unexpected projection");
181 }
182 } else if (result->is_ClearArray()) {
183 if (!is_instance || !ClearArrayNode::step_through(&result, instance_id, phase)) {
184 // Can not bypass initialization of the instance
185 // we are looking for.
186 break;
187 }
188 // Otherwise skip it (the call updated 'result' value).
189 } else if (result->is_MergeMem()) {
190 result = step_through_mergemem(phase, result->as_MergeMem(), t_oop, NULL, tty);
191 }
192 }
193 return result;
194 }
195
196 Node *MemNode::optimize_memory_chain(Node *mchain, const TypePtr *t_adr, Node *load, PhaseGVN *phase) {
197 const TypeOopPtr* t_oop = t_adr->isa_oopptr();
198 if (t_oop == NULL)
|