src/hotspot/share/gc/g1/c2/g1BarrierSetC2.cpp
changeset 52568 40474b7105f4
parent 52442 dc1f9dec2018
child 55151 9691a169f1dd
child 58678 9cf78a70fa4f
equal deleted inserted replaced
52567:9111de8b09a1 52568:40474b7105f4
    29 #include "gc/g1/g1CardTable.hpp"
    29 #include "gc/g1/g1CardTable.hpp"
    30 #include "gc/g1/g1ThreadLocalData.hpp"
    30 #include "gc/g1/g1ThreadLocalData.hpp"
    31 #include "gc/g1/heapRegion.hpp"
    31 #include "gc/g1/heapRegion.hpp"
    32 #include "opto/arraycopynode.hpp"
    32 #include "opto/arraycopynode.hpp"
    33 #include "opto/compile.hpp"
    33 #include "opto/compile.hpp"
       
    34 #include "opto/escape.hpp"
    34 #include "opto/graphKit.hpp"
    35 #include "opto/graphKit.hpp"
    35 #include "opto/idealKit.hpp"
    36 #include "opto/idealKit.hpp"
    36 #include "opto/macro.hpp"
    37 #include "opto/macro.hpp"
    37 #include "opto/rootnode.hpp"
    38 #include "opto/rootnode.hpp"
    38 #include "opto/type.hpp"
    39 #include "opto/type.hpp"
   838       }
   839       }
   839     }
   840     }
   840   }
   841   }
   841 }
   842 }
   842 #endif
   843 #endif
       
   844 
       
   845 bool G1BarrierSetC2::escape_add_to_con_graph(ConnectionGraph* conn_graph, PhaseGVN* gvn, Unique_Node_List* delayed_worklist, Node* n, uint opcode) const {
       
   846   if (opcode == Op_StoreP) {
       
   847     Node* adr = n->in(MemNode::Address);
       
   848     const Type* adr_type = gvn->type(adr);
       
   849     // Pointer stores in G1 barriers looks like unsafe access.
       
   850     // Ignore such stores to be able scalar replace non-escaping
       
   851     // allocations.
       
   852     if (adr_type->isa_rawptr() && adr->is_AddP()) {
       
   853       Node* base = conn_graph->get_addp_base(adr);
       
   854       if (base->Opcode() == Op_LoadP &&
       
   855           base->in(MemNode::Address)->is_AddP()) {
       
   856         adr = base->in(MemNode::Address);
       
   857         Node* tls = conn_graph->get_addp_base(adr);
       
   858         if (tls->Opcode() == Op_ThreadLocal) {
       
   859           int offs = (int) gvn->find_intptr_t_con(adr->in(AddPNode::Offset), Type::OffsetBot);
       
   860           const int buf_offset = in_bytes(G1ThreadLocalData::satb_mark_queue_buffer_offset());
       
   861           if (offs == buf_offset) {
       
   862             return true; // G1 pre barrier previous oop value store.
       
   863           }
       
   864           if (offs == in_bytes(G1ThreadLocalData::dirty_card_queue_buffer_offset())) {
       
   865             return true; // G1 post barrier card address store.
       
   866           }
       
   867         }
       
   868       }
       
   869     }
       
   870   }
       
   871   return false;
       
   872 }