1 /* |
1 /* |
2 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
202 s = phase->transform(s); |
202 s = phase->transform(s); |
203 mem->set_memory_at(fieldidx, s); |
203 mem->set_memory_at(fieldidx, s); |
204 } |
204 } |
205 |
205 |
206 if (!finish_transform(phase, can_reshape, ctl, mem)) { |
206 if (!finish_transform(phase, can_reshape, ctl, mem)) { |
207 return NULL; |
207 // Return NodeSentinel to indicate that the transform failed |
|
208 return NodeSentinel; |
208 } |
209 } |
209 |
210 |
210 return mem; |
211 return mem; |
211 } |
212 } |
212 |
213 |
220 bool& disjoint_bases) { |
221 bool& disjoint_bases) { |
221 Node* src = in(ArrayCopyNode::Src); |
222 Node* src = in(ArrayCopyNode::Src); |
222 Node* dest = in(ArrayCopyNode::Dest); |
223 Node* dest = in(ArrayCopyNode::Dest); |
223 const Type* src_type = phase->type(src); |
224 const Type* src_type = phase->type(src); |
224 const TypeAryPtr* ary_src = src_type->isa_aryptr(); |
225 const TypeAryPtr* ary_src = src_type->isa_aryptr(); |
|
226 assert(ary_src != NULL, "should be an array copy/clone"); |
225 |
227 |
226 if (is_arraycopy() || is_copyofrange() || is_copyof()) { |
228 if (is_arraycopy() || is_copyofrange() || is_copyof()) { |
227 const Type* dest_type = phase->type(dest); |
229 const Type* dest_type = phase->type(dest); |
228 const TypeAryPtr* ary_dest = dest_type->isa_aryptr(); |
230 const TypeAryPtr* ary_dest = dest_type->isa_aryptr(); |
229 Node* src_offset = in(ArrayCopyNode::SrcPos); |
231 Node* src_offset = in(ArrayCopyNode::SrcPos); |
518 return NULL; |
520 return NULL; |
519 } |
521 } |
520 |
522 |
521 Node* mem = try_clone_instance(phase, can_reshape, count); |
523 Node* mem = try_clone_instance(phase, can_reshape, count); |
522 if (mem != NULL) { |
524 if (mem != NULL) { |
523 return mem; |
525 return (mem == NodeSentinel) ? NULL : mem; |
524 } |
526 } |
525 |
527 |
526 Node* adr_src = NULL; |
528 Node* adr_src = NULL; |
527 Node* base_src = NULL; |
529 Node* base_src = NULL; |
528 Node* adr_dest = NULL; |
530 Node* adr_dest = NULL; |
625 } |
627 } |
626 |
628 |
627 return CallNode::may_modify_arraycopy_helper(dest_t, t_oop, phase); |
629 return CallNode::may_modify_arraycopy_helper(dest_t, t_oop, phase); |
628 } |
630 } |
629 |
631 |
630 bool ArrayCopyNode::may_modify_helper(const TypeOopPtr *t_oop, Node* n, PhaseTransform *phase) { |
632 bool ArrayCopyNode::may_modify_helper(const TypeOopPtr *t_oop, Node* n, PhaseTransform *phase, ArrayCopyNode*& ac) { |
631 if (n->is_Proj()) { |
633 if (n->is_Proj()) { |
632 n = n->in(0); |
634 n = n->in(0); |
633 if (n->is_Call() && n->as_Call()->may_modify(t_oop, phase)) { |
635 if (n->is_Call() && n->as_Call()->may_modify(t_oop, phase)) { |
|
636 if (n->isa_ArrayCopy() != NULL) { |
|
637 ac = n->as_ArrayCopy(); |
|
638 } |
634 return true; |
639 return true; |
635 } |
640 } |
636 } |
641 } |
637 return false; |
642 return false; |
638 } |
643 } |
639 |
644 |
640 bool ArrayCopyNode::may_modify(const TypeOopPtr *t_oop, MemBarNode* mb, PhaseTransform *phase) { |
645 bool ArrayCopyNode::may_modify(const TypeOopPtr *t_oop, MemBarNode* mb, PhaseTransform *phase, ArrayCopyNode*& ac) { |
641 Node* mem = mb->in(TypeFunc::Memory); |
646 Node* mem = mb->in(TypeFunc::Memory); |
642 |
647 |
643 if (mem->is_MergeMem()) { |
648 if (mem->is_MergeMem()) { |
644 Node* n = mem->as_MergeMem()->memory_at(Compile::AliasIdxRaw); |
649 Node* n = mem->as_MergeMem()->memory_at(Compile::AliasIdxRaw); |
645 if (may_modify_helper(t_oop, n, phase)) { |
650 if (may_modify_helper(t_oop, n, phase, ac)) { |
646 return true; |
651 return true; |
647 } else if (n->is_Phi()) { |
652 } else if (n->is_Phi()) { |
648 for (uint i = 1; i < n->req(); i++) { |
653 for (uint i = 1; i < n->req(); i++) { |
649 if (n->in(i) != NULL) { |
654 if (n->in(i) != NULL) { |
650 if (may_modify_helper(t_oop, n->in(i), phase)) { |
655 if (may_modify_helper(t_oop, n->in(i), phase, ac)) { |
651 return true; |
656 return true; |
652 } |
657 } |
653 } |
658 } |
654 } |
659 } |
|
660 } else if (n->Opcode() == Op_StoreCM) { |
|
661 // Ignore card mark stores |
|
662 return may_modify_helper(t_oop, n->in(MemNode::Memory), phase, ac); |
655 } |
663 } |
656 } |
664 } |
657 |
665 |
658 return false; |
666 return false; |
659 } |
667 } |