4483 src, src_offset, dest, dest_offset, 4484 copy_length); 4485 if (cv == NULL) cv = intcon(-1); // failure (no stub available) 4486 checked_control = control(); 4487 checked_i_o = i_o(); 4488 checked_mem = memory(adr_type); 4489 checked_value = cv; 4490 set_control(top()); // no fast path 4491 } 4492 4493 Node* not_pos = generate_nonpositive_guard(copy_length, length_never_negative); 4494 if (not_pos != NULL) { 4495 PreserveJVMState pjvms(this); 4496 set_control(not_pos); 4497 4498 // (6) length must not be negative. 4499 if (!length_never_negative) { 4500 generate_negative_guard(copy_length, slow_region); 4501 } 4502 4503 if (!stopped() && must_clear_dest) { 4504 Node* dest_length = alloc->in(AllocateNode::ALength); 4505 if (_gvn.eqv_uncast(copy_length, dest_length) 4506 || _gvn.find_int_con(dest_length, 1) <= 0) { 4507 // There is no zeroing to do. 4508 } else { 4509 // Clear the whole thing since there are no source elements to copy. 4510 generate_clear_array(adr_type, dest, basic_elem_type, 4511 intcon(0), NULL, 4512 alloc->in(AllocateNode::AllocSize)); 4513 } 4514 } 4515 4516 // Use a secondary InitializeNode as raw memory barrier. 4517 // Currently it is needed only on this path since other 4518 // paths have stub or runtime calls as raw memory barriers. 4519 InitializeNode* init = insert_mem_bar_volatile(Op_Initialize, 4520 Compile::AliasIdxRaw, 4521 top())->as_Initialize(); 4522 init->set_complete(&_gvn); // (there is no corresponding AllocateNode) 4523 4524 // Present the results of the fast call. 4525 result_region->init_req(zero_path, control()); 4526 result_i_o ->init_req(zero_path, i_o()); 4527 result_memory->init_req(zero_path, memory(adr_type)); 4528 } 4529 4530 if (!stopped() && must_clear_dest) { 4531 // We have to initialize the *uncopied* part of the array to zero. 4532 // The copy destination is the slice dest[off..off+len]. The other slices 4533 // are dest_head = dest[0..off] and dest_tail = dest[off+len..dest.length]. 4534 Node* dest_size = alloc->in(AllocateNode::AllocSize); 4535 Node* dest_length = alloc->in(AllocateNode::ALength); 4536 Node* dest_tail = _gvn.transform( new(C,3) AddINode(dest_offset, 4537 copy_length) ); 4538 4539 // If there is a head section that needs zeroing, do it now. 4540 if (find_int_con(dest_offset, -1) != 0) { 4541 generate_clear_array(adr_type, dest, basic_elem_type, 4542 intcon(0), dest_offset, | 4483 src, src_offset, dest, dest_offset, 4484 copy_length); 4485 if (cv == NULL) cv = intcon(-1); // failure (no stub available) 4486 checked_control = control(); 4487 checked_i_o = i_o(); 4488 checked_mem = memory(adr_type); 4489 checked_value = cv; 4490 set_control(top()); // no fast path 4491 } 4492 4493 Node* not_pos = generate_nonpositive_guard(copy_length, length_never_negative); 4494 if (not_pos != NULL) { 4495 PreserveJVMState pjvms(this); 4496 set_control(not_pos); 4497 4498 // (6) length must not be negative. 4499 if (!length_never_negative) { 4500 generate_negative_guard(copy_length, slow_region); 4501 } 4502 4503 // copy_length is 0. 4504 if (!stopped() && must_clear_dest) { 4505 Node* dest_length = alloc->in(AllocateNode::ALength); 4506 if (_gvn.eqv_uncast(copy_length, dest_length) 4507 || _gvn.find_int_con(dest_length, 1) <= 0) { 4508 // There is no zeroing to do. No need for a secondary raw memory barrier. 4509 } else { 4510 // Clear the whole thing since there are no source elements to copy. 4511 generate_clear_array(adr_type, dest, basic_elem_type, 4512 intcon(0), NULL, 4513 alloc->in(AllocateNode::AllocSize)); 4514 // Use a secondary InitializeNode as raw memory barrier. 4515 // Currently it is needed only on this path since other 4516 // paths have stub or runtime calls as raw memory barriers. 4517 InitializeNode* init = insert_mem_bar_volatile(Op_Initialize, 4518 Compile::AliasIdxRaw, 4519 top())->as_Initialize(); 4520 init->set_complete(&_gvn); // (there is no corresponding AllocateNode) 4521 } 4522 } 4523 4524 // Present the results of the fast call. 4525 result_region->init_req(zero_path, control()); 4526 result_i_o ->init_req(zero_path, i_o()); 4527 result_memory->init_req(zero_path, memory(adr_type)); 4528 } 4529 4530 if (!stopped() && must_clear_dest) { 4531 // We have to initialize the *uncopied* part of the array to zero. 4532 // The copy destination is the slice dest[off..off+len]. The other slices 4533 // are dest_head = dest[0..off] and dest_tail = dest[off+len..dest.length]. 4534 Node* dest_size = alloc->in(AllocateNode::AllocSize); 4535 Node* dest_length = alloc->in(AllocateNode::ALength); 4536 Node* dest_tail = _gvn.transform( new(C,3) AddINode(dest_offset, 4537 copy_length) ); 4538 4539 // If there is a head section that needs zeroing, do it now. 4540 if (find_int_con(dest_offset, -1) != 0) { 4541 generate_clear_array(adr_type, dest, basic_elem_type, 4542 intcon(0), dest_offset, |