< prev index next >

src/hotspot/share/opto/memnode.cpp

Print this page




1660   // fold up, do so.
1661   Node* prev_mem = find_previous_store(phase);
1662   if (prev_mem != NULL) {
1663     Node* value = can_see_arraycopy_value(prev_mem, phase);
1664     if (value != NULL) {
1665       return value;
1666     }
1667   }
1668   // Steps (a), (b):  Walk past independent stores to find an exact match.
1669   if (prev_mem != NULL && prev_mem != in(MemNode::Memory)) {
1670     // (c) See if we can fold up on the spot, but don't fold up here.
1671     // Fold-up might require truncation (for LoadB/LoadS/LoadUS) or
1672     // just return a prior value, which is done by Identity calls.
1673     if (can_see_stored_value(prev_mem, phase)) {
1674       // Make ready for step (d):
1675       set_req(MemNode::Memory, prev_mem);
1676       return this;
1677     }
1678   }
1679 











1680   return progress ? this : NULL;
1681 }
1682 
1683 // Helper to recognize certain Klass fields which are invariant across
1684 // some group of array types (e.g., int[] or all T[] where T < Object).
1685 const Type*
1686 LoadNode::load_array_final_field(const TypeKlassPtr *tkls,
1687                                  ciKlass* klass) const {
1688   if (tkls->offset() == in_bytes(Klass::modifier_flags_offset())) {
1689     // The field is Klass::_modifier_flags.  Return its (constant) value.
1690     // (Folds up the 2nd indirection in aClassConstant.getModifiers().)
1691     assert(this->Opcode() == Op_LoadI, "must load an int from _modifier_flags");
1692     return TypeInt::make(klass->modifier_flags());
1693   }
1694   if (tkls->offset() == in_bytes(Klass::access_flags_offset())) {
1695     // The field is Klass::_access_flags.  Return its (constant) value.
1696     // (Folds up the 2nd indirection in Reflection.getClassAccessFlags(aClassConstant).)
1697     assert(this->Opcode() == Op_LoadI, "must load an int from _access_flags");
1698     return TypeInt::make(klass->access_flags());
1699   }




1660   // fold up, do so.
1661   Node* prev_mem = find_previous_store(phase);
1662   if (prev_mem != NULL) {
1663     Node* value = can_see_arraycopy_value(prev_mem, phase);
1664     if (value != NULL) {
1665       return value;
1666     }
1667   }
1668   // Steps (a), (b):  Walk past independent stores to find an exact match.
1669   if (prev_mem != NULL && prev_mem != in(MemNode::Memory)) {
1670     // (c) See if we can fold up on the spot, but don't fold up here.
1671     // Fold-up might require truncation (for LoadB/LoadS/LoadUS) or
1672     // just return a prior value, which is done by Identity calls.
1673     if (can_see_stored_value(prev_mem, phase)) {
1674       // Make ready for step (d):
1675       set_req(MemNode::Memory, prev_mem);
1676       return this;
1677     }
1678   }
1679 
1680   AllocateNode* alloc = AllocateNode::Ideal_allocation(address, phase);
1681   if (alloc != NULL && mem->is_Proj() &&
1682       mem->in(0) != NULL &&
1683       mem->in(0) == alloc->initialization() &&
1684       Opcode() == Op_LoadX &&
1685       alloc->initialization()->proj_out_or_null(0) != NULL) {
1686     InitializeNode* init = alloc->initialization();
1687     Node* control = init->proj_out(0);
1688     return alloc->make_ideal_mark(phase, address, control, mem, NULL);
1689   }
1690 
1691   return progress ? this : NULL;
1692 }
1693 
1694 // Helper to recognize certain Klass fields which are invariant across
1695 // some group of array types (e.g., int[] or all T[] where T < Object).
1696 const Type*
1697 LoadNode::load_array_final_field(const TypeKlassPtr *tkls,
1698                                  ciKlass* klass) const {
1699   if (tkls->offset() == in_bytes(Klass::modifier_flags_offset())) {
1700     // The field is Klass::_modifier_flags.  Return its (constant) value.
1701     // (Folds up the 2nd indirection in aClassConstant.getModifiers().)
1702     assert(this->Opcode() == Op_LoadI, "must load an int from _modifier_flags");
1703     return TypeInt::make(klass->modifier_flags());
1704   }
1705   if (tkls->offset() == in_bytes(Klass::access_flags_offset())) {
1706     // The field is Klass::_access_flags.  Return its (constant) value.
1707     // (Folds up the 2nd indirection in Reflection.getClassAccessFlags(aClassConstant).)
1708     assert(this->Opcode() == Op_LoadI, "must load an int from _access_flags");
1709     return TypeInt::make(klass->access_flags());
1710   }


< prev index next >