hotspot/src/share/vm/opto/memnode.cpp
changeset 44739 3af2c3740d7b
parent 42063 dca9294d9f59
child 45241 dec8c0efd17b
equal deleted inserted replaced
44738:11431bbc9549 44739:3af2c3740d7b
    57   Node* adr = in(Address);
    57   Node* adr = in(Address);
    58   if (adr == NULL)  return NULL; // node is dead
    58   if (adr == NULL)  return NULL; // node is dead
    59   const TypePtr* cross_check = NULL;
    59   const TypePtr* cross_check = NULL;
    60   DEBUG_ONLY(cross_check = _adr_type);
    60   DEBUG_ONLY(cross_check = _adr_type);
    61   return calculate_adr_type(adr->bottom_type(), cross_check);
    61   return calculate_adr_type(adr->bottom_type(), cross_check);
       
    62 }
       
    63 
       
    64 bool MemNode::check_if_adr_maybe_raw(Node* adr) {
       
    65   if (adr != NULL) {
       
    66     if (adr->bottom_type()->base() == Type::RawPtr || adr->bottom_type()->base() == Type::AnyPtr) {
       
    67       return true;
       
    68     }
       
    69   }
       
    70   return false;
    62 }
    71 }
    63 
    72 
    64 #ifndef PRODUCT
    73 #ifndef PRODUCT
    65 void MemNode::dump_spec(outputStream *st) const {
    74 void MemNode::dump_spec(outputStream *st) const {
    66   if (in(Address) == NULL)  return; // node is dead
    75   if (in(Address) == NULL)  return; // node is dead
   558   AllocateNode* alloc  = AllocateNode::Ideal_allocation(base, phase);
   567   AllocateNode* alloc  = AllocateNode::Ideal_allocation(base, phase);
   559 
   568 
   560   if (offset == Type::OffsetBot)
   569   if (offset == Type::OffsetBot)
   561     return NULL;            // cannot unalias unless there are precise offsets
   570     return NULL;            // cannot unalias unless there are precise offsets
   562 
   571 
       
   572   const bool adr_maybe_raw = check_if_adr_maybe_raw(adr);
   563   const TypeOopPtr *addr_t = adr->bottom_type()->isa_oopptr();
   573   const TypeOopPtr *addr_t = adr->bottom_type()->isa_oopptr();
   564 
   574 
   565   intptr_t size_in_bytes = memory_size();
   575   intptr_t size_in_bytes = memory_size();
   566 
   576 
   567   Node* mem = in(MemNode::Memory);   // start searching here...
   577   Node* mem = in(MemNode::Memory);   // start searching here...
   575       Node* st_adr = mem->in(MemNode::Address);
   585       Node* st_adr = mem->in(MemNode::Address);
   576       intptr_t st_offset = 0;
   586       intptr_t st_offset = 0;
   577       Node* st_base = AddPNode::Ideal_base_and_offset(st_adr, phase, st_offset);
   587       Node* st_base = AddPNode::Ideal_base_and_offset(st_adr, phase, st_offset);
   578       if (st_base == NULL)
   588       if (st_base == NULL)
   579         break;              // inscrutable pointer
   589         break;              // inscrutable pointer
       
   590 
       
   591       // For raw accesses it's not enough to prove that constant offsets don't intersect.
       
   592       // We need the bases to be the equal in order for the offset check to make sense.
       
   593       if ((adr_maybe_raw || check_if_adr_maybe_raw(st_adr)) && st_base != base) {
       
   594         break;
       
   595       }
       
   596 
   580       if (st_offset != offset && st_offset != Type::OffsetBot) {
   597       if (st_offset != offset && st_offset != Type::OffsetBot) {
   581         const int MAX_STORE = BytesPerLong;
   598         const int MAX_STORE = BytesPerLong;
   582         if (st_offset >= offset + size_in_bytes ||
   599         if (st_offset >= offset + size_in_bytes ||
   583             st_offset <= offset - MAX_STORE ||
   600             st_offset <= offset - MAX_STORE ||
   584             st_offset <= offset - mem->as_Store()->memory_size()) {
   601             st_offset <= offset - mem->as_Store()->memory_size()) {