< prev index next >

src/hotspot/share/gc/g1/c2/g1BarrierSetC2.cpp

Print this page
rev 52560 : 8213615: GC/C2 abstraction for escape analysis


  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "gc/g1/c2/g1BarrierSetC2.hpp"
  27 #include "gc/g1/g1BarrierSet.hpp"
  28 #include "gc/g1/g1BarrierSetRuntime.hpp"
  29 #include "gc/g1/g1CardTable.hpp"
  30 #include "gc/g1/g1ThreadLocalData.hpp"
  31 #include "gc/g1/heapRegion.hpp"
  32 #include "opto/arraycopynode.hpp"
  33 #include "opto/compile.hpp"

  34 #include "opto/graphKit.hpp"
  35 #include "opto/idealKit.hpp"
  36 #include "opto/macro.hpp"
  37 #include "opto/rootnode.hpp"
  38 #include "opto/type.hpp"
  39 #include "utilities/macros.hpp"
  40 
  41 const TypeFunc *G1BarrierSetC2::write_ref_field_pre_entry_Type() {
  42   const Type **fields = TypeTuple::fields(2);
  43   fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // original field value
  44   fields[TypeFunc::Parms+1] = TypeRawPtr::NOTNULL; // thread
  45   const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+2, fields);
  46 
  47   // create result type (range)
  48   fields = TypeTuple::fields(0);
  49   const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0, fields);
  50 
  51   return TypeFunc::make(domain, range);
  52 }
  53 


 823 
 824               Node* if_ctrl = iff->in(0);
 825               Node* load_ctrl = load->in(0);
 826 
 827               if (if_ctrl != load_ctrl) {
 828                 // Skip possible CProj->NeverBranch in infinite loops
 829                 if ((if_ctrl->is_Proj() && if_ctrl->Opcode() == Op_CProj)
 830                     && (if_ctrl->in(0)->is_MultiBranch() && if_ctrl->in(0)->Opcode() == Op_NeverBranch)) {
 831                   if_ctrl = if_ctrl->in(0)->in(0);
 832                 }
 833               }
 834               assert(load_ctrl != NULL && if_ctrl == load_ctrl, "controls must match");
 835             }
 836           }
 837         }
 838       }
 839     }
 840   }
 841 }
 842 #endif































  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "gc/g1/c2/g1BarrierSetC2.hpp"
  27 #include "gc/g1/g1BarrierSet.hpp"
  28 #include "gc/g1/g1BarrierSetRuntime.hpp"
  29 #include "gc/g1/g1CardTable.hpp"
  30 #include "gc/g1/g1ThreadLocalData.hpp"
  31 #include "gc/g1/heapRegion.hpp"
  32 #include "opto/arraycopynode.hpp"
  33 #include "opto/compile.hpp"
  34 #include "opto/escape.hpp"
  35 #include "opto/graphKit.hpp"
  36 #include "opto/idealKit.hpp"
  37 #include "opto/macro.hpp"
  38 #include "opto/rootnode.hpp"
  39 #include "opto/type.hpp"
  40 #include "utilities/macros.hpp"
  41 
  42 const TypeFunc *G1BarrierSetC2::write_ref_field_pre_entry_Type() {
  43   const Type **fields = TypeTuple::fields(2);
  44   fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // original field value
  45   fields[TypeFunc::Parms+1] = TypeRawPtr::NOTNULL; // thread
  46   const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+2, fields);
  47 
  48   // create result type (range)
  49   fields = TypeTuple::fields(0);
  50   const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0, fields);
  51 
  52   return TypeFunc::make(domain, range);
  53 }
  54 


 824 
 825               Node* if_ctrl = iff->in(0);
 826               Node* load_ctrl = load->in(0);
 827 
 828               if (if_ctrl != load_ctrl) {
 829                 // Skip possible CProj->NeverBranch in infinite loops
 830                 if ((if_ctrl->is_Proj() && if_ctrl->Opcode() == Op_CProj)
 831                     && (if_ctrl->in(0)->is_MultiBranch() && if_ctrl->in(0)->Opcode() == Op_NeverBranch)) {
 832                   if_ctrl = if_ctrl->in(0)->in(0);
 833                 }
 834               }
 835               assert(load_ctrl != NULL && if_ctrl == load_ctrl, "controls must match");
 836             }
 837           }
 838         }
 839       }
 840     }
 841   }
 842 }
 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 }
< prev index next >