< prev index next >

src/hotspot/share/opto/memnode.cpp

Print this page




1727   // Steps (a), (b):  Walk past independent stores to find an exact match.
1728   if (prev_mem != NULL && prev_mem != in(MemNode::Memory)) {
1729     // (c) See if we can fold up on the spot, but don't fold up here.
1730     // Fold-up might require truncation (for LoadB/LoadS/LoadUS) or
1731     // just return a prior value, which is done by Identity calls.
1732     if (can_see_stored_value(prev_mem, phase)) {
1733       // Make ready for step (d):
1734       set_req(MemNode::Memory, prev_mem);
1735       return this;
1736     }
1737   }
1738 
1739   AllocateNode* alloc = AllocateNode::Ideal_allocation(address, phase);
1740   if (alloc != NULL && mem->is_Proj() &&
1741       mem->in(0) != NULL &&
1742       mem->in(0) == alloc->initialization() &&
1743       Opcode() == Op_LoadX &&
1744       alloc->initialization()->proj_out_or_null(0) != NULL) {
1745     InitializeNode* init = alloc->initialization();
1746     Node* control = init->proj_out(0);
1747     return alloc->make_ideal_mark(phase, address, control, mem);
1748   }
1749 
1750   return progress ? this : NULL;
1751 }
1752 
1753 // Helper to recognize certain Klass fields which are invariant across
1754 // some group of array types (e.g., int[] or all T[] where T < Object).
1755 const Type*
1756 LoadNode::load_array_final_field(const TypeKlassPtr *tkls,
1757                                  ciKlass* klass) const {
1758   if (tkls->offset() == in_bytes(Klass::modifier_flags_offset())) {
1759     // The field is Klass::_modifier_flags.  Return its (constant) value.
1760     // (Folds up the 2nd indirection in aClassConstant.getModifiers().)
1761     assert(this->Opcode() == Op_LoadI, "must load an int from _modifier_flags");
1762     return TypeInt::make(klass->modifier_flags());
1763   }
1764   if (tkls->offset() == in_bytes(Klass::access_flags_offset())) {
1765     // The field is Klass::_access_flags.  Return its (constant) value.
1766     // (Folds up the 2nd indirection in Reflection.getClassAccessFlags(aClassConstant).)
1767     assert(this->Opcode() == Op_LoadI, "must load an int from _access_flags");




1727   // Steps (a), (b):  Walk past independent stores to find an exact match.
1728   if (prev_mem != NULL && prev_mem != in(MemNode::Memory)) {
1729     // (c) See if we can fold up on the spot, but don't fold up here.
1730     // Fold-up might require truncation (for LoadB/LoadS/LoadUS) or
1731     // just return a prior value, which is done by Identity calls.
1732     if (can_see_stored_value(prev_mem, phase)) {
1733       // Make ready for step (d):
1734       set_req(MemNode::Memory, prev_mem);
1735       return this;
1736     }
1737   }
1738 
1739   AllocateNode* alloc = AllocateNode::Ideal_allocation(address, phase);
1740   if (alloc != NULL && mem->is_Proj() &&
1741       mem->in(0) != NULL &&
1742       mem->in(0) == alloc->initialization() &&
1743       Opcode() == Op_LoadX &&
1744       alloc->initialization()->proj_out_or_null(0) != NULL) {
1745     InitializeNode* init = alloc->initialization();
1746     Node* control = init->proj_out(0);
1747     return alloc->make_ideal_mark(phase, control, mem);
1748   }
1749 
1750   return progress ? this : NULL;
1751 }
1752 
1753 // Helper to recognize certain Klass fields which are invariant across
1754 // some group of array types (e.g., int[] or all T[] where T < Object).
1755 const Type*
1756 LoadNode::load_array_final_field(const TypeKlassPtr *tkls,
1757                                  ciKlass* klass) const {
1758   if (tkls->offset() == in_bytes(Klass::modifier_flags_offset())) {
1759     // The field is Klass::_modifier_flags.  Return its (constant) value.
1760     // (Folds up the 2nd indirection in aClassConstant.getModifiers().)
1761     assert(this->Opcode() == Op_LoadI, "must load an int from _modifier_flags");
1762     return TypeInt::make(klass->modifier_flags());
1763   }
1764   if (tkls->offset() == in_bytes(Klass::access_flags_offset())) {
1765     // The field is Klass::_access_flags.  Return its (constant) value.
1766     // (Folds up the 2nd indirection in Reflection.getClassAccessFlags(aClassConstant).)
1767     assert(this->Opcode() == Op_LoadI, "must load an int from _access_flags");


< prev index next >