< prev index next >

src/hotspot/share/gc/z/c2/zBarrierSetC2.cpp

Print this page

480       // Clone primitive array
481       bt = T_LONG;
482     }
483 
484     Node* const ctrl = ac->in(TypeFunc::Control);
485     Node* const mem = ac->in(TypeFunc::Memory);
486     Node* const src = ac->in(ArrayCopyNode::Src);
487     Node* src_offset = ac->in(ArrayCopyNode::SrcPos);
488     Node* const dest = ac->in(ArrayCopyNode::Dest);
489     Node* dest_offset = ac->in(ArrayCopyNode::DestPos);
490     Node* length = ac->in(ArrayCopyNode::Length);
491 
492     if (bt == T_OBJECT) {
493       // BarrierSetC2::clone sets the offsets via BarrierSetC2::arraycopy_payload_base_offset
494       // which 8-byte aligns them to allow for word size copies. Make sure the offsets point
495       // to the first element in the array when cloning object arrays. Otherwise, load
496       // barriers are applied to parts of the header. Also adjust the length accordingly.
497       assert(src_offset == dest_offset, "should be equal");
498       const jlong offset = src_offset->get_long();
499       if (offset != arrayOopDesc::base_offset_in_bytes(T_OBJECT)) {
500         assert(!UseCompressedClassPointers, "should only happen without compressed class pointers");
501         assert((arrayOopDesc::base_offset_in_bytes(T_OBJECT) - offset) == BytesPerLong, "unexpected offset");
502         length = phase->transform_later(new SubLNode(length, phase->longcon(1))); // Size is in longs
503         src_offset = phase->longcon(arrayOopDesc::base_offset_in_bytes(T_OBJECT));
504         dest_offset = src_offset;
505       }
506     }
507     Node* const payload_src = phase->basic_plus_adr(src, src_offset);
508     Node* const payload_dst = phase->basic_plus_adr(dest, dest_offset);
509 
510     const char*   copyfunc_name = "arraycopy";
511     const address copyfunc_addr = phase->basictype2arraycopy(bt, nullptr, nullptr, true, copyfunc_name, true);
512 
513     const TypePtr* const raw_adr_type = TypeRawPtr::BOTTOM;
514     const TypeFunc* const call_type = OptoRuntime::fast_arraycopy_Type();
515 
516     Node* const call = phase->make_leaf_call(ctrl, mem, call_type, copyfunc_addr, copyfunc_name, raw_adr_type, payload_src, payload_dst, length XTOP);
517     phase->transform_later(call);
518 
519     phase->igvn().replace_node(ac, call);
520     return;

480       // Clone primitive array
481       bt = T_LONG;
482     }
483 
484     Node* const ctrl = ac->in(TypeFunc::Control);
485     Node* const mem = ac->in(TypeFunc::Memory);
486     Node* const src = ac->in(ArrayCopyNode::Src);
487     Node* src_offset = ac->in(ArrayCopyNode::SrcPos);
488     Node* const dest = ac->in(ArrayCopyNode::Dest);
489     Node* dest_offset = ac->in(ArrayCopyNode::DestPos);
490     Node* length = ac->in(ArrayCopyNode::Length);
491 
492     if (bt == T_OBJECT) {
493       // BarrierSetC2::clone sets the offsets via BarrierSetC2::arraycopy_payload_base_offset
494       // which 8-byte aligns them to allow for word size copies. Make sure the offsets point
495       // to the first element in the array when cloning object arrays. Otherwise, load
496       // barriers are applied to parts of the header. Also adjust the length accordingly.
497       assert(src_offset == dest_offset, "should be equal");
498       const jlong offset = src_offset->get_long();
499       if (offset != arrayOopDesc::base_offset_in_bytes(T_OBJECT)) {
500         assert(!UseCompressedClassPointers || UseCompactObjectHeaders, "should only happen without compressed class pointers");
501         assert((arrayOopDesc::base_offset_in_bytes(T_OBJECT) - offset) == BytesPerLong, "unexpected offset");
502         length = phase->transform_later(new SubLNode(length, phase->longcon(1))); // Size is in longs
503         src_offset = phase->longcon(arrayOopDesc::base_offset_in_bytes(T_OBJECT));
504         dest_offset = src_offset;
505       }
506     }
507     Node* const payload_src = phase->basic_plus_adr(src, src_offset);
508     Node* const payload_dst = phase->basic_plus_adr(dest, dest_offset);
509 
510     const char*   copyfunc_name = "arraycopy";
511     const address copyfunc_addr = phase->basictype2arraycopy(bt, nullptr, nullptr, true, copyfunc_name, true);
512 
513     const TypePtr* const raw_adr_type = TypeRawPtr::BOTTOM;
514     const TypeFunc* const call_type = OptoRuntime::fast_arraycopy_Type();
515 
516     Node* const call = phase->make_leaf_call(ctrl, mem, call_type, copyfunc_addr, copyfunc_name, raw_adr_type, payload_src, payload_dst, length XTOP);
517     phase->transform_later(call);
518 
519     phase->igvn().replace_node(ac, call);
520     return;
< prev index next >