1 /* 2 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 #include "precompiled.hpp" 26 #include "opto/arraycopynode.hpp" 27 #include "opto/graphKit.hpp" 28 29 ArrayCopyNode::ArrayCopyNode(Compile* C, bool alloc_tightly_coupled) 30 : CallNode(arraycopy_type(), NULL, TypeRawPtr::BOTTOM), 31 _alloc_tightly_coupled(alloc_tightly_coupled), 32 _kind(None), 33 _arguments_validated(false) { 34 init_class_id(Class_ArrayCopy); 35 init_flags(Flag_is_macro); 36 C->add_macro_node(this); 37 } 38 39 uint ArrayCopyNode::size_of() const { return sizeof(*this); } 40 41 ArrayCopyNode* ArrayCopyNode::make(GraphKit* kit, bool may_throw, 42 Node* src, Node* src_offset, 43 Node* dest, Node* dest_offset, 44 Node* length, 45 bool alloc_tightly_coupled, 46 Node* src_klass, Node* dest_klass, 47 Node* src_length, Node* dest_length) { 48 49 ArrayCopyNode* ac = new ArrayCopyNode(kit->C, alloc_tightly_coupled); 50 Node* prev_mem = kit->set_predefined_input_for_runtime_call(ac); 51 52 ac->init_req(ArrayCopyNode::Src, src); 53 ac->init_req(ArrayCopyNode::SrcPos, src_offset); 54 ac->init_req(ArrayCopyNode::Dest, dest); 55 ac->init_req(ArrayCopyNode::DestPos, dest_offset); 56 ac->init_req(ArrayCopyNode::Length, length); 57 ac->init_req(ArrayCopyNode::SrcLen, src_length); 58 ac->init_req(ArrayCopyNode::DestLen, dest_length); 59 ac->init_req(ArrayCopyNode::SrcKlass, src_klass); 60 ac->init_req(ArrayCopyNode::DestKlass, dest_klass); 61 62 if (may_throw) { 63 ac->set_req(TypeFunc::I_O , kit->i_o()); 64 kit->add_safepoint_edges(ac, false); 65 } 66 67 return ac; 68 } 69 70 void ArrayCopyNode::connect_outputs(GraphKit* kit) { 71 kit->set_all_memory_call(this, true); 72 kit->set_control(kit->gvn().transform(new ProjNode(this,TypeFunc::Control))); 73 kit->set_i_o(kit->gvn().transform(new ProjNode(this, TypeFunc::I_O))); 74 kit->make_slow_call_ex(this, kit->env()->Throwable_klass(), true); 75 kit->set_all_memory_call(this); 76 } 77 78 #ifndef PRODUCT 79 const char* ArrayCopyNode::_kind_names[] = {"arraycopy", "arraycopy, validated arguments", "clone", "oop array clone", "CopyOf", "CopyOfRange"}; 80 void ArrayCopyNode::dump_spec(outputStream *st) const { 81 CallNode::dump_spec(st); 82 st->print(" (%s%s)", _kind_names[_kind], _alloc_tightly_coupled ? ", tightly coupled allocation" : ""); 83 } 84 #endif 85 86 intptr_t ArrayCopyNode::get_length_if_constant(PhaseGVN *phase) const { 87 // check that length is constant 88 Node* length = in(ArrayCopyNode::Length); 89 const Type* length_type = phase->type(length); 90 91 if (length_type == Type::TOP) { 92 return -1; 93 } 94 95 assert(is_clonebasic() || is_arraycopy() || is_copyof() || is_copyofrange(), "unexpected array copy type"); 96 97 return is_clonebasic() ? length->find_intptr_t_con(-1) : length->find_int_con(-1); 98 } 99 100 int ArrayCopyNode::get_count(PhaseGVN *phase) const { 101 Node* src = in(ArrayCopyNode::Src); 102 const Type* src_type = phase->type(src); 103 104 if (is_clonebasic()) { 105 if (src_type->isa_instptr()) { 106 const TypeInstPtr* inst_src = src_type->is_instptr(); 107 ciInstanceKlass* ik = inst_src->klass()->as_instance_klass(); 108 // ciInstanceKlass::nof_nonstatic_fields() doesn't take injected 109 // fields into account. They are rare anyway so easier to simply 110 // skip instances with injected fields. 111 if ((!inst_src->klass_is_exact() && (ik->is_interface() || ik->has_subklass())) || ik->has_injected_fields()) { 112 return -1; 113 } 114 int nb_fields = ik->nof_nonstatic_fields(); 115 return nb_fields; 116 } else { 117 const TypeAryPtr* ary_src = src_type->isa_aryptr(); 118 assert (ary_src != NULL, "not an array or instance?"); 119 // clone passes a length as a rounded number of longs. If we're 120 // cloning an array we'll do it element by element. If the 121 // length input to ArrayCopyNode is constant, length of input 122 // array must be too. 123 124 assert((get_length_if_constant(phase) == -1) == !ary_src->size()->is_con() || 125 phase->is_IterGVN(), "inconsistent"); 126 127 if (ary_src->size()->is_con()) { 128 return ary_src->size()->get_con(); 129 } 130 return -1; 131 } 132 } 133 134 return get_length_if_constant(phase); 135 } 136 137 Node* ArrayCopyNode::try_clone_instance(PhaseGVN *phase, bool can_reshape, int count) { 138 if (!is_clonebasic()) { 139 return NULL; 140 } 141 142 Node* src = in(ArrayCopyNode::Src); 143 Node* dest = in(ArrayCopyNode::Dest); 144 Node* ctl = in(TypeFunc::Control); 145 Node* in_mem = in(TypeFunc::Memory); 146 147 const Type* src_type = phase->type(src); 148 const Type* dest_type = phase->type(dest); 149 150 assert(src->is_AddP(), "should be base + off"); 151 assert(dest->is_AddP(), "should be base + off"); 152 Node* base_src = src->in(AddPNode::Base); 153 Node* base_dest = dest->in(AddPNode::Base); 154 155 MergeMemNode* mem = MergeMemNode::make(in_mem); 156 157 const TypeInstPtr* inst_src = src_type->isa_instptr(); 158 159 if (inst_src == NULL) { 160 return NULL; 161 } 162 163 if (!inst_src->klass_is_exact()) { 164 ciInstanceKlass* ik = inst_src->klass()->as_instance_klass(); 165 assert(!ik->is_interface() && !ik->has_subklass(), "inconsistent klass hierarchy"); 166 phase->C->dependencies()->assert_leaf_type(ik); 167 } 168 169 ciInstanceKlass* ik = inst_src->klass()->as_instance_klass(); 170 assert(ik->nof_nonstatic_fields() <= ArrayCopyLoadStoreMaxElem, "too many fields"); 171 172 for (int i = 0; i < count; i++) { 173 ciField* field = ik->nonstatic_field_at(i); 174 int fieldidx = phase->C->alias_type(field)->index(); 175 const TypePtr* adr_type = phase->C->alias_type(field)->adr_type(); 176 Node* off = phase->MakeConX(field->offset()); 177 Node* next_src = phase->transform(new AddPNode(base_src,base_src,off)); 178 Node* next_dest = phase->transform(new AddPNode(base_dest,base_dest,off)); 179 BasicType bt = field->layout_type(); 180 181 const Type *type; 182 if (bt == T_OBJECT) { 183 if (!field->type()->is_loaded()) { 184 type = TypeInstPtr::BOTTOM; 185 } else { 186 ciType* field_klass = field->type(); 187 type = TypeOopPtr::make_from_klass(field_klass->as_klass()); 188 } 189 } else { 190 type = Type::get_const_basic_type(bt); 191 } 192 193 Node* v = LoadNode::make(*phase, ctl, mem->memory_at(fieldidx), next_src, adr_type, type, bt, MemNode::unordered); 194 v = phase->transform(v); 195 Node* s = StoreNode::make(*phase, ctl, mem->memory_at(fieldidx), next_dest, adr_type, v, bt, MemNode::unordered); 196 s = phase->transform(s); 197 mem->set_memory_at(fieldidx, s); 198 } 199 200 if (!finish_transform(phase, can_reshape, ctl, mem)) { 201 return NULL; 202 } 203 204 return mem; 205 } 206 207 bool ArrayCopyNode::prepare_array_copy(PhaseGVN *phase, bool can_reshape, 208 Node*& adr_src, 209 Node*& base_src, 210 Node*& adr_dest, 211 Node*& base_dest, 212 BasicType& copy_type, 213 const Type*& value_type, 214 bool& disjoint_bases) { 215 Node* src = in(ArrayCopyNode::Src); 216 Node* dest = in(ArrayCopyNode::Dest); 217 const Type* src_type = phase->type(src); 218 const TypeAryPtr* ary_src = src_type->isa_aryptr(); 219 220 if (is_arraycopy() || is_copyofrange() || is_copyof()) { 221 const Type* dest_type = phase->type(dest); 222 const TypeAryPtr* ary_dest = dest_type->isa_aryptr(); 223 Node* src_offset = in(ArrayCopyNode::SrcPos); 224 Node* dest_offset = in(ArrayCopyNode::DestPos); 225 226 // newly allocated object is guaranteed to not overlap with source object 227 disjoint_bases = is_alloc_tightly_coupled(); 228 229 if (ary_src == NULL || ary_src->klass() == NULL || 230 ary_dest == NULL || ary_dest->klass() == NULL) { 231 // We don't know if arguments are arrays 232 return false; 233 } 234 235 BasicType src_elem = ary_src->klass()->as_array_klass()->element_type()->basic_type(); 236 BasicType dest_elem = ary_dest->klass()->as_array_klass()->element_type()->basic_type(); 237 if (src_elem == T_ARRAY) src_elem = T_OBJECT; 238 if (dest_elem == T_ARRAY) dest_elem = T_OBJECT; 239 240 if (src_elem != dest_elem || dest_elem == T_VOID) { 241 // We don't know if arguments are arrays of the same type 242 return false; 243 } 244 245 if (dest_elem == T_OBJECT && (!is_alloc_tightly_coupled() || !GraphKit::use_ReduceInitialCardMarks())) { 246 // It's an object array copy but we can't emit the card marking 247 // that is needed 248 return false; 249 } 250 251 value_type = ary_src->elem(); 252 253 base_src = src; 254 base_dest = dest; 255 256 uint shift = exact_log2(type2aelembytes(dest_elem)); 257 uint header = arrayOopDesc::base_offset_in_bytes(dest_elem); 258 259 adr_src = src; 260 adr_dest = dest; 261 262 src_offset = Compile::conv_I2X_index(phase, src_offset, ary_src->size()); 263 dest_offset = Compile::conv_I2X_index(phase, dest_offset, ary_dest->size()); 264 265 Node* src_scale = phase->transform(new LShiftXNode(src_offset, phase->intcon(shift))); 266 Node* dest_scale = phase->transform(new LShiftXNode(dest_offset, phase->intcon(shift))); 267 268 adr_src = phase->transform(new AddPNode(base_src, adr_src, src_scale)); 269 adr_dest = phase->transform(new AddPNode(base_dest, adr_dest, dest_scale)); 270 271 adr_src = new AddPNode(base_src, adr_src, phase->MakeConX(header)); 272 adr_dest = new AddPNode(base_dest, adr_dest, phase->MakeConX(header)); 273 274 adr_src = phase->transform(adr_src); 275 adr_dest = phase->transform(adr_dest); 276 277 copy_type = dest_elem; 278 } else { 279 assert (is_clonebasic(), "should be"); 280 281 disjoint_bases = true; 282 assert(src->is_AddP(), "should be base + off"); 283 assert(dest->is_AddP(), "should be base + off"); 284 adr_src = src; 285 base_src = src->in(AddPNode::Base); 286 adr_dest = dest; 287 base_dest = dest->in(AddPNode::Base); 288 289 assert(phase->type(src->in(AddPNode::Offset))->is_intptr_t()->get_con() == phase->type(dest->in(AddPNode::Offset))->is_intptr_t()->get_con(), "same start offset?"); 290 BasicType elem = ary_src->klass()->as_array_klass()->element_type()->basic_type(); 291 if (elem == T_ARRAY) elem = T_OBJECT; 292 293 int diff = arrayOopDesc::base_offset_in_bytes(elem) - phase->type(src->in(AddPNode::Offset))->is_intptr_t()->get_con(); 294 assert(diff >= 0, "clone should not start after 1st array element"); 295 if (diff > 0) { 296 adr_src = phase->transform(new AddPNode(base_src, adr_src, phase->MakeConX(diff))); 297 adr_dest = phase->transform(new AddPNode(base_dest, adr_dest, phase->MakeConX(diff))); 298 } 299 300 copy_type = elem; 301 value_type = ary_src->elem(); 302 } 303 return true; 304 } 305 306 const TypePtr* ArrayCopyNode::get_address_type(PhaseGVN *phase, Node* n) { 307 const Type* at = phase->type(n); 308 assert(at != Type::TOP, "unexpected type"); 309 const TypePtr* atp = at->isa_ptr(); 310 // adjust atp to be the correct array element address type 311 atp = atp->add_offset(Type::OffsetBot); 312 return atp; 313 } 314 315 void ArrayCopyNode::array_copy_test_overlap(PhaseGVN *phase, bool can_reshape, bool disjoint_bases, int count, Node*& forward_ctl, Node*& backward_ctl) { 316 Node* ctl = in(TypeFunc::Control); 317 if (!disjoint_bases && count > 1) { 318 Node* src_offset = in(ArrayCopyNode::SrcPos); 319 Node* dest_offset = in(ArrayCopyNode::DestPos); 320 assert(src_offset != NULL && dest_offset != NULL, "should be"); 321 Node* cmp = phase->transform(new CmpINode(src_offset, dest_offset)); 322 Node *bol = phase->transform(new BoolNode(cmp, BoolTest::lt)); 323 IfNode *iff = new IfNode(ctl, bol, PROB_FAIR, COUNT_UNKNOWN); 324 325 phase->transform(iff); 326 327 forward_ctl = phase->transform(new IfFalseNode(iff)); 328 backward_ctl = phase->transform(new IfTrueNode(iff)); 329 } else { 330 forward_ctl = ctl; 331 } 332 } 333 334 Node* ArrayCopyNode::array_copy_forward(PhaseGVN *phase, 335 bool can_reshape, 336 Node* forward_ctl, 337 Node* start_mem_src, 338 Node* start_mem_dest, 339 const TypePtr* atp_src, 340 const TypePtr* atp_dest, 341 Node* adr_src, 342 Node* base_src, 343 Node* adr_dest, 344 Node* base_dest, 345 BasicType copy_type, 346 const Type* value_type, 347 int count) { 348 Node* mem = phase->C->top(); 349 if (!forward_ctl->is_top()) { 350 // copy forward 351 mem = start_mem_dest; 352 353 if (count > 0) { 354 Node* v = LoadNode::make(*phase, forward_ctl, start_mem_src, adr_src, atp_src, value_type, copy_type, MemNode::unordered); 355 v = phase->transform(v); 356 mem = StoreNode::make(*phase, forward_ctl, mem, adr_dest, atp_dest, v, copy_type, MemNode::unordered); 357 mem = phase->transform(mem); 358 for (int i = 1; i < count; i++) { 359 Node* off = phase->MakeConX(type2aelembytes(copy_type) * i); 360 Node* next_src = phase->transform(new AddPNode(base_src,adr_src,off)); 361 Node* next_dest = phase->transform(new AddPNode(base_dest,adr_dest,off)); 362 v = LoadNode::make(*phase, forward_ctl, mem, next_src, atp_src, value_type, copy_type, MemNode::unordered); 363 v = phase->transform(v); 364 mem = StoreNode::make(*phase, forward_ctl,mem,next_dest,atp_dest,v, copy_type, MemNode::unordered); 365 mem = phase->transform(mem); 366 } 367 } else if(can_reshape) { 368 PhaseIterGVN* igvn = phase->is_IterGVN(); 369 igvn->_worklist.push(adr_src); 370 igvn->_worklist.push(adr_dest); 371 } 372 } 373 return mem; 374 } 375 376 Node* ArrayCopyNode::array_copy_backward(PhaseGVN *phase, 377 bool can_reshape, 378 Node* backward_ctl, 379 Node* start_mem_src, 380 Node* start_mem_dest, 381 const TypePtr* atp_src, 382 const TypePtr* atp_dest, 383 Node* adr_src, 384 Node* base_src, 385 Node* adr_dest, 386 Node* base_dest, 387 BasicType copy_type, 388 const Type* value_type, 389 int count) { 390 Node* mem = phase->C->top(); 391 if (!backward_ctl->is_top()) { 392 // copy backward 393 mem = start_mem_dest; 394 395 if (count > 0) { 396 for (int i = count-1; i >= 1; i--) { 397 Node* off = phase->MakeConX(type2aelembytes(copy_type) * i); 398 Node* next_src = phase->transform(new AddPNode(base_src,adr_src,off)); 399 Node* next_dest = phase->transform(new AddPNode(base_dest,adr_dest,off)); 400 Node* v = LoadNode::make(*phase, backward_ctl, mem, next_src, atp_src, value_type, copy_type, MemNode::unordered); 401 v = phase->transform(v); 402 mem = StoreNode::make(*phase, backward_ctl,mem,next_dest,atp_dest,v, copy_type, MemNode::unordered); 403 mem = phase->transform(mem); 404 } 405 Node* v = LoadNode::make(*phase, backward_ctl, mem, adr_src, atp_src, value_type, copy_type, MemNode::unordered); 406 v = phase->transform(v); 407 mem = StoreNode::make(*phase, backward_ctl, mem, adr_dest, atp_dest, v, copy_type, MemNode::unordered); 408 mem = phase->transform(mem); 409 } else if(can_reshape) { 410 PhaseIterGVN* igvn = phase->is_IterGVN(); 411 igvn->_worklist.push(adr_src); 412 igvn->_worklist.push(adr_dest); 413 } 414 } 415 return mem; 416 } 417 418 bool ArrayCopyNode::finish_transform(PhaseGVN *phase, bool can_reshape, 419 Node* ctl, Node *mem) { 420 if (can_reshape) { 421 PhaseIterGVN* igvn = phase->is_IterGVN(); 422 igvn->set_delay_transform(false); 423 if (is_clonebasic()) { 424 Node* out_mem = proj_out(TypeFunc::Memory); 425 426 if (out_mem->outcnt() != 1 || !out_mem->raw_out(0)->is_MergeMem() || 427 out_mem->raw_out(0)->outcnt() != 1 || !out_mem->raw_out(0)->raw_out(0)->is_MemBar()) { 428 assert(!GraphKit::use_ReduceInitialCardMarks(), "can only happen with card marking"); 429 return false; 430 } 431 432 igvn->replace_node(out_mem->raw_out(0), mem); 433 434 Node* out_ctl = proj_out(TypeFunc::Control); 435 igvn->replace_node(out_ctl, ctl); 436 } else { 437 // replace fallthrough projections of the ArrayCopyNode by the 438 // new memory, control and the input IO. 439 CallProjections callprojs; 440 extract_projections(&callprojs, true); 441 442 igvn->replace_node(callprojs.fallthrough_ioproj, in(TypeFunc::I_O)); 443 igvn->replace_node(callprojs.fallthrough_memproj, mem); 444 igvn->replace_node(callprojs.fallthrough_catchproj, ctl); 445 446 // The ArrayCopyNode is not disconnected. It still has the 447 // projections for the exception case. Replace current 448 // ArrayCopyNode with a dummy new one with a top() control so 449 // that this part of the graph stays consistent but is 450 // eventually removed. 451 452 set_req(0, phase->C->top()); 453 remove_dead_region(phase, can_reshape); 454 } 455 } else { 456 if (in(TypeFunc::Control) != ctl) { 457 // we can't return new memory and control from Ideal at parse time 458 assert(!is_clonebasic(), "added control for clone?"); 459 return false; 460 } 461 } 462 return true; 463 } 464 465 466 Node *ArrayCopyNode::Ideal(PhaseGVN *phase, bool can_reshape) { 467 if (remove_dead_region(phase, can_reshape)) return this; 468 469 if (StressArrayCopyMacroNode && !can_reshape) { 470 phase->record_for_igvn(this); 471 return NULL; 472 } 473 474 // See if it's a small array copy and we can inline it as 475 // loads/stores 476 // Here we can only do: 477 // - arraycopy if all arguments were validated before and we don't 478 // need card marking 479 // - clone for which we don't need to do card marking 480 481 if (!is_clonebasic() && !is_arraycopy_validated() && 482 !is_copyofrange_validated() && !is_copyof_validated()) { 483 return NULL; 484 } 485 486 if (in(TypeFunc::Control)->is_top() || in(TypeFunc::Memory)->is_top()) { 487 return NULL; 488 } 489 490 int count = get_count(phase); 491 492 if (count < 0 || count > ArrayCopyLoadStoreMaxElem) { 493 return NULL; 494 } 495 496 Node* mem = try_clone_instance(phase, can_reshape, count); 497 if (mem != NULL) { 498 return mem; 499 } 500 501 Node* adr_src = NULL; 502 Node* base_src = NULL; 503 Node* adr_dest = NULL; 504 Node* base_dest = NULL; 505 BasicType copy_type = T_ILLEGAL; 506 const Type* value_type = NULL; 507 bool disjoint_bases = false; 508 509 if (!prepare_array_copy(phase, can_reshape, 510 adr_src, base_src, adr_dest, base_dest, 511 copy_type, value_type, disjoint_bases)) { 512 return NULL; 513 } 514 515 Node* src = in(ArrayCopyNode::Src); 516 Node* dest = in(ArrayCopyNode::Dest); 517 const TypePtr* atp_src = get_address_type(phase, src); 518 const TypePtr* atp_dest = get_address_type(phase, dest); 519 uint alias_idx_src = phase->C->get_alias_index(atp_src); 520 uint alias_idx_dest = phase->C->get_alias_index(atp_dest); 521 522 Node *in_mem = in(TypeFunc::Memory); 523 Node *start_mem_src = in_mem; 524 Node *start_mem_dest = in_mem; 525 if (in_mem->is_MergeMem()) { 526 start_mem_src = in_mem->as_MergeMem()->memory_at(alias_idx_src); 527 start_mem_dest = in_mem->as_MergeMem()->memory_at(alias_idx_dest); 528 } 529 530 531 if (can_reshape) { 532 assert(!phase->is_IterGVN()->delay_transform(), "cannot delay transforms"); 533 phase->is_IterGVN()->set_delay_transform(true); 534 } 535 536 Node* backward_ctl = phase->C->top(); 537 Node* forward_ctl = phase->C->top(); 538 array_copy_test_overlap(phase, can_reshape, disjoint_bases, count, forward_ctl, backward_ctl); 539 540 Node* forward_mem = array_copy_forward(phase, can_reshape, forward_ctl, 541 start_mem_src, start_mem_dest, 542 atp_src, atp_dest, 543 adr_src, base_src, adr_dest, base_dest, 544 copy_type, value_type, count); 545 546 Node* backward_mem = array_copy_backward(phase, can_reshape, backward_ctl, 547 start_mem_src, start_mem_dest, 548 atp_src, atp_dest, 549 adr_src, base_src, adr_dest, base_dest, 550 copy_type, value_type, count); 551 552 Node* ctl = NULL; 553 if (!forward_ctl->is_top() && !backward_ctl->is_top()) { 554 ctl = new RegionNode(3); 555 mem = new PhiNode(ctl, Type::MEMORY, atp_dest); 556 ctl->init_req(1, forward_ctl); 557 mem->init_req(1, forward_mem); 558 ctl->init_req(2, backward_ctl); 559 mem->init_req(2, backward_mem); 560 ctl = phase->transform(ctl); 561 mem = phase->transform(mem); 562 } else if (!forward_ctl->is_top()) { 563 ctl = forward_ctl; 564 mem = forward_mem; 565 } else { 566 assert(!backward_ctl->is_top(), "no copy?"); 567 ctl = backward_ctl; 568 mem = backward_mem; 569 } 570 571 if (can_reshape) { 572 assert(phase->is_IterGVN()->delay_transform(), "should be delaying transforms"); 573 phase->is_IterGVN()->set_delay_transform(false); 574 } 575 576 MergeMemNode* out_mem = MergeMemNode::make(in_mem); 577 out_mem->set_memory_at(alias_idx_dest, mem); 578 mem = out_mem; 579 580 if (!finish_transform(phase, can_reshape, ctl, mem)) { 581 return NULL; 582 } 583 584 return mem; 585 }