< prev index next >

src/hotspot/share/gc/x/c2/xBarrierSetC2.cpp

Print this page

281       // Clone primitive array
282       bt = T_LONG;
283     }
284 
285     Node* ctrl = ac->in(TypeFunc::Control);
286     Node* mem = ac->in(TypeFunc::Memory);
287     Node* src = ac->in(ArrayCopyNode::Src);
288     Node* src_offset = ac->in(ArrayCopyNode::SrcPos);
289     Node* dest = ac->in(ArrayCopyNode::Dest);
290     Node* dest_offset = ac->in(ArrayCopyNode::DestPos);
291     Node* length = ac->in(ArrayCopyNode::Length);
292 
293     if (bt == T_OBJECT) {
294       // BarrierSetC2::clone sets the offsets via BarrierSetC2::arraycopy_payload_base_offset
295       // which 8-byte aligns them to allow for word size copies. Make sure the offsets point
296       // to the first element in the array when cloning object arrays. Otherwise, load
297       // barriers are applied to parts of the header. Also adjust the length accordingly.
298       assert(src_offset == dest_offset, "should be equal");
299       jlong offset = src_offset->get_long();
300       if (offset != arrayOopDesc::base_offset_in_bytes(T_OBJECT)) {
301         assert(!UseCompressedClassPointers, "should only happen without compressed class pointers");
302         assert((arrayOopDesc::base_offset_in_bytes(T_OBJECT) - offset) == BytesPerLong, "unexpected offset");
303         length = phase->transform_later(new SubLNode(length, phase->longcon(1))); // Size is in longs
304         src_offset = phase->longcon(arrayOopDesc::base_offset_in_bytes(T_OBJECT));
305         dest_offset = src_offset;
306       }
307     }
308     Node* payload_src = phase->basic_plus_adr(src, src_offset);
309     Node* payload_dst = phase->basic_plus_adr(dest, dest_offset);
310 
311     const char* copyfunc_name = "arraycopy";
312     address     copyfunc_addr = phase->basictype2arraycopy(bt, nullptr, nullptr, true, copyfunc_name, true);
313 
314     const TypePtr* raw_adr_type = TypeRawPtr::BOTTOM;
315     const TypeFunc* call_type = OptoRuntime::fast_arraycopy_Type();
316 
317     Node* call = phase->make_leaf_call(ctrl, mem, call_type, copyfunc_addr, copyfunc_name, raw_adr_type, payload_src, payload_dst, length XTOP);
318     phase->transform_later(call);
319 
320     phase->igvn().replace_node(ac, call);
321     return;

281       // Clone primitive array
282       bt = T_LONG;
283     }
284 
285     Node* ctrl = ac->in(TypeFunc::Control);
286     Node* mem = ac->in(TypeFunc::Memory);
287     Node* src = ac->in(ArrayCopyNode::Src);
288     Node* src_offset = ac->in(ArrayCopyNode::SrcPos);
289     Node* dest = ac->in(ArrayCopyNode::Dest);
290     Node* dest_offset = ac->in(ArrayCopyNode::DestPos);
291     Node* length = ac->in(ArrayCopyNode::Length);
292 
293     if (bt == T_OBJECT) {
294       // BarrierSetC2::clone sets the offsets via BarrierSetC2::arraycopy_payload_base_offset
295       // which 8-byte aligns them to allow for word size copies. Make sure the offsets point
296       // to the first element in the array when cloning object arrays. Otherwise, load
297       // barriers are applied to parts of the header. Also adjust the length accordingly.
298       assert(src_offset == dest_offset, "should be equal");
299       jlong offset = src_offset->get_long();
300       if (offset != arrayOopDesc::base_offset_in_bytes(T_OBJECT)) {
301         assert(!UseCompressedClassPointers || UseCompactObjectHeaders, "should only happen without compressed class pointers");
302         assert((arrayOopDesc::base_offset_in_bytes(T_OBJECT) - offset) == BytesPerLong, "unexpected offset");
303         length = phase->transform_later(new SubLNode(length, phase->longcon(1))); // Size is in longs
304         src_offset = phase->longcon(arrayOopDesc::base_offset_in_bytes(T_OBJECT));
305         dest_offset = src_offset;
306       }
307     }
308     Node* payload_src = phase->basic_plus_adr(src, src_offset);
309     Node* payload_dst = phase->basic_plus_adr(dest, dest_offset);
310 
311     const char* copyfunc_name = "arraycopy";
312     address     copyfunc_addr = phase->basictype2arraycopy(bt, nullptr, nullptr, true, copyfunc_name, true);
313 
314     const TypePtr* raw_adr_type = TypeRawPtr::BOTTOM;
315     const TypeFunc* call_type = OptoRuntime::fast_arraycopy_Type();
316 
317     Node* call = phase->make_leaf_call(ctrl, mem, call_type, copyfunc_addr, copyfunc_name, raw_adr_type, payload_src, payload_dst, length XTOP);
318     phase->transform_later(call);
319 
320     phase->igvn().replace_node(ac, call);
321     return;
< prev index next >