535 // (At this point we can assume disjoint_bases, since types differ.)
536 int ek_offset = in_bytes(ObjArrayKlass::element_klass_offset());
537 Node* p1 = basic_plus_adr(dest_klass, ek_offset);
538 Node* n1 = LoadKlassNode::make(_igvn, NULL, C->immutable_memory(), p1, TypeRawPtr::BOTTOM);
539 Node* dest_elem_klass = transform_later(n1);
540 Node* cv = generate_checkcast_arraycopy(&local_ctrl, &local_mem,
541 adr_type,
542 dest_elem_klass,
543 src, src_offset, dest, dest_offset,
544 ConvI2X(copy_length), dest_uninitialized);
545 if (cv == NULL) cv = intcon(-1); // failure (no stub available)
546 checked_control = local_ctrl;
547 checked_i_o = *io;
548 checked_mem = local_mem->memory_at(alias_idx);
549 checked_value = cv;
550 }
551 }
552 // At this point we know we do not need type checks on oop stores.
553
554 BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2();
555 if (alloc != NULL && !bs->array_copy_requires_gc_barriers(copy_type)) {
556 // If we do not need gc barriers, copy using the jint or jlong stub.
557 copy_type = LP64_ONLY(UseCompressedOops ? T_INT : T_LONG) NOT_LP64(T_INT);
558 assert(type2aelembytes(basic_elem_type) == type2aelembytes(copy_type),
559 "sizes agree");
560 }
561 }
562
563 if (!(*ctrl)->is_top()) {
564 // Generate the fast path, if possible.
565 Node* local_ctrl = *ctrl;
566 MergeMemNode* local_mem = MergeMemNode::make(mem);
567 transform_later(local_mem);
568
569 generate_unchecked_arraycopy(&local_ctrl, &local_mem,
570 adr_type, copy_type, disjoint_bases,
571 src, src_offset, dest, dest_offset,
572 ConvI2X(copy_length), dest_uninitialized);
573
574 // Present the results of the fast call.
575 result_region->init_req(fast_path, local_ctrl);
1109
1110 _igvn.replace_node(ac, call);
1111 return;
1112 } else if (ac->is_copyof() || ac->is_copyofrange() || ac->is_cloneoop()) {
1113 Node* mem = ac->in(TypeFunc::Memory);
1114 merge_mem = MergeMemNode::make(mem);
1115 transform_later(merge_mem);
1116
1117 RegionNode* slow_region = new RegionNode(1);
1118 transform_later(slow_region);
1119
1120 AllocateArrayNode* alloc = NULL;
1121 if (ac->is_alloc_tightly_coupled()) {
1122 alloc = AllocateArrayNode::Ideal_array_allocation(dest, &_igvn);
1123 assert(alloc != NULL, "expect alloc");
1124 }
1125
1126 const TypePtr* adr_type = _igvn.type(dest)->is_oopptr()->add_offset(Type::OffsetBot);
1127 if (ac->_dest_type != TypeOopPtr::BOTTOM) {
1128 adr_type = ac->_dest_type->add_offset(Type::OffsetBot)->is_ptr();
1129 }
1130 if (ac->_src_type != ac->_dest_type) {
1131 adr_type = TypeRawPtr::BOTTOM;
1132 }
1133 generate_arraycopy(ac, alloc, &ctrl, merge_mem, &io,
1134 adr_type, T_OBJECT,
1135 src, src_offset, dest, dest_offset, length,
1136 true, !ac->is_copyofrange());
1137
1138 return;
1139 }
1140
1141 AllocateArrayNode* alloc = NULL;
1142 if (ac->is_alloc_tightly_coupled()) {
1143 alloc = AllocateArrayNode::Ideal_array_allocation(dest, &_igvn);
1144 assert(alloc != NULL, "expect alloc");
1145 }
1146
1147 assert(ac->is_arraycopy() || ac->is_arraycopy_validated(), "should be an arraycopy");
1148
1149 // Compile time checks. If any of these checks cannot be verified at compile time,
1150 // we do not make a fast path for this call. Instead, we let the call remain as it
1151 // is. The checks we choose to mandate at compile time are:
|
535 // (At this point we can assume disjoint_bases, since types differ.)
536 int ek_offset = in_bytes(ObjArrayKlass::element_klass_offset());
537 Node* p1 = basic_plus_adr(dest_klass, ek_offset);
538 Node* n1 = LoadKlassNode::make(_igvn, NULL, C->immutable_memory(), p1, TypeRawPtr::BOTTOM);
539 Node* dest_elem_klass = transform_later(n1);
540 Node* cv = generate_checkcast_arraycopy(&local_ctrl, &local_mem,
541 adr_type,
542 dest_elem_klass,
543 src, src_offset, dest, dest_offset,
544 ConvI2X(copy_length), dest_uninitialized);
545 if (cv == NULL) cv = intcon(-1); // failure (no stub available)
546 checked_control = local_ctrl;
547 checked_i_o = *io;
548 checked_mem = local_mem->memory_at(alias_idx);
549 checked_value = cv;
550 }
551 }
552 // At this point we know we do not need type checks on oop stores.
553
554 BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2();
555 if (!bs->array_copy_requires_gc_barriers(alloc != NULL, copy_type, false, BarrierSetC2::Expansion)) {
556 // If we do not need gc barriers, copy using the jint or jlong stub.
557 copy_type = LP64_ONLY(UseCompressedOops ? T_INT : T_LONG) NOT_LP64(T_INT);
558 assert(type2aelembytes(basic_elem_type) == type2aelembytes(copy_type),
559 "sizes agree");
560 }
561 }
562
563 if (!(*ctrl)->is_top()) {
564 // Generate the fast path, if possible.
565 Node* local_ctrl = *ctrl;
566 MergeMemNode* local_mem = MergeMemNode::make(mem);
567 transform_later(local_mem);
568
569 generate_unchecked_arraycopy(&local_ctrl, &local_mem,
570 adr_type, copy_type, disjoint_bases,
571 src, src_offset, dest, dest_offset,
572 ConvI2X(copy_length), dest_uninitialized);
573
574 // Present the results of the fast call.
575 result_region->init_req(fast_path, local_ctrl);
1109
1110 _igvn.replace_node(ac, call);
1111 return;
1112 } else if (ac->is_copyof() || ac->is_copyofrange() || ac->is_cloneoop()) {
1113 Node* mem = ac->in(TypeFunc::Memory);
1114 merge_mem = MergeMemNode::make(mem);
1115 transform_later(merge_mem);
1116
1117 RegionNode* slow_region = new RegionNode(1);
1118 transform_later(slow_region);
1119
1120 AllocateArrayNode* alloc = NULL;
1121 if (ac->is_alloc_tightly_coupled()) {
1122 alloc = AllocateArrayNode::Ideal_array_allocation(dest, &_igvn);
1123 assert(alloc != NULL, "expect alloc");
1124 }
1125
1126 const TypePtr* adr_type = _igvn.type(dest)->is_oopptr()->add_offset(Type::OffsetBot);
1127 if (ac->_dest_type != TypeOopPtr::BOTTOM) {
1128 adr_type = ac->_dest_type->add_offset(Type::OffsetBot)->is_ptr();
1129 }
1130 generate_arraycopy(ac, alloc, &ctrl, merge_mem, &io,
1131 adr_type, T_OBJECT,
1132 src, src_offset, dest, dest_offset, length,
1133 true, !ac->is_copyofrange());
1134
1135 return;
1136 }
1137
1138 AllocateArrayNode* alloc = NULL;
1139 if (ac->is_alloc_tightly_coupled()) {
1140 alloc = AllocateArrayNode::Ideal_array_allocation(dest, &_igvn);
1141 assert(alloc != NULL, "expect alloc");
1142 }
1143
1144 assert(ac->is_arraycopy() || ac->is_arraycopy_validated(), "should be an arraycopy");
1145
1146 // Compile time checks. If any of these checks cannot be verified at compile time,
1147 // we do not make a fast path for this call. Instead, we let the call remain as it
1148 // is. The checks we choose to mandate at compile time are:
|