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