318 return phi; |
318 return phi; |
319 } |
319 } |
320 |
320 |
321 // Search the last value stored into the object's field. |
321 // Search the last value stored into the object's field. |
322 Node *PhaseMacroExpand::value_from_mem(Node *sfpt_mem, BasicType ft, const Type *ftype, const TypeOopPtr *adr_t, Node *alloc) { |
322 Node *PhaseMacroExpand::value_from_mem(Node *sfpt_mem, BasicType ft, const Type *ftype, const TypeOopPtr *adr_t, Node *alloc) { |
323 assert(adr_t->is_instance_field(), "instance required"); |
323 assert(adr_t->is_known_instance_field(), "instance required"); |
324 uint instance_id = adr_t->instance_id(); |
324 int instance_id = adr_t->instance_id(); |
325 assert(instance_id == alloc->_idx, "wrong allocation"); |
325 assert((uint)instance_id == alloc->_idx, "wrong allocation"); |
326 |
326 |
327 int alias_idx = C->get_alias_index(adr_t); |
327 int alias_idx = C->get_alias_index(adr_t); |
328 int offset = adr_t->offset(); |
328 int offset = adr_t->offset(); |
329 Node *start_mem = C->start()->proj_out(TypeFunc::Memory); |
329 Node *start_mem = C->start()->proj_out(TypeFunc::Memory); |
330 Node *alloc_ctrl = alloc->in(TypeFunc::Control); |
330 Node *alloc_ctrl = alloc->in(TypeFunc::Control); |
352 } |
352 } |
353 } else if (mem->is_Store()) { |
353 } else if (mem->is_Store()) { |
354 const TypeOopPtr* atype = mem->as_Store()->adr_type()->isa_oopptr(); |
354 const TypeOopPtr* atype = mem->as_Store()->adr_type()->isa_oopptr(); |
355 assert(atype != NULL, "address type must be oopptr"); |
355 assert(atype != NULL, "address type must be oopptr"); |
356 assert(C->get_alias_index(atype) == alias_idx && |
356 assert(C->get_alias_index(atype) == alias_idx && |
357 atype->is_instance_field() && atype->offset() == offset && |
357 atype->is_known_instance_field() && atype->offset() == offset && |
358 atype->instance_id() == instance_id, "store is correct memory slice"); |
358 atype->instance_id() == instance_id, "store is correct memory slice"); |
359 done = true; |
359 done = true; |
360 } else if (mem->is_Phi()) { |
360 } else if (mem->is_Phi()) { |
361 // try to find a phi's unique input |
361 // try to find a phi's unique input |
362 Node *unique_input = NULL; |
362 Node *unique_input = NULL; |
596 assert(field_type != NULL, "field singleton type must be consistent"); |
596 assert(field_type != NULL, "field singleton type must be consistent"); |
597 } else { |
597 } else { |
598 field_type = TypeOopPtr::make_from_klass(elem_type->as_klass()); |
598 field_type = TypeOopPtr::make_from_klass(elem_type->as_klass()); |
599 } |
599 } |
600 if (UseCompressedOops) { |
600 if (UseCompressedOops) { |
601 field_type = field_type->is_oopptr()->make_narrowoop(); |
601 field_type = field_type->make_narrowoop(); |
602 basic_elem_type = T_NARROWOOP; |
602 basic_elem_type = T_NARROWOOP; |
603 } |
603 } |
604 } else { |
604 } else { |
605 field_type = Type::get_const_basic_type(basic_elem_type); |
605 field_type = Type::get_const_basic_type(basic_elem_type); |
606 } |
606 } |
664 return false; |
664 return false; |
665 } |
665 } |
666 if (UseCompressedOops && field_type->isa_narrowoop()) { |
666 if (UseCompressedOops && field_type->isa_narrowoop()) { |
667 // Enable "DecodeN(EncodeP(Allocate)) --> Allocate" transformation |
667 // Enable "DecodeN(EncodeP(Allocate)) --> Allocate" transformation |
668 // to be able scalar replace the allocation. |
668 // to be able scalar replace the allocation. |
669 _igvn.set_delay_transform(false); |
669 if (field_val->is_EncodeP()) { |
670 field_val = DecodeNNode::decode(&_igvn, field_val); |
670 field_val = field_val->in(1); |
671 _igvn.set_delay_transform(true); |
671 } else { |
|
672 field_val = transform_later(new (C, 2) DecodeNNode(field_val, field_val->bottom_type()->make_ptr())); |
|
673 } |
672 } |
674 } |
673 sfpt->add_req(field_val); |
675 sfpt->add_req(field_val); |
674 } |
676 } |
675 JVMState *jvms = sfpt->jvms(); |
677 JVMState *jvms = sfpt->jvms(); |
676 jvms->set_endoff(sfpt->req()); |
678 jvms->set_endoff(sfpt->req()); |
1672 case Node::Class_Lock: |
1674 case Node::Class_Lock: |
1673 case Node::Class_Unlock: |
1675 case Node::Class_Unlock: |
1674 success = eliminate_locking_node(n->as_AbstractLock()); |
1676 success = eliminate_locking_node(n->as_AbstractLock()); |
1675 break; |
1677 break; |
1676 default: |
1678 default: |
1677 assert(false, "unknown node type in macro list"); |
1679 if (n->Opcode() == Op_Opaque1 || n->Opcode() == Op_Opaque2) { |
|
1680 _igvn.add_users_to_worklist(n); |
|
1681 _igvn.hash_delete(n); |
|
1682 _igvn.subsume_node(n, n->in(1)); |
|
1683 success = true; |
|
1684 } else { |
|
1685 assert(false, "unknown node type in macro list"); |
|
1686 } |
1678 } |
1687 } |
1679 assert(success == (C->macro_count() < old_macro_count), "elimination reduces macro count"); |
1688 assert(success == (C->macro_count() < old_macro_count), "elimination reduces macro count"); |
1680 progress = progress || success; |
1689 progress = progress || success; |
1681 } |
1690 } |
1682 } |
1691 } |