src/hotspot/share/gc/z/c2/zBarrierSetC2.cpp
changeset 58931 304c63b17b07
parent 58516 d376d86b0a01
child 58958 7bfe7df764a2
equal deleted inserted replaced
58930:a4ddd1667c72 58931:304c63b17b07
    25 #include "classfile/javaClasses.hpp"
    25 #include "classfile/javaClasses.hpp"
    26 #include "gc/z/c2/zBarrierSetC2.hpp"
    26 #include "gc/z/c2/zBarrierSetC2.hpp"
    27 #include "gc/z/zBarrierSet.hpp"
    27 #include "gc/z/zBarrierSet.hpp"
    28 #include "gc/z/zBarrierSetAssembler.hpp"
    28 #include "gc/z/zBarrierSetAssembler.hpp"
    29 #include "gc/z/zBarrierSetRuntime.hpp"
    29 #include "gc/z/zBarrierSetRuntime.hpp"
       
    30 #include "opto/arraycopynode.hpp"
    30 #include "opto/block.hpp"
    31 #include "opto/block.hpp"
    31 #include "opto/compile.hpp"
    32 #include "opto/compile.hpp"
    32 #include "opto/graphKit.hpp"
    33 #include "opto/graphKit.hpp"
    33 #include "opto/machnode.hpp"
    34 #include "opto/machnode.hpp"
       
    35 #include "opto/macro.hpp"
    34 #include "opto/memnode.hpp"
    36 #include "opto/memnode.hpp"
    35 #include "opto/node.hpp"
    37 #include "opto/node.hpp"
    36 #include "opto/regalloc.hpp"
    38 #include "opto/regalloc.hpp"
    37 #include "opto/rootnode.hpp"
    39 #include "opto/rootnode.hpp"
       
    40 #include "opto/runtime.hpp"
    38 #include "utilities/growableArray.hpp"
    41 #include "utilities/growableArray.hpp"
    39 #include "utilities/macros.hpp"
    42 #include "utilities/macros.hpp"
    40 
    43 
    41 class ZBarrierSetC2State : public ResourceObj {
    44 class ZBarrierSetC2State : public ResourceObj {
    42 private:
    45 private:
   427         worklist.push(pred);
   430         worklist.push(pred);
   428       }
   431       }
   429     }
   432     }
   430   }
   433   }
   431 }
   434 }
       
   435 
       
   436 const TypeFunc *oop_clone_Type() {
       
   437   // create input type (domain)
       
   438   const Type **fields = TypeTuple::fields(3);
       
   439   fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL;  // src Object
       
   440   fields[TypeFunc::Parms+1] = TypeInstPtr::NOTNULL;  // dst Object
       
   441   fields[TypeFunc::Parms+2] = TypeInt::INT;          // Object size
       
   442   const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+3, fields);
       
   443 
       
   444   // create result type (range)
       
   445   fields = TypeTuple::fields(0);
       
   446 
       
   447   const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0, fields);
       
   448 
       
   449   return TypeFunc::make(domain, range);
       
   450 }
       
   451 
       
   452 void ZBarrierSetC2::clone_at_expansion(PhaseMacroExpand* phase, ArrayCopyNode* ac) const {
       
   453   Node *ctrl = ac->in(TypeFunc::Control);
       
   454   Node *mem = ac->in(TypeFunc::Memory);
       
   455   Node *src = ac->in(ArrayCopyNode::Src);
       
   456   Node *src_offset = ac->in(ArrayCopyNode::SrcPos);
       
   457   Node *dest = ac->in(ArrayCopyNode::Dest);
       
   458   Node *dest_offset = ac->in(ArrayCopyNode::DestPos);
       
   459   Node *length = ac->in(ArrayCopyNode::Length);
       
   460 
       
   461   assert (src_offset == NULL,  "for clone offsets should be null");
       
   462   assert (dest_offset == NULL, "for clone offsets should be null");
       
   463 
       
   464   if (src->bottom_type()->isa_instptr()) {
       
   465     // Instances must have all oop fiels healed before cloning - call runtime leaf
       
   466     const char *clonefunc_name = "clone_oop";
       
   467     address clonefunc_addr = ZBarrierSetRuntime::clone_oop_addr();
       
   468     const TypePtr *raw_adr_type = TypeRawPtr::BOTTOM;
       
   469     const TypeFunc *call_type = oop_clone_Type();
       
   470 
       
   471     Node *call = phase->make_leaf_call(ctrl, mem, call_type, clonefunc_addr, clonefunc_name, raw_adr_type, src, dest,
       
   472                                        length);
       
   473     phase->transform_later(call);
       
   474     phase->igvn().replace_node(ac, call);
       
   475   } else {
       
   476     assert(src->bottom_type()->isa_aryptr() != NULL, "Only arrays");
       
   477 
       
   478     // Clones of primitive arrays go here
       
   479     BarrierSetC2::clone_at_expansion(phase, ac);
       
   480   }
       
   481 }