author | neliasso |
Fri, 06 Nov 2015 16:42:01 +0100 | |
changeset 33639 | e672d407c0d9 |
parent 33628 | 09241459a8b8 |
child 34148 | 6efbc7ffd767 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
29086
74100114a95a
8069412: Locks need better debug-printing support
drchase
parents:
28920
diff
changeset
|
2 |
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. |
1 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5534
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5534
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5534
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#include "precompiled.hpp" |
26 |
#include "ci/bcEscapeAnalyzer.hpp" |
|
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
27 |
#include "compiler/compileLog.hpp" |
7397 | 28 |
#include "libadt/vectset.hpp" |
29 |
#include "memory/allocation.hpp" |
|
30 |
#include "opto/c2compiler.hpp" |
|
30629
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
31 |
#include "opto/arraycopynode.hpp" |
7397 | 32 |
#include "opto/callnode.hpp" |
33 |
#include "opto/cfgnode.hpp" |
|
34 |
#include "opto/compile.hpp" |
|
35 |
#include "opto/escape.hpp" |
|
36 |
#include "opto/phaseX.hpp" |
|
23528 | 37 |
#include "opto/movenode.hpp" |
7397 | 38 |
#include "opto/rootnode.hpp" |
1 | 39 |
|
5914
8363e7e6915a
6966411: escape.cpp:450 assert(base->Opcode() == Op_ConP
kvn
parents:
5547
diff
changeset
|
40 |
ConnectionGraph::ConnectionGraph(Compile * C, PhaseIterGVN *igvn) : |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
41 |
_nodes(C->comp_arena(), C->unique(), C->unique(), NULL), |
27424
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
42 |
_in_worklist(C->comp_arena()), |
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
43 |
_next_pidx(0), |
952
38812d18eec0
6684714: Optimize EA Connection Graph build performance
kvn
parents:
769
diff
changeset
|
44 |
_collecting(true), |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
45 |
_verify(false), |
952
38812d18eec0
6684714: Optimize EA Connection Graph build performance
kvn
parents:
769
diff
changeset
|
46 |
_compile(C), |
5914
8363e7e6915a
6966411: escape.cpp:450 assert(base->Opcode() == Op_ConP
kvn
parents:
5547
diff
changeset
|
47 |
_igvn(igvn), |
952
38812d18eec0
6684714: Optimize EA Connection Graph build performance
kvn
parents:
769
diff
changeset
|
48 |
_node_map(C->comp_arena()) { |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
49 |
// Add unknown java object. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
50 |
add_java_object(C->top(), PointsToNode::GlobalEscape); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
51 |
phantom_obj = ptnode_adr(C->top()->_idx)->as_JavaObject(); |
961
7fb3b13d4205
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
955
diff
changeset
|
52 |
// Add ConP(#NULL) and ConN(#NULL) nodes. |
7fb3b13d4205
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
955
diff
changeset
|
53 |
Node* oop_null = igvn->zerocon(T_OBJECT); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
54 |
assert(oop_null->_idx < nodes_size(), "should be created already"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
55 |
add_java_object(oop_null, PointsToNode::NoEscape); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
56 |
null_obj = ptnode_adr(oop_null->_idx)->as_JavaObject(); |
961
7fb3b13d4205
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
955
diff
changeset
|
57 |
if (UseCompressedOops) { |
7fb3b13d4205
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
955
diff
changeset
|
58 |
Node* noop_null = igvn->zerocon(T_NARROWOOP); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
59 |
assert(noop_null->_idx < nodes_size(), "should be created already"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
60 |
map_ideal_node(noop_null, null_obj); |
961
7fb3b13d4205
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
955
diff
changeset
|
61 |
} |
11189 | 62 |
_pcmp_neq = NULL; // Should be initialized |
63 |
_pcmp_eq = NULL; |
|
1 | 64 |
} |
65 |
||
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
66 |
bool ConnectionGraph::has_candidates(Compile *C) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
67 |
// EA brings benefits only when the code has allocations and/or locks which |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
68 |
// are represented by ideal Macro nodes. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
69 |
int cnt = C->macro_count(); |
17383 | 70 |
for (int i = 0; i < cnt; i++) { |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
71 |
Node *n = C->macro_node(i); |
17383 | 72 |
if (n->is_Allocate()) |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
73 |
return true; |
17383 | 74 |
if (n->is_Lock()) { |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
75 |
Node* obj = n->as_Lock()->obj_node()->uncast(); |
17383 | 76 |
if (!(obj->is_Parm() || obj->is_Con())) |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
77 |
return true; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
78 |
} |
17383 | 79 |
if (n->is_CallStaticJava() && |
80 |
n->as_CallStaticJava()->is_boxing_method()) { |
|
81 |
return true; |
|
82 |
} |
|
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
83 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
84 |
return false; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
85 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
86 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
87 |
void ConnectionGraph::do_analysis(Compile *C, PhaseIterGVN *igvn) { |
26913 | 88 |
Compile::TracePhase tp("escapeAnalysis", &Phase::timers[Phase::_t_escapeAnalysis]); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
89 |
ResourceMark rm; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
90 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
91 |
// Add ConP#NULL and ConN#NULL nodes before ConnectionGraph construction |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
92 |
// to create space for them in ConnectionGraph::_nodes[]. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
93 |
Node* oop_null = igvn->zerocon(T_OBJECT); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
94 |
Node* noop_null = igvn->zerocon(T_NARROWOOP); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
95 |
ConnectionGraph* congraph = new(C->comp_arena()) ConnectionGraph(C, igvn); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
96 |
// Perform escape analysis |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
97 |
if (congraph->compute_escape()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
98 |
// There are non escaping objects. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
99 |
C->set_congraph(congraph); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
100 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
101 |
// Cleanup. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
102 |
if (oop_null->outcnt() == 0) |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
103 |
igvn->hash_delete(oop_null); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
104 |
if (noop_null->outcnt() == 0) |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
105 |
igvn->hash_delete(noop_null); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
106 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
107 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
108 |
bool ConnectionGraph::compute_escape() { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
109 |
Compile* C = _compile; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
110 |
PhaseGVN* igvn = _igvn; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
111 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
112 |
// Worklists used by EA. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
113 |
Unique_Node_List delayed_worklist; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
114 |
GrowableArray<Node*> alloc_worklist; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
115 |
GrowableArray<Node*> ptr_cmp_worklist; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
116 |
GrowableArray<Node*> storestore_worklist; |
30629
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
117 |
GrowableArray<ArrayCopyNode*> arraycopy_worklist; |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
118 |
GrowableArray<PointsToNode*> ptnodes_worklist; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
119 |
GrowableArray<JavaObjectNode*> java_objects_worklist; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
120 |
GrowableArray<JavaObjectNode*> non_escaped_worklist; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
121 |
GrowableArray<FieldNode*> oop_fields_worklist; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
122 |
DEBUG_ONLY( GrowableArray<Node*> addp_worklist; ) |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
123 |
|
26913 | 124 |
{ Compile::TracePhase tp("connectionGraph", &Phase::timers[Phase::_t_connectionGraph]); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
125 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
126 |
// 1. Populate Connection Graph (CG) with PointsTo nodes. |
17383 | 127 |
ideal_nodes.map(C->live_nodes(), NULL); // preallocate space |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
128 |
// Initialize worklist |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
129 |
if (C->root() != NULL) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
130 |
ideal_nodes.push(C->root()); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
131 |
} |
27424
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
132 |
// Processed ideal nodes are unique on ideal_nodes list |
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
133 |
// but several ideal nodes are mapped to the phantom_obj. |
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
134 |
// To avoid duplicated entries on the following worklists |
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
135 |
// add the phantom_obj only once to them. |
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
136 |
ptnodes_worklist.append(phantom_obj); |
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
137 |
java_objects_worklist.append(phantom_obj); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
138 |
for( uint next = 0; next < ideal_nodes.size(); ++next ) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
139 |
Node* n = ideal_nodes.at(next); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
140 |
// Create PointsTo nodes and add them to Connection Graph. Called |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
141 |
// only once per ideal node since ideal_nodes is Unique_Node list. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
142 |
add_node_to_connection_graph(n, &delayed_worklist); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
143 |
PointsToNode* ptn = ptnode_adr(n->_idx); |
27424
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
144 |
if (ptn != NULL && ptn != phantom_obj) { |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
145 |
ptnodes_worklist.append(ptn); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
146 |
if (ptn->is_JavaObject()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
147 |
java_objects_worklist.append(ptn->as_JavaObject()); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
148 |
if ((n->is_Allocate() || n->is_CallStaticJava()) && |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
149 |
(ptn->escape_state() < PointsToNode::GlobalEscape)) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
150 |
// Only allocations and java static calls results are interesting. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
151 |
non_escaped_worklist.append(ptn->as_JavaObject()); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
152 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
153 |
} else if (ptn->is_Field() && ptn->as_Field()->is_oop()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
154 |
oop_fields_worklist.append(ptn->as_Field()); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
155 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
156 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
157 |
if (n->is_MergeMem()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
158 |
// Collect all MergeMem nodes to add memory slices for |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
159 |
// scalar replaceable objects in split_unique_types(). |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
160 |
_mergemem_worklist.append(n->as_MergeMem()); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
161 |
} else if (OptimizePtrCompare && n->is_Cmp() && |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
162 |
(n->Opcode() == Op_CmpP || n->Opcode() == Op_CmpN)) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
163 |
// Collect compare pointers nodes. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
164 |
ptr_cmp_worklist.append(n); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
165 |
} else if (n->is_MemBarStoreStore()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
166 |
// Collect all MemBarStoreStore nodes so that depending on the |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
167 |
// escape status of the associated Allocate node some of them |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
168 |
// may be eliminated. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
169 |
storestore_worklist.append(n); |
17383 | 170 |
} else if (n->is_MemBar() && (n->Opcode() == Op_MemBarRelease) && |
171 |
(n->req() > MemBarNode::Precedent)) { |
|
172 |
record_for_optimizer(n); |
|
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
173 |
#ifdef ASSERT |
17383 | 174 |
} else if (n->is_AddP()) { |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
175 |
// Collect address nodes for graph verification. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
176 |
addp_worklist.append(n); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
177 |
#endif |
30629
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
178 |
} else if (n->is_ArrayCopy()) { |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
179 |
// Keep a list of ArrayCopy nodes so if one of its input is non |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
180 |
// escaping, we can record a unique type |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
181 |
arraycopy_worklist.append(n->as_ArrayCopy()); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
182 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
183 |
for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
184 |
Node* m = n->fast_out(i); // Get user |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
185 |
ideal_nodes.push(m); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
186 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
187 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
188 |
if (non_escaped_worklist.length() == 0) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
189 |
_collecting = false; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
190 |
return false; // Nothing to do. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
191 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
192 |
// Add final simple edges to graph. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
193 |
while(delayed_worklist.size() > 0) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
194 |
Node* n = delayed_worklist.pop(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
195 |
add_final_edges(n); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
196 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
197 |
int ptnodes_length = ptnodes_worklist.length(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
198 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
199 |
#ifdef ASSERT |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
200 |
if (VerifyConnectionGraph) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
201 |
// Verify that no new simple edges could be created and all |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
202 |
// local vars has edges. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
203 |
_verify = true; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
204 |
for (int next = 0; next < ptnodes_length; ++next) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
205 |
PointsToNode* ptn = ptnodes_worklist.at(next); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
206 |
add_final_edges(ptn->ideal_node()); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
207 |
if (ptn->is_LocalVar() && ptn->edge_count() == 0) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
208 |
ptn->dump(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
209 |
assert(ptn->as_LocalVar()->edge_count() > 0, "sanity"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
210 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
211 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
212 |
_verify = false; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
213 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
214 |
#endif |
28920
254044e6ad7c
8071534: assert(!failing()) failed: Must not have pending failure. Reason is: out of memory
kvn
parents:
28643
diff
changeset
|
215 |
// Bytecode analyzer BCEscapeAnalyzer, used for Call nodes |
254044e6ad7c
8071534: assert(!failing()) failed: Must not have pending failure. Reason is: out of memory
kvn
parents:
28643
diff
changeset
|
216 |
// processing, calls to CI to resolve symbols (types, fields, methods) |
254044e6ad7c
8071534: assert(!failing()) failed: Must not have pending failure. Reason is: out of memory
kvn
parents:
28643
diff
changeset
|
217 |
// referenced in bytecode. During symbol resolution VM may throw |
254044e6ad7c
8071534: assert(!failing()) failed: Must not have pending failure. Reason is: out of memory
kvn
parents:
28643
diff
changeset
|
218 |
// an exception which CI cleans and converts to compilation failure. |
254044e6ad7c
8071534: assert(!failing()) failed: Must not have pending failure. Reason is: out of memory
kvn
parents:
28643
diff
changeset
|
219 |
if (C->failing()) return false; |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
220 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
221 |
// 2. Finish Graph construction by propagating references to all |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
222 |
// java objects through graph. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
223 |
if (!complete_connection_graph(ptnodes_worklist, non_escaped_worklist, |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
224 |
java_objects_worklist, oop_fields_worklist)) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
225 |
// All objects escaped or hit time or iterations limits. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
226 |
_collecting = false; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
227 |
return false; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
228 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
229 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
230 |
// 3. Adjust scalar_replaceable state of nonescaping objects and push |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
231 |
// scalar replaceable allocations on alloc_worklist for processing |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
232 |
// in split_unique_types(). |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
233 |
int non_escaped_length = non_escaped_worklist.length(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
234 |
for (int next = 0; next < non_escaped_length; next++) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
235 |
JavaObjectNode* ptn = non_escaped_worklist.at(next); |
17383 | 236 |
bool noescape = (ptn->escape_state() == PointsToNode::NoEscape); |
237 |
Node* n = ptn->ideal_node(); |
|
238 |
if (n->is_Allocate()) { |
|
239 |
n->as_Allocate()->_is_non_escaping = noescape; |
|
240 |
} |
|
241 |
if (n->is_CallStaticJava()) { |
|
242 |
n->as_CallStaticJava()->_is_non_escaping = noescape; |
|
243 |
} |
|
244 |
if (noescape && ptn->scalar_replaceable()) { |
|
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
245 |
adjust_scalar_replaceable_state(ptn); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
246 |
if (ptn->scalar_replaceable()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
247 |
alloc_worklist.append(ptn->ideal_node()); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
248 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
249 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
250 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
251 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
252 |
#ifdef ASSERT |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
253 |
if (VerifyConnectionGraph) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
254 |
// Verify that graph is complete - no new edges could be added or needed. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
255 |
verify_connection_graph(ptnodes_worklist, non_escaped_worklist, |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
256 |
java_objects_worklist, addp_worklist); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
257 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
258 |
assert(C->unique() == nodes_size(), "no new ideal nodes should be added during ConnectionGraph build"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
259 |
assert(null_obj->escape_state() == PointsToNode::NoEscape && |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
260 |
null_obj->edge_count() == 0 && |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
261 |
!null_obj->arraycopy_src() && |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
262 |
!null_obj->arraycopy_dst(), "sanity"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
263 |
#endif |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
264 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
265 |
_collecting = false; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
266 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
267 |
} // TracePhase t3("connectionGraph") |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
268 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
269 |
// 4. Optimize ideal graph based on EA information. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
270 |
bool has_non_escaping_obj = (non_escaped_worklist.length() > 0); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
271 |
if (has_non_escaping_obj) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
272 |
optimize_ideal_graph(ptr_cmp_worklist, storestore_worklist); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
273 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
274 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
275 |
#ifndef PRODUCT |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
276 |
if (PrintEscapeAnalysis) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
277 |
dump(ptnodes_worklist); // Dump ConnectionGraph |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
278 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
279 |
#endif |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
280 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
281 |
bool has_scalar_replaceable_candidates = (alloc_worklist.length() > 0); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
282 |
#ifdef ASSERT |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
283 |
if (VerifyConnectionGraph) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
284 |
int alloc_length = alloc_worklist.length(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
285 |
for (int next = 0; next < alloc_length; ++next) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
286 |
Node* n = alloc_worklist.at(next); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
287 |
PointsToNode* ptn = ptnode_adr(n->_idx); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
288 |
assert(ptn->escape_state() == PointsToNode::NoEscape && ptn->scalar_replaceable(), "sanity"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
289 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
290 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
291 |
#endif |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
292 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
293 |
// 5. Separate memory graph for scalar replaceable allcations. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
294 |
if (has_scalar_replaceable_candidates && |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
295 |
C->AliasLevel() >= 3 && EliminateAllocations) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
296 |
// Now use the escape information to create unique types for |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
297 |
// scalar replaceable objects. |
30629
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
298 |
split_unique_types(alloc_worklist, arraycopy_worklist); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
299 |
if (C->failing()) return false; |
18025 | 300 |
C->print_method(PHASE_AFTER_EA, 2); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
301 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
302 |
#ifdef ASSERT |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
303 |
} else if (Verbose && (PrintEscapeAnalysis || PrintEliminateAllocations)) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
304 |
tty->print("=== No allocations eliminated for "); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
305 |
C->method()->print_short_name(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
306 |
if(!EliminateAllocations) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
307 |
tty->print(" since EliminateAllocations is off ==="); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
308 |
} else if(!has_scalar_replaceable_candidates) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
309 |
tty->print(" since there are no scalar replaceable candidates ==="); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
310 |
} else if(C->AliasLevel() < 3) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
311 |
tty->print(" since AliasLevel < 3 ==="); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
312 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
313 |
tty->cr(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
314 |
#endif |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
315 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
316 |
return has_non_escaping_obj; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
317 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
318 |
|
13886
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13393
diff
changeset
|
319 |
// Utility function for nodes that load an object |
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13393
diff
changeset
|
320 |
void ConnectionGraph::add_objload_to_connection_graph(Node *n, Unique_Node_List *delayed_worklist) { |
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13393
diff
changeset
|
321 |
// Using isa_ptr() instead of isa_oopptr() for LoadP and Phi because |
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13393
diff
changeset
|
322 |
// ThreadLocal has RawPtr type. |
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13393
diff
changeset
|
323 |
const Type* t = _igvn->type(n); |
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13393
diff
changeset
|
324 |
if (t->make_ptr() != NULL) { |
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13393
diff
changeset
|
325 |
Node* adr = n->in(MemNode::Address); |
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13393
diff
changeset
|
326 |
#ifdef ASSERT |
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13393
diff
changeset
|
327 |
if (!adr->is_AddP()) { |
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13393
diff
changeset
|
328 |
assert(_igvn->type(adr)->isa_rawptr(), "sanity"); |
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13393
diff
changeset
|
329 |
} else { |
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13393
diff
changeset
|
330 |
assert((ptnode_adr(adr->_idx) == NULL || |
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13393
diff
changeset
|
331 |
ptnode_adr(adr->_idx)->as_Field()->is_oop()), "sanity"); |
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13393
diff
changeset
|
332 |
} |
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13393
diff
changeset
|
333 |
#endif |
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13393
diff
changeset
|
334 |
add_local_var_and_edge(n, PointsToNode::NoEscape, |
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13393
diff
changeset
|
335 |
adr, delayed_worklist); |
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13393
diff
changeset
|
336 |
} |
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13393
diff
changeset
|
337 |
} |
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13393
diff
changeset
|
338 |
|
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
339 |
// Populate Connection Graph with PointsTo nodes and create simple |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
340 |
// connection graph edges. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
341 |
void ConnectionGraph::add_node_to_connection_graph(Node *n, Unique_Node_List *delayed_worklist) { |
30629
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
342 |
assert(!_verify, "this method should not be called for verification"); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
343 |
PhaseGVN* igvn = _igvn; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
344 |
uint n_idx = n->_idx; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
345 |
PointsToNode* n_ptn = ptnode_adr(n_idx); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
346 |
if (n_ptn != NULL) |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
347 |
return; // No need to redefine PointsTo node during first iteration. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
348 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
349 |
if (n->is_Call()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
350 |
// Arguments to allocation and locking don't escape. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
351 |
if (n->is_AbstractLock()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
352 |
// Put Lock and Unlock nodes on IGVN worklist to process them during |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
353 |
// first IGVN optimization when escape information is still available. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
354 |
record_for_optimizer(n); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
355 |
} else if (n->is_Allocate()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
356 |
add_call_node(n->as_Call()); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
357 |
record_for_optimizer(n); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
358 |
} else { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
359 |
if (n->is_CallStaticJava()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
360 |
const char* name = n->as_CallStaticJava()->_name; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
361 |
if (name != NULL && strcmp(name, "uncommon_trap") == 0) |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
362 |
return; // Skip uncommon traps |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
363 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
364 |
// Don't mark as processed since call's arguments have to be processed. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
365 |
delayed_worklist->push(n); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
366 |
// Check if a call returns an object. |
17383 | 367 |
if ((n->as_Call()->returns_pointer() && |
368 |
n->as_Call()->proj_out(TypeFunc::Parms) != NULL) || |
|
369 |
(n->is_CallStaticJava() && |
|
370 |
n->as_CallStaticJava()->is_boxing_method())) { |
|
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
371 |
add_call_node(n->as_Call()); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
372 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
373 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
374 |
return; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
375 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
376 |
// Put this check here to process call arguments since some call nodes |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
377 |
// point to phantom_obj. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
378 |
if (n_ptn == phantom_obj || n_ptn == null_obj) |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
379 |
return; // Skip predefined nodes. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
380 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
381 |
int opcode = n->Opcode(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
382 |
switch (opcode) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
383 |
case Op_AddP: { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
384 |
Node* base = get_addp_base(n); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
385 |
PointsToNode* ptn_base = ptnode_adr(base->_idx); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
386 |
// Field nodes are created for all field types. They are used in |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
387 |
// adjust_scalar_replaceable_state() and split_unique_types(). |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
388 |
// Note, non-oop fields will have only base edges in Connection |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
389 |
// Graph because such fields are not used for oop loads and stores. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
390 |
int offset = address_offset(n, igvn); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
391 |
add_field(n, PointsToNode::NoEscape, offset); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
392 |
if (ptn_base == NULL) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
393 |
delayed_worklist->push(n); // Process it later. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
394 |
} else { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
395 |
n_ptn = ptnode_adr(n_idx); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
396 |
add_base(n_ptn->as_Field(), ptn_base); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
397 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
398 |
break; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
399 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
400 |
case Op_CastX2P: { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
401 |
map_ideal_node(n, phantom_obj); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
402 |
break; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
403 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
404 |
case Op_CastPP: |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
405 |
case Op_CheckCastPP: |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
406 |
case Op_EncodeP: |
13969
d2a189b83b87
7054512: Compress class pointers after perm gen removal
roland
parents:
13886
diff
changeset
|
407 |
case Op_DecodeN: |
d2a189b83b87
7054512: Compress class pointers after perm gen removal
roland
parents:
13886
diff
changeset
|
408 |
case Op_EncodePKlass: |
d2a189b83b87
7054512: Compress class pointers after perm gen removal
roland
parents:
13886
diff
changeset
|
409 |
case Op_DecodeNKlass: { |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
410 |
add_local_var_and_edge(n, PointsToNode::NoEscape, |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
411 |
n->in(1), delayed_worklist); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
412 |
break; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
413 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
414 |
case Op_CMoveP: { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
415 |
add_local_var(n, PointsToNode::NoEscape); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
416 |
// Do not add edges during first iteration because some could be |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
417 |
// not defined yet. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
418 |
delayed_worklist->push(n); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
419 |
break; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
420 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
421 |
case Op_ConP: |
13969
d2a189b83b87
7054512: Compress class pointers after perm gen removal
roland
parents:
13886
diff
changeset
|
422 |
case Op_ConN: |
d2a189b83b87
7054512: Compress class pointers after perm gen removal
roland
parents:
13886
diff
changeset
|
423 |
case Op_ConNKlass: { |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
424 |
// assume all oop constants globally escape except for null |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
425 |
PointsToNode::EscapeState es; |
17383 | 426 |
const Type* t = igvn->type(n); |
427 |
if (t == TypePtr::NULL_PTR || t == TypeNarrowOop::NULL_PTR) { |
|
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
428 |
es = PointsToNode::NoEscape; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
429 |
} else { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
430 |
es = PointsToNode::GlobalEscape; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
431 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
432 |
add_java_object(n, es); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
433 |
break; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
434 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
435 |
case Op_CreateEx: { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
436 |
// assume that all exception objects globally escape |
27424
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
437 |
map_ideal_node(n, phantom_obj); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
438 |
break; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
439 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
440 |
case Op_LoadKlass: |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
441 |
case Op_LoadNKlass: { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
442 |
// Unknown class is loaded |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
443 |
map_ideal_node(n, phantom_obj); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
444 |
break; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
445 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
446 |
case Op_LoadP: |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
447 |
case Op_LoadN: |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
448 |
case Op_LoadPLocked: { |
13886
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13393
diff
changeset
|
449 |
add_objload_to_connection_graph(n, delayed_worklist); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
450 |
break; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
451 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
452 |
case Op_Parm: { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
453 |
map_ideal_node(n, phantom_obj); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
454 |
break; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
455 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
456 |
case Op_PartialSubtypeCheck: { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
457 |
// Produces Null or notNull and is used in only in CmpP so |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
458 |
// phantom_obj could be used. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
459 |
map_ideal_node(n, phantom_obj); // Result is unknown |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
460 |
break; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
461 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
462 |
case Op_Phi: { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
463 |
// Using isa_ptr() instead of isa_oopptr() for LoadP and Phi because |
13886
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13393
diff
changeset
|
464 |
// ThreadLocal has RawPtr type. |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
465 |
const Type* t = n->as_Phi()->type(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
466 |
if (t->make_ptr() != NULL) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
467 |
add_local_var(n, PointsToNode::NoEscape); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
468 |
// Do not add edges during first iteration because some could be |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
469 |
// not defined yet. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
470 |
delayed_worklist->push(n); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
471 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
472 |
break; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
473 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
474 |
case Op_Proj: { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
475 |
// we are only interested in the oop result projection from a call |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
476 |
if (n->as_Proj()->_con == TypeFunc::Parms && n->in(0)->is_Call() && |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
477 |
n->in(0)->as_Call()->returns_pointer()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
478 |
add_local_var_and_edge(n, PointsToNode::NoEscape, |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
479 |
n->in(0), delayed_worklist); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
480 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
481 |
break; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
482 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
483 |
case Op_Rethrow: // Exception object escapes |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
484 |
case Op_Return: { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
485 |
if (n->req() > TypeFunc::Parms && |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
486 |
igvn->type(n->in(TypeFunc::Parms))->isa_oopptr()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
487 |
// Treat Return value as LocalVar with GlobalEscape escape state. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
488 |
add_local_var_and_edge(n, PointsToNode::GlobalEscape, |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
489 |
n->in(TypeFunc::Parms), delayed_worklist); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
490 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
491 |
break; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
492 |
} |
13886
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13393
diff
changeset
|
493 |
case Op_GetAndSetP: |
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13393
diff
changeset
|
494 |
case Op_GetAndSetN: { |
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13393
diff
changeset
|
495 |
add_objload_to_connection_graph(n, delayed_worklist); |
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13393
diff
changeset
|
496 |
// fallthrough |
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13393
diff
changeset
|
497 |
} |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
498 |
case Op_StoreP: |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
499 |
case Op_StoreN: |
13969
d2a189b83b87
7054512: Compress class pointers after perm gen removal
roland
parents:
13886
diff
changeset
|
500 |
case Op_StoreNKlass: |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
501 |
case Op_StorePConditional: |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
502 |
case Op_CompareAndSwapP: |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
503 |
case Op_CompareAndSwapN: { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
504 |
Node* adr = n->in(MemNode::Address); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
505 |
const Type *adr_type = igvn->type(adr); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
506 |
adr_type = adr_type->make_ptr(); |
17384
4e6ea5fa04ad
8014189: JVM crash with SEGV in ConnectionGraph::record_for_escape_analysis()
kvn
parents:
17383
diff
changeset
|
507 |
if (adr_type == NULL) { |
4e6ea5fa04ad
8014189: JVM crash with SEGV in ConnectionGraph::record_for_escape_analysis()
kvn
parents:
17383
diff
changeset
|
508 |
break; // skip dead nodes |
4e6ea5fa04ad
8014189: JVM crash with SEGV in ConnectionGraph::record_for_escape_analysis()
kvn
parents:
17383
diff
changeset
|
509 |
} |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
510 |
if (adr_type->isa_oopptr() || |
13969
d2a189b83b87
7054512: Compress class pointers after perm gen removal
roland
parents:
13886
diff
changeset
|
511 |
(opcode == Op_StoreP || opcode == Op_StoreN || opcode == Op_StoreNKlass) && |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
512 |
(adr_type == TypeRawPtr::NOTNULL && |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
513 |
adr->in(AddPNode::Address)->is_Proj() && |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
514 |
adr->in(AddPNode::Address)->in(0)->is_Allocate())) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
515 |
delayed_worklist->push(n); // Process it later. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
516 |
#ifdef ASSERT |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
517 |
assert(adr->is_AddP(), "expecting an AddP"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
518 |
if (adr_type == TypeRawPtr::NOTNULL) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
519 |
// Verify a raw address for a store captured by Initialize node. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
520 |
int offs = (int)igvn->find_intptr_t_con(adr->in(AddPNode::Offset), Type::OffsetBot); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
521 |
assert(offs != Type::OffsetBot, "offset must be a constant"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
522 |
} |
12164
5fa74ba174b7
7154997: assert(false) failed: not G1 barrier raw StoreP
kvn
parents:
12158
diff
changeset
|
523 |
#endif |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
524 |
} else { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
525 |
// Ignore copy the displaced header to the BoxNode (OSR compilation). |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
526 |
if (adr->is_BoxLock()) |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
527 |
break; |
12164
5fa74ba174b7
7154997: assert(false) failed: not G1 barrier raw StoreP
kvn
parents:
12158
diff
changeset
|
528 |
// Stored value escapes in unsafe access. |
31866
3c9022c78e10
8131675: EA fails with assert(false) failed: not unsafe or G1 barrier raw StoreP
vlivanov
parents:
31584
diff
changeset
|
529 |
if ((opcode == Op_StoreP) && adr_type->isa_rawptr()) { |
12164
5fa74ba174b7
7154997: assert(false) failed: not G1 barrier raw StoreP
kvn
parents:
12158
diff
changeset
|
530 |
// Pointer stores in G1 barriers looks like unsafe access. |
5fa74ba174b7
7154997: assert(false) failed: not G1 barrier raw StoreP
kvn
parents:
12158
diff
changeset
|
531 |
// Ignore such stores to be able scalar replace non-escaping |
5fa74ba174b7
7154997: assert(false) failed: not G1 barrier raw StoreP
kvn
parents:
12158
diff
changeset
|
532 |
// allocations. |
5fa74ba174b7
7154997: assert(false) failed: not G1 barrier raw StoreP
kvn
parents:
12158
diff
changeset
|
533 |
if (UseG1GC && adr->is_AddP()) { |
5fa74ba174b7
7154997: assert(false) failed: not G1 barrier raw StoreP
kvn
parents:
12158
diff
changeset
|
534 |
Node* base = get_addp_base(adr); |
5fa74ba174b7
7154997: assert(false) failed: not G1 barrier raw StoreP
kvn
parents:
12158
diff
changeset
|
535 |
if (base->Opcode() == Op_LoadP && |
5fa74ba174b7
7154997: assert(false) failed: not G1 barrier raw StoreP
kvn
parents:
12158
diff
changeset
|
536 |
base->in(MemNode::Address)->is_AddP()) { |
5fa74ba174b7
7154997: assert(false) failed: not G1 barrier raw StoreP
kvn
parents:
12158
diff
changeset
|
537 |
adr = base->in(MemNode::Address); |
5fa74ba174b7
7154997: assert(false) failed: not G1 barrier raw StoreP
kvn
parents:
12158
diff
changeset
|
538 |
Node* tls = get_addp_base(adr); |
5fa74ba174b7
7154997: assert(false) failed: not G1 barrier raw StoreP
kvn
parents:
12158
diff
changeset
|
539 |
if (tls->Opcode() == Op_ThreadLocal) { |
5fa74ba174b7
7154997: assert(false) failed: not G1 barrier raw StoreP
kvn
parents:
12158
diff
changeset
|
540 |
int offs = (int)igvn->find_intptr_t_con(adr->in(AddPNode::Offset), Type::OffsetBot); |
5fa74ba174b7
7154997: assert(false) failed: not G1 barrier raw StoreP
kvn
parents:
12158
diff
changeset
|
541 |
if (offs == in_bytes(JavaThread::satb_mark_queue_offset() + |
5fa74ba174b7
7154997: assert(false) failed: not G1 barrier raw StoreP
kvn
parents:
12158
diff
changeset
|
542 |
PtrQueue::byte_offset_of_buf())) { |
31866
3c9022c78e10
8131675: EA fails with assert(false) failed: not unsafe or G1 barrier raw StoreP
vlivanov
parents:
31584
diff
changeset
|
543 |
break; // G1 pre barrier previous oop value store. |
12164
5fa74ba174b7
7154997: assert(false) failed: not G1 barrier raw StoreP
kvn
parents:
12158
diff
changeset
|
544 |
} |
5fa74ba174b7
7154997: assert(false) failed: not G1 barrier raw StoreP
kvn
parents:
12158
diff
changeset
|
545 |
if (offs == in_bytes(JavaThread::dirty_card_queue_offset() + |
5fa74ba174b7
7154997: assert(false) failed: not G1 barrier raw StoreP
kvn
parents:
12158
diff
changeset
|
546 |
PtrQueue::byte_offset_of_buf())) { |
31866
3c9022c78e10
8131675: EA fails with assert(false) failed: not unsafe or G1 barrier raw StoreP
vlivanov
parents:
31584
diff
changeset
|
547 |
break; // G1 post barrier card address store. |
12164
5fa74ba174b7
7154997: assert(false) failed: not G1 barrier raw StoreP
kvn
parents:
12158
diff
changeset
|
548 |
} |
5fa74ba174b7
7154997: assert(false) failed: not G1 barrier raw StoreP
kvn
parents:
12158
diff
changeset
|
549 |
} |
5fa74ba174b7
7154997: assert(false) failed: not G1 barrier raw StoreP
kvn
parents:
12158
diff
changeset
|
550 |
} |
5fa74ba174b7
7154997: assert(false) failed: not G1 barrier raw StoreP
kvn
parents:
12158
diff
changeset
|
551 |
} |
5fa74ba174b7
7154997: assert(false) failed: not G1 barrier raw StoreP
kvn
parents:
12158
diff
changeset
|
552 |
delayed_worklist->push(n); // Process unsafe access later. |
5fa74ba174b7
7154997: assert(false) failed: not G1 barrier raw StoreP
kvn
parents:
12158
diff
changeset
|
553 |
break; |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
554 |
} |
12164
5fa74ba174b7
7154997: assert(false) failed: not G1 barrier raw StoreP
kvn
parents:
12158
diff
changeset
|
555 |
#ifdef ASSERT |
5fa74ba174b7
7154997: assert(false) failed: not G1 barrier raw StoreP
kvn
parents:
12158
diff
changeset
|
556 |
n->dump(1); |
5fa74ba174b7
7154997: assert(false) failed: not G1 barrier raw StoreP
kvn
parents:
12158
diff
changeset
|
557 |
assert(false, "not unsafe or G1 barrier raw StoreP"); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
558 |
#endif |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
559 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
560 |
break; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
561 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
562 |
case Op_AryEq: |
33628 | 563 |
case Op_HasNegatives: |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
564 |
case Op_StrComp: |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
565 |
case Op_StrEquals: |
15242
695bb216be99
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
14623
diff
changeset
|
566 |
case Op_StrIndexOf: |
33628 | 567 |
case Op_StrIndexOfChar: |
568 |
case Op_StrInflatedCopy: |
|
569 |
case Op_StrCompressedCopy: |
|
15242
695bb216be99
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
14623
diff
changeset
|
570 |
case Op_EncodeISOArray: { |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
571 |
add_local_var(n, PointsToNode::ArgEscape); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
572 |
delayed_worklist->push(n); // Process it later. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
573 |
break; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
574 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
575 |
case Op_ThreadLocal: { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
576 |
add_java_object(n, PointsToNode::ArgEscape); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
577 |
break; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
578 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
579 |
default: |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
580 |
; // Do nothing for nodes not related to EA. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
581 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
582 |
return; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
583 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
584 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
585 |
#ifdef ASSERT |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
586 |
#define ELSE_FAIL(name) \ |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
587 |
/* Should not be called for not pointer type. */ \ |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
588 |
n->dump(1); \ |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
589 |
assert(false, name); \ |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
590 |
break; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
591 |
#else |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
592 |
#define ELSE_FAIL(name) \ |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
593 |
break; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
594 |
#endif |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
595 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
596 |
// Add final simple edges to graph. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
597 |
void ConnectionGraph::add_final_edges(Node *n) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
598 |
PointsToNode* n_ptn = ptnode_adr(n->_idx); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
599 |
#ifdef ASSERT |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
600 |
if (_verify && n_ptn->is_JavaObject()) |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
601 |
return; // This method does not change graph for JavaObject. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
602 |
#endif |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
603 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
604 |
if (n->is_Call()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
605 |
process_call_arguments(n->as_Call()); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
606 |
return; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
607 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
608 |
assert(n->is_Store() || n->is_LoadStore() || |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
609 |
(n_ptn != NULL) && (n_ptn->ideal_node() != NULL), |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
610 |
"node should be registered already"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
611 |
int opcode = n->Opcode(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
612 |
switch (opcode) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
613 |
case Op_AddP: { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
614 |
Node* base = get_addp_base(n); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
615 |
PointsToNode* ptn_base = ptnode_adr(base->_idx); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
616 |
assert(ptn_base != NULL, "field's base should be registered"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
617 |
add_base(n_ptn->as_Field(), ptn_base); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
618 |
break; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
619 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
620 |
case Op_CastPP: |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
621 |
case Op_CheckCastPP: |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
622 |
case Op_EncodeP: |
13969
d2a189b83b87
7054512: Compress class pointers after perm gen removal
roland
parents:
13886
diff
changeset
|
623 |
case Op_DecodeN: |
d2a189b83b87
7054512: Compress class pointers after perm gen removal
roland
parents:
13886
diff
changeset
|
624 |
case Op_EncodePKlass: |
d2a189b83b87
7054512: Compress class pointers after perm gen removal
roland
parents:
13886
diff
changeset
|
625 |
case Op_DecodeNKlass: { |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
626 |
add_local_var_and_edge(n, PointsToNode::NoEscape, |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
627 |
n->in(1), NULL); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
628 |
break; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
629 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
630 |
case Op_CMoveP: { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
631 |
for (uint i = CMoveNode::IfFalse; i < n->req(); i++) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
632 |
Node* in = n->in(i); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
633 |
if (in == NULL) |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
634 |
continue; // ignore NULL |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
635 |
Node* uncast_in = in->uncast(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
636 |
if (uncast_in->is_top() || uncast_in == n) |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
637 |
continue; // ignore top or inputs which go back this node |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
638 |
PointsToNode* ptn = ptnode_adr(in->_idx); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
639 |
assert(ptn != NULL, "node should be registered"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
640 |
add_edge(n_ptn, ptn); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
641 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
642 |
break; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
643 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
644 |
case Op_LoadP: |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
645 |
case Op_LoadN: |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
646 |
case Op_LoadPLocked: { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
647 |
// Using isa_ptr() instead of isa_oopptr() for LoadP and Phi because |
13886
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13393
diff
changeset
|
648 |
// ThreadLocal has RawPtr type. |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
649 |
const Type* t = _igvn->type(n); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
650 |
if (t->make_ptr() != NULL) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
651 |
Node* adr = n->in(MemNode::Address); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
652 |
add_local_var_and_edge(n, PointsToNode::NoEscape, adr, NULL); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
653 |
break; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
654 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
655 |
ELSE_FAIL("Op_LoadP"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
656 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
657 |
case Op_Phi: { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
658 |
// Using isa_ptr() instead of isa_oopptr() for LoadP and Phi because |
13886
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13393
diff
changeset
|
659 |
// ThreadLocal has RawPtr type. |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
660 |
const Type* t = n->as_Phi()->type(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
661 |
if (t->make_ptr() != NULL) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
662 |
for (uint i = 1; i < n->req(); i++) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
663 |
Node* in = n->in(i); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
664 |
if (in == NULL) |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
665 |
continue; // ignore NULL |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
666 |
Node* uncast_in = in->uncast(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
667 |
if (uncast_in->is_top() || uncast_in == n) |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
668 |
continue; // ignore top or inputs which go back this node |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
669 |
PointsToNode* ptn = ptnode_adr(in->_idx); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
670 |
assert(ptn != NULL, "node should be registered"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
671 |
add_edge(n_ptn, ptn); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
672 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
673 |
break; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
674 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
675 |
ELSE_FAIL("Op_Phi"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
676 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
677 |
case Op_Proj: { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
678 |
// we are only interested in the oop result projection from a call |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
679 |
if (n->as_Proj()->_con == TypeFunc::Parms && n->in(0)->is_Call() && |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
680 |
n->in(0)->as_Call()->returns_pointer()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
681 |
add_local_var_and_edge(n, PointsToNode::NoEscape, n->in(0), NULL); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
682 |
break; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
683 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
684 |
ELSE_FAIL("Op_Proj"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
685 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
686 |
case Op_Rethrow: // Exception object escapes |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
687 |
case Op_Return: { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
688 |
if (n->req() > TypeFunc::Parms && |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
689 |
_igvn->type(n->in(TypeFunc::Parms))->isa_oopptr()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
690 |
// Treat Return value as LocalVar with GlobalEscape escape state. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
691 |
add_local_var_and_edge(n, PointsToNode::GlobalEscape, |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
692 |
n->in(TypeFunc::Parms), NULL); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
693 |
break; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
694 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
695 |
ELSE_FAIL("Op_Return"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
696 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
697 |
case Op_StoreP: |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
698 |
case Op_StoreN: |
13969
d2a189b83b87
7054512: Compress class pointers after perm gen removal
roland
parents:
13886
diff
changeset
|
699 |
case Op_StoreNKlass: |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
700 |
case Op_StorePConditional: |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
701 |
case Op_CompareAndSwapP: |
13886
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13393
diff
changeset
|
702 |
case Op_CompareAndSwapN: |
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13393
diff
changeset
|
703 |
case Op_GetAndSetP: |
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13393
diff
changeset
|
704 |
case Op_GetAndSetN: { |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
705 |
Node* adr = n->in(MemNode::Address); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
706 |
const Type *adr_type = _igvn->type(adr); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
707 |
adr_type = adr_type->make_ptr(); |
17384
4e6ea5fa04ad
8014189: JVM crash with SEGV in ConnectionGraph::record_for_escape_analysis()
kvn
parents:
17383
diff
changeset
|
708 |
#ifdef ASSERT |
4e6ea5fa04ad
8014189: JVM crash with SEGV in ConnectionGraph::record_for_escape_analysis()
kvn
parents:
17383
diff
changeset
|
709 |
if (adr_type == NULL) { |
4e6ea5fa04ad
8014189: JVM crash with SEGV in ConnectionGraph::record_for_escape_analysis()
kvn
parents:
17383
diff
changeset
|
710 |
n->dump(1); |
4e6ea5fa04ad
8014189: JVM crash with SEGV in ConnectionGraph::record_for_escape_analysis()
kvn
parents:
17383
diff
changeset
|
711 |
assert(adr_type != NULL, "dead node should not be on list"); |
4e6ea5fa04ad
8014189: JVM crash with SEGV in ConnectionGraph::record_for_escape_analysis()
kvn
parents:
17383
diff
changeset
|
712 |
break; |
4e6ea5fa04ad
8014189: JVM crash with SEGV in ConnectionGraph::record_for_escape_analysis()
kvn
parents:
17383
diff
changeset
|
713 |
} |
4e6ea5fa04ad
8014189: JVM crash with SEGV in ConnectionGraph::record_for_escape_analysis()
kvn
parents:
17383
diff
changeset
|
714 |
#endif |
4e6ea5fa04ad
8014189: JVM crash with SEGV in ConnectionGraph::record_for_escape_analysis()
kvn
parents:
17383
diff
changeset
|
715 |
if (opcode == Op_GetAndSetP || opcode == Op_GetAndSetN) { |
4e6ea5fa04ad
8014189: JVM crash with SEGV in ConnectionGraph::record_for_escape_analysis()
kvn
parents:
17383
diff
changeset
|
716 |
add_local_var_and_edge(n, PointsToNode::NoEscape, adr, NULL); |
4e6ea5fa04ad
8014189: JVM crash with SEGV in ConnectionGraph::record_for_escape_analysis()
kvn
parents:
17383
diff
changeset
|
717 |
} |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
718 |
if (adr_type->isa_oopptr() || |
13969
d2a189b83b87
7054512: Compress class pointers after perm gen removal
roland
parents:
13886
diff
changeset
|
719 |
(opcode == Op_StoreP || opcode == Op_StoreN || opcode == Op_StoreNKlass) && |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
720 |
(adr_type == TypeRawPtr::NOTNULL && |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
721 |
adr->in(AddPNode::Address)->is_Proj() && |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
722 |
adr->in(AddPNode::Address)->in(0)->is_Allocate())) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
723 |
// Point Address to Value |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
724 |
PointsToNode* adr_ptn = ptnode_adr(adr->_idx); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
725 |
assert(adr_ptn != NULL && |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
726 |
adr_ptn->as_Field()->is_oop(), "node should be registered"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
727 |
Node *val = n->in(MemNode::ValueIn); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
728 |
PointsToNode* ptn = ptnode_adr(val->_idx); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
729 |
assert(ptn != NULL, "node should be registered"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
730 |
add_edge(adr_ptn, ptn); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
731 |
break; |
31866
3c9022c78e10
8131675: EA fails with assert(false) failed: not unsafe or G1 barrier raw StoreP
vlivanov
parents:
31584
diff
changeset
|
732 |
} else if ((opcode == Op_StoreP) && adr_type->isa_rawptr()) { |
12164
5fa74ba174b7
7154997: assert(false) failed: not G1 barrier raw StoreP
kvn
parents:
12158
diff
changeset
|
733 |
// Stored value escapes in unsafe access. |
5fa74ba174b7
7154997: assert(false) failed: not G1 barrier raw StoreP
kvn
parents:
12158
diff
changeset
|
734 |
Node *val = n->in(MemNode::ValueIn); |
5fa74ba174b7
7154997: assert(false) failed: not G1 barrier raw StoreP
kvn
parents:
12158
diff
changeset
|
735 |
PointsToNode* ptn = ptnode_adr(val->_idx); |
5fa74ba174b7
7154997: assert(false) failed: not G1 barrier raw StoreP
kvn
parents:
12158
diff
changeset
|
736 |
assert(ptn != NULL, "node should be registered"); |
24021
c55dabab1599
8038048: assert(null_obj->escape_state() == PointsToNode::NoEscape,etc) runThese -full
kvn
parents:
23528
diff
changeset
|
737 |
set_escape_state(ptn, PointsToNode::GlobalEscape); |
12164
5fa74ba174b7
7154997: assert(false) failed: not G1 barrier raw StoreP
kvn
parents:
12158
diff
changeset
|
738 |
// Add edge to object for unsafe access with offset. |
5fa74ba174b7
7154997: assert(false) failed: not G1 barrier raw StoreP
kvn
parents:
12158
diff
changeset
|
739 |
PointsToNode* adr_ptn = ptnode_adr(adr->_idx); |
5fa74ba174b7
7154997: assert(false) failed: not G1 barrier raw StoreP
kvn
parents:
12158
diff
changeset
|
740 |
assert(adr_ptn != NULL, "node should be registered"); |
5fa74ba174b7
7154997: assert(false) failed: not G1 barrier raw StoreP
kvn
parents:
12158
diff
changeset
|
741 |
if (adr_ptn->is_Field()) { |
5fa74ba174b7
7154997: assert(false) failed: not G1 barrier raw StoreP
kvn
parents:
12158
diff
changeset
|
742 |
assert(adr_ptn->as_Field()->is_oop(), "should be oop field"); |
5fa74ba174b7
7154997: assert(false) failed: not G1 barrier raw StoreP
kvn
parents:
12158
diff
changeset
|
743 |
add_edge(adr_ptn, ptn); |
5fa74ba174b7
7154997: assert(false) failed: not G1 barrier raw StoreP
kvn
parents:
12158
diff
changeset
|
744 |
} |
5fa74ba174b7
7154997: assert(false) failed: not G1 barrier raw StoreP
kvn
parents:
12158
diff
changeset
|
745 |
break; |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
746 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
747 |
ELSE_FAIL("Op_StoreP"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
748 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
749 |
case Op_AryEq: |
33628 | 750 |
case Op_HasNegatives: |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
751 |
case Op_StrComp: |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
752 |
case Op_StrEquals: |
15242
695bb216be99
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
14623
diff
changeset
|
753 |
case Op_StrIndexOf: |
33628 | 754 |
case Op_StrIndexOfChar: |
755 |
case Op_StrInflatedCopy: |
|
756 |
case Op_StrCompressedCopy: |
|
15242
695bb216be99
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
14623
diff
changeset
|
757 |
case Op_EncodeISOArray: { |
33628 | 758 |
// char[]/byte[] arrays passed to string intrinsic do not escape but |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
759 |
// they are not scalar replaceable. Adjust escape state for them. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
760 |
// Start from in(2) edge since in(1) is memory edge. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
761 |
for (uint i = 2; i < n->req(); i++) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
762 |
Node* adr = n->in(i); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
763 |
const Type* at = _igvn->type(adr); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
764 |
if (!adr->is_top() && at->isa_ptr()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
765 |
assert(at == Type::TOP || at == TypePtr::NULL_PTR || |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
766 |
at->isa_ptr() != NULL, "expecting a pointer"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
767 |
if (adr->is_AddP()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
768 |
adr = get_addp_base(adr); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
769 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
770 |
PointsToNode* ptn = ptnode_adr(adr->_idx); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
771 |
assert(ptn != NULL, "node should be registered"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
772 |
add_edge(n_ptn, ptn); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
773 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
774 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
775 |
break; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
776 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
777 |
default: { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
778 |
// This method should be called only for EA specific nodes which may |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
779 |
// miss some edges when they were created. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
780 |
#ifdef ASSERT |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
781 |
n->dump(1); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
782 |
#endif |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
783 |
guarantee(false, "unknown node"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
784 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
785 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
786 |
return; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
787 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
788 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
789 |
void ConnectionGraph::add_call_node(CallNode* call) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
790 |
assert(call->returns_pointer(), "only for call which returns pointer"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
791 |
uint call_idx = call->_idx; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
792 |
if (call->is_Allocate()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
793 |
Node* k = call->in(AllocateNode::KlassNode); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
794 |
const TypeKlassPtr* kt = k->bottom_type()->isa_klassptr(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
795 |
assert(kt != NULL, "TypeKlassPtr required."); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
796 |
ciKlass* cik = kt->klass(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
797 |
PointsToNode::EscapeState es = PointsToNode::NoEscape; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
798 |
bool scalar_replaceable = true; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
799 |
if (call->is_AllocateArray()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
800 |
if (!cik->is_array_klass()) { // StressReflectiveCode |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
801 |
es = PointsToNode::GlobalEscape; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
802 |
} else { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
803 |
int length = call->in(AllocateNode::ALength)->find_int_con(-1); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
804 |
if (length < 0 || length > EliminateAllocationArraySizeLimit) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
805 |
// Not scalar replaceable if the length is not constant or too big. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
806 |
scalar_replaceable = false; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
807 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
808 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
809 |
} else { // Allocate instance |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
810 |
if (cik->is_subclass_of(_compile->env()->Thread_klass()) || |
20698 | 811 |
cik->is_subclass_of(_compile->env()->Reference_klass()) || |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
812 |
!cik->is_instance_klass() || // StressReflectiveCode |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
813 |
cik->as_instance_klass()->has_finalizer()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
814 |
es = PointsToNode::GlobalEscape; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
815 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
816 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
817 |
add_java_object(call, es); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
818 |
PointsToNode* ptn = ptnode_adr(call_idx); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
819 |
if (!scalar_replaceable && ptn->scalar_replaceable()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
820 |
ptn->set_scalar_replaceable(false); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
821 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
822 |
} else if (call->is_CallStaticJava()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
823 |
// Call nodes could be different types: |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
824 |
// |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
825 |
// 1. CallDynamicJavaNode (what happened during call is unknown): |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
826 |
// |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
827 |
// - mapped to GlobalEscape JavaObject node if oop is returned; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
828 |
// |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
829 |
// - all oop arguments are escaping globally; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
830 |
// |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
831 |
// 2. CallStaticJavaNode (execute bytecode analysis if possible): |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
832 |
// |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
833 |
// - the same as CallDynamicJavaNode if can't do bytecode analysis; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
834 |
// |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
835 |
// - mapped to GlobalEscape JavaObject node if unknown oop is returned; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
836 |
// - mapped to NoEscape JavaObject node if non-escaping object allocated |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
837 |
// during call is returned; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
838 |
// - mapped to ArgEscape LocalVar node pointed to object arguments |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
839 |
// which are returned and does not escape during call; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
840 |
// |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
841 |
// - oop arguments escaping status is defined by bytecode analysis; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
842 |
// |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
843 |
// For a static call, we know exactly what method is being called. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
844 |
// Use bytecode estimator to record whether the call's return value escapes. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
845 |
ciMethod* meth = call->as_CallJava()->method(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
846 |
if (meth == NULL) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
847 |
const char* name = call->as_CallStaticJava()->_name; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
848 |
assert(strncmp(name, "_multianewarray", 15) == 0, "TODO: add failed case check"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
849 |
// Returns a newly allocated unescaped object. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
850 |
add_java_object(call, PointsToNode::NoEscape); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
851 |
ptnode_adr(call_idx)->set_scalar_replaceable(false); |
17383 | 852 |
} else if (meth->is_boxing_method()) { |
853 |
// Returns boxing object |
|
17386
e3b1a1af9968
8014286: failed java/lang/Math/DivModTests.java after 6934604 changes
kvn
parents:
17384
diff
changeset
|
854 |
PointsToNode::EscapeState es; |
e3b1a1af9968
8014286: failed java/lang/Math/DivModTests.java after 6934604 changes
kvn
parents:
17384
diff
changeset
|
855 |
vmIntrinsics::ID intr = meth->intrinsic_id(); |
e3b1a1af9968
8014286: failed java/lang/Math/DivModTests.java after 6934604 changes
kvn
parents:
17384
diff
changeset
|
856 |
if (intr == vmIntrinsics::_floatValue || intr == vmIntrinsics::_doubleValue) { |
e3b1a1af9968
8014286: failed java/lang/Math/DivModTests.java after 6934604 changes
kvn
parents:
17384
diff
changeset
|
857 |
// It does not escape if object is always allocated. |
e3b1a1af9968
8014286: failed java/lang/Math/DivModTests.java after 6934604 changes
kvn
parents:
17384
diff
changeset
|
858 |
es = PointsToNode::NoEscape; |
e3b1a1af9968
8014286: failed java/lang/Math/DivModTests.java after 6934604 changes
kvn
parents:
17384
diff
changeset
|
859 |
} else { |
e3b1a1af9968
8014286: failed java/lang/Math/DivModTests.java after 6934604 changes
kvn
parents:
17384
diff
changeset
|
860 |
// It escapes globally if object could be loaded from cache. |
e3b1a1af9968
8014286: failed java/lang/Math/DivModTests.java after 6934604 changes
kvn
parents:
17384
diff
changeset
|
861 |
es = PointsToNode::GlobalEscape; |
e3b1a1af9968
8014286: failed java/lang/Math/DivModTests.java after 6934604 changes
kvn
parents:
17384
diff
changeset
|
862 |
} |
e3b1a1af9968
8014286: failed java/lang/Math/DivModTests.java after 6934604 changes
kvn
parents:
17384
diff
changeset
|
863 |
add_java_object(call, es); |
11198
34c860ff41e3
7112478: after 7105605 JRuby bench_define_method_methods.rb fails with NPE
kvn
parents:
11191
diff
changeset
|
864 |
} else { |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
865 |
BCEscapeAnalyzer* call_analyzer = meth->get_bcea(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
866 |
call_analyzer->copy_dependencies(_compile->dependencies()); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
867 |
if (call_analyzer->is_return_allocated()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
868 |
// Returns a newly allocated unescaped object, simply |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
869 |
// update dependency information. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
870 |
// Mark it as NoEscape so that objects referenced by |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
871 |
// it's fields will be marked as NoEscape at least. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
872 |
add_java_object(call, PointsToNode::NoEscape); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
873 |
ptnode_adr(call_idx)->set_scalar_replaceable(false); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
874 |
} else { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
875 |
// Determine whether any arguments are returned. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
876 |
const TypeTuple* d = call->tf()->domain(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
877 |
bool ret_arg = false; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
878 |
for (uint i = TypeFunc::Parms; i < d->cnt(); i++) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
879 |
if (d->field_at(i)->isa_ptr() != NULL && |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
880 |
call_analyzer->is_arg_returned(i - TypeFunc::Parms)) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
881 |
ret_arg = true; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
882 |
break; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
883 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
884 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
885 |
if (ret_arg) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
886 |
add_local_var(call, PointsToNode::ArgEscape); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
887 |
} else { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
888 |
// Returns unknown object. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
889 |
map_ideal_node(call, phantom_obj); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
890 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
891 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
892 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
893 |
} else { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
894 |
// An other type of call, assume the worst case: |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
895 |
// returned value is unknown and globally escapes. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
896 |
assert(call->Opcode() == Op_CallDynamicJava, "add failed case check"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
897 |
map_ideal_node(call, phantom_obj); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
898 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
899 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
900 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
901 |
void ConnectionGraph::process_call_arguments(CallNode *call) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
902 |
bool is_arraycopy = false; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
903 |
switch (call->Opcode()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
904 |
#ifdef ASSERT |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
905 |
case Op_Allocate: |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
906 |
case Op_AllocateArray: |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
907 |
case Op_Lock: |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
908 |
case Op_Unlock: |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
909 |
assert(false, "should be done already"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
910 |
break; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
911 |
#endif |
27142
31444af8b365
8058746: escape analysis special case code for array copy broken by 7173584
roland
parents:
26917
diff
changeset
|
912 |
case Op_ArrayCopy: |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
913 |
case Op_CallLeafNoFP: |
27142
31444af8b365
8058746: escape analysis special case code for array copy broken by 7173584
roland
parents:
26917
diff
changeset
|
914 |
// Most array copies are ArrayCopy nodes at this point but there |
31444af8b365
8058746: escape analysis special case code for array copy broken by 7173584
roland
parents:
26917
diff
changeset
|
915 |
// are still a few direct calls to the copy subroutines (See |
31444af8b365
8058746: escape analysis special case code for array copy broken by 7173584
roland
parents:
26917
diff
changeset
|
916 |
// PhaseStringOpts::copy_string()) |
31444af8b365
8058746: escape analysis special case code for array copy broken by 7173584
roland
parents:
26917
diff
changeset
|
917 |
is_arraycopy = (call->Opcode() == Op_ArrayCopy) || |
30629
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
918 |
call->as_CallLeaf()->is_call_to_arraycopystub(); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
919 |
// fall through |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
920 |
case Op_CallLeaf: { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
921 |
// Stub calls, objects do not escape but they are not scale replaceable. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
922 |
// Adjust escape state for outgoing arguments. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
923 |
const TypeTuple * d = call->tf()->domain(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
924 |
bool src_has_oops = false; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
925 |
for (uint i = TypeFunc::Parms; i < d->cnt(); i++) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
926 |
const Type* at = d->field_at(i); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
927 |
Node *arg = call->in(i); |
27142
31444af8b365
8058746: escape analysis special case code for array copy broken by 7173584
roland
parents:
26917
diff
changeset
|
928 |
if (arg == NULL) { |
31444af8b365
8058746: escape analysis special case code for array copy broken by 7173584
roland
parents:
26917
diff
changeset
|
929 |
continue; |
31444af8b365
8058746: escape analysis special case code for array copy broken by 7173584
roland
parents:
26917
diff
changeset
|
930 |
} |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
931 |
const Type *aat = _igvn->type(arg); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
932 |
if (arg->is_top() || !at->isa_ptr() || !aat->isa_ptr()) |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
933 |
continue; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
934 |
if (arg->is_AddP()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
935 |
// |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
936 |
// The inline_native_clone() case when the arraycopy stub is called |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
937 |
// after the allocation before Initialize and CheckCastPP nodes. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
938 |
// Or normal arraycopy for object arrays case. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
939 |
// |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
940 |
// Set AddP's base (Allocate) as not scalar replaceable since |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
941 |
// pointer to the base (with offset) is passed as argument. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
942 |
// |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
943 |
arg = get_addp_base(arg); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
944 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
945 |
PointsToNode* arg_ptn = ptnode_adr(arg->_idx); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
946 |
assert(arg_ptn != NULL, "should be registered"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
947 |
PointsToNode::EscapeState arg_esc = arg_ptn->escape_state(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
948 |
if (is_arraycopy || arg_esc < PointsToNode::ArgEscape) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
949 |
assert(aat == Type::TOP || aat == TypePtr::NULL_PTR || |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
950 |
aat->isa_ptr() != NULL, "expecting an Ptr"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
951 |
bool arg_has_oops = aat->isa_oopptr() && |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
952 |
(aat->isa_oopptr()->klass() == NULL || aat->isa_instptr() || |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
953 |
(aat->isa_aryptr() && aat->isa_aryptr()->klass()->is_obj_array_klass())); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
954 |
if (i == TypeFunc::Parms) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
955 |
src_has_oops = arg_has_oops; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
956 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
957 |
// |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
958 |
// src or dst could be j.l.Object when other is basic type array: |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
959 |
// |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
960 |
// arraycopy(char[],0,Object*,0,size); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
961 |
// arraycopy(Object*,0,char[],0,size); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
962 |
// |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
963 |
// Don't add edges in such cases. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
964 |
// |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
965 |
bool arg_is_arraycopy_dest = src_has_oops && is_arraycopy && |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
966 |
arg_has_oops && (i > TypeFunc::Parms); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
967 |
#ifdef ASSERT |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
968 |
if (!(is_arraycopy || |
14132 | 969 |
(call->as_CallLeaf()->_name != NULL && |
970 |
(strcmp(call->as_CallLeaf()->_name, "g1_wb_pre") == 0 || |
|
971 |
strcmp(call->as_CallLeaf()->_name, "g1_wb_post") == 0 || |
|
18507
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
18025
diff
changeset
|
972 |
strcmp(call->as_CallLeaf()->_name, "updateBytesCRC32") == 0 || |
31515 | 973 |
strcmp(call->as_CallLeaf()->_name, "updateBytesCRC32C") == 0 || |
32581 | 974 |
strcmp(call->as_CallLeaf()->_name, "updateBytesAdler32") == 0 || |
14132 | 975 |
strcmp(call->as_CallLeaf()->_name, "aescrypt_encryptBlock") == 0 || |
976 |
strcmp(call->as_CallLeaf()->_name, "aescrypt_decryptBlock") == 0 || |
|
977 |
strcmp(call->as_CallLeaf()->_name, "cipherBlockChaining_encryptAESCrypt") == 0 || |
|
24953
9680119572be
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
24021
diff
changeset
|
978 |
strcmp(call->as_CallLeaf()->_name, "cipherBlockChaining_decryptAESCrypt") == 0 || |
31404
63e8fcd70bfc
8073108: Use x86 and SPARC CPU instructions for GHASH acceleration
ascarpino
parents:
31129
diff
changeset
|
979 |
strcmp(call->as_CallLeaf()->_name, "ghash_processBlocks") == 0 || |
24953
9680119572be
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
24021
diff
changeset
|
980 |
strcmp(call->as_CallLeaf()->_name, "sha1_implCompress") == 0 || |
9680119572be
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
24021
diff
changeset
|
981 |
strcmp(call->as_CallLeaf()->_name, "sha1_implCompressMB") == 0 || |
9680119572be
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
24021
diff
changeset
|
982 |
strcmp(call->as_CallLeaf()->_name, "sha256_implCompress") == 0 || |
9680119572be
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
24021
diff
changeset
|
983 |
strcmp(call->as_CallLeaf()->_name, "sha256_implCompressMB") == 0 || |
9680119572be
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
24021
diff
changeset
|
984 |
strcmp(call->as_CallLeaf()->_name, "sha512_implCompress") == 0 || |
26434
09ad55e5f486
8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents:
25930
diff
changeset
|
985 |
strcmp(call->as_CallLeaf()->_name, "sha512_implCompressMB") == 0 || |
31129
02ee7609f0e1
8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents:
30629
diff
changeset
|
986 |
strcmp(call->as_CallLeaf()->_name, "multiplyToLen") == 0 || |
02ee7609f0e1
8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents:
30629
diff
changeset
|
987 |
strcmp(call->as_CallLeaf()->_name, "squareToLen") == 0 || |
31583
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
988 |
strcmp(call->as_CallLeaf()->_name, "mulAdd") == 0 || |
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
989 |
strcmp(call->as_CallLeaf()->_name, "montgomery_multiply") == 0 || |
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
990 |
strcmp(call->as_CallLeaf()->_name, "montgomery_square") == 0) |
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
991 |
))) { |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
992 |
call->dump(); |
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32581
diff
changeset
|
993 |
fatal("EA unexpected CallLeaf %s", call->as_CallLeaf()->_name); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
994 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
995 |
#endif |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
996 |
// Always process arraycopy's destination object since |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
997 |
// we need to add all possible edges to references in |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
998 |
// source object. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
999 |
if (arg_esc >= PointsToNode::ArgEscape && |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1000 |
!arg_is_arraycopy_dest) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1001 |
continue; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1002 |
} |
30629
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
1003 |
PointsToNode::EscapeState es = PointsToNode::ArgEscape; |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
1004 |
if (call->is_ArrayCopy()) { |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
1005 |
ArrayCopyNode* ac = call->as_ArrayCopy(); |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
1006 |
if (ac->is_clonebasic() || |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
1007 |
ac->is_arraycopy_validated() || |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
1008 |
ac->is_copyof_validated() || |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
1009 |
ac->is_copyofrange_validated()) { |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
1010 |
es = PointsToNode::NoEscape; |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
1011 |
} |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
1012 |
} |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
1013 |
set_escape_state(arg_ptn, es); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1014 |
if (arg_is_arraycopy_dest) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1015 |
Node* src = call->in(TypeFunc::Parms); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1016 |
if (src->is_AddP()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1017 |
src = get_addp_base(src); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1018 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1019 |
PointsToNode* src_ptn = ptnode_adr(src->_idx); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1020 |
assert(src_ptn != NULL, "should be registered"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1021 |
if (arg_ptn != src_ptn) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1022 |
// Special arraycopy edge: |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1023 |
// A destination object's field can't have the source object |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1024 |
// as base since objects escape states are not related. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1025 |
// Only escape state of destination object's fields affects |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1026 |
// escape state of fields in source object. |
30629
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
1027 |
add_arraycopy(call, es, src_ptn, arg_ptn); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1028 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1029 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1030 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1031 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1032 |
break; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1033 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1034 |
case Op_CallStaticJava: { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1035 |
// For a static call, we know exactly what method is being called. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1036 |
// Use bytecode estimator to record the call's escape affects |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1037 |
#ifdef ASSERT |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1038 |
const char* name = call->as_CallStaticJava()->_name; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1039 |
assert((name == NULL || strcmp(name, "uncommon_trap") != 0), "normal calls only"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1040 |
#endif |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1041 |
ciMethod* meth = call->as_CallJava()->method(); |
17383 | 1042 |
if ((meth != NULL) && meth->is_boxing_method()) { |
1043 |
break; // Boxing methods do not modify any oops. |
|
1044 |
} |
|
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1045 |
BCEscapeAnalyzer* call_analyzer = (meth !=NULL) ? meth->get_bcea() : NULL; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1046 |
// fall-through if not a Java method or no analyzer information |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1047 |
if (call_analyzer != NULL) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1048 |
PointsToNode* call_ptn = ptnode_adr(call->_idx); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1049 |
const TypeTuple* d = call->tf()->domain(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1050 |
for (uint i = TypeFunc::Parms; i < d->cnt(); i++) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1051 |
const Type* at = d->field_at(i); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1052 |
int k = i - TypeFunc::Parms; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1053 |
Node* arg = call->in(i); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1054 |
PointsToNode* arg_ptn = ptnode_adr(arg->_idx); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1055 |
if (at->isa_ptr() != NULL && |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1056 |
call_analyzer->is_arg_returned(k)) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1057 |
// The call returns arguments. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1058 |
if (call_ptn != NULL) { // Is call's result used? |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1059 |
assert(call_ptn->is_LocalVar(), "node should be registered"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1060 |
assert(arg_ptn != NULL, "node should be registered"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1061 |
add_edge(call_ptn, arg_ptn); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1062 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1063 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1064 |
if (at->isa_oopptr() != NULL && |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1065 |
arg_ptn->escape_state() < PointsToNode::GlobalEscape) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1066 |
if (!call_analyzer->is_arg_stack(k)) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1067 |
// The argument global escapes |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1068 |
set_escape_state(arg_ptn, PointsToNode::GlobalEscape); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1069 |
} else { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1070 |
set_escape_state(arg_ptn, PointsToNode::ArgEscape); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1071 |
if (!call_analyzer->is_arg_local(k)) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1072 |
// The argument itself doesn't escape, but any fields might |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1073 |
set_fields_escape_state(arg_ptn, PointsToNode::GlobalEscape); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1074 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1075 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1076 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1077 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1078 |
if (call_ptn != NULL && call_ptn->is_LocalVar()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1079 |
// The call returns arguments. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1080 |
assert(call_ptn->edge_count() > 0, "sanity"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1081 |
if (!call_analyzer->is_return_local()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1082 |
// Returns also unknown object. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1083 |
add_edge(call_ptn, phantom_obj); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1084 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1085 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1086 |
break; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1087 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1088 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1089 |
default: { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1090 |
// Fall-through here if not a Java method or no analyzer information |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1091 |
// or some other type of call, assume the worst case: all arguments |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1092 |
// globally escape. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1093 |
const TypeTuple* d = call->tf()->domain(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1094 |
for (uint i = TypeFunc::Parms; i < d->cnt(); i++) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1095 |
const Type* at = d->field_at(i); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1096 |
if (at->isa_oopptr() != NULL) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1097 |
Node* arg = call->in(i); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1098 |
if (arg->is_AddP()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1099 |
arg = get_addp_base(arg); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1100 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1101 |
assert(ptnode_adr(arg->_idx) != NULL, "should be defined already"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1102 |
set_escape_state(ptnode_adr(arg->_idx), PointsToNode::GlobalEscape); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1103 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1104 |
} |
11198
34c860ff41e3
7112478: after 7105605 JRuby bench_define_method_methods.rb fails with NPE
kvn
parents:
11191
diff
changeset
|
1105 |
} |
34c860ff41e3
7112478: after 7105605 JRuby bench_define_method_methods.rb fails with NPE
kvn
parents:
11191
diff
changeset
|
1106 |
} |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1107 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1108 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1109 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1110 |
// Finish Graph construction. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1111 |
bool ConnectionGraph::complete_connection_graph( |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1112 |
GrowableArray<PointsToNode*>& ptnodes_worklist, |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1113 |
GrowableArray<JavaObjectNode*>& non_escaped_worklist, |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1114 |
GrowableArray<JavaObjectNode*>& java_objects_worklist, |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1115 |
GrowableArray<FieldNode*>& oop_fields_worklist) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1116 |
// Normally only 1-3 passes needed to build Connection Graph depending |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1117 |
// on graph complexity. Observed 8 passes in jvm2008 compiler.compiler. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1118 |
// Set limit to 20 to catch situation when something did go wrong and |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1119 |
// bailout Escape Analysis. |
27424
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1120 |
// Also limit build time to 20 sec (60 in debug VM), EscapeAnalysisTimeout flag. |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1121 |
#define CG_BUILD_ITER_LIMIT 20 |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1122 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1123 |
// Propagate GlobalEscape and ArgEscape escape states and check that |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1124 |
// we still have non-escaping objects. The method pushs on _worklist |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1125 |
// Field nodes which reference phantom_object. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1126 |
if (!find_non_escaped_objects(ptnodes_worklist, non_escaped_worklist)) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1127 |
return false; // Nothing to do. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1128 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1129 |
// Now propagate references to all JavaObject nodes. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1130 |
int java_objects_length = java_objects_worklist.length(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1131 |
elapsedTimer time; |
27424
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1132 |
bool timeout = false; |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1133 |
int new_edges = 1; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1134 |
int iterations = 0; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1135 |
do { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1136 |
while ((new_edges > 0) && |
27424
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1137 |
(iterations++ < CG_BUILD_ITER_LIMIT)) { |
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1138 |
double start_time = time.seconds(); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1139 |
time.start(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1140 |
new_edges = 0; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1141 |
// Propagate references to phantom_object for nodes pushed on _worklist |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1142 |
// by find_non_escaped_objects() and find_field_value(). |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1143 |
new_edges += add_java_object_edges(phantom_obj, false); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1144 |
for (int next = 0; next < java_objects_length; ++next) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1145 |
JavaObjectNode* ptn = java_objects_worklist.at(next); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1146 |
new_edges += add_java_object_edges(ptn, true); |
27424
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1147 |
|
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1148 |
#define SAMPLE_SIZE 4 |
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1149 |
if ((next % SAMPLE_SIZE) == 0) { |
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1150 |
// Each 4 iterations calculate how much time it will take |
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1151 |
// to complete graph construction. |
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1152 |
time.stop(); |
27919
f1c3cf5737dc
8066199: C2 escape analysis prevents VM from exiting quickly
kvn
parents:
27707
diff
changeset
|
1153 |
// Poll for requests from shutdown mechanism to quiesce compiler |
f1c3cf5737dc
8066199: C2 escape analysis prevents VM from exiting quickly
kvn
parents:
27707
diff
changeset
|
1154 |
// because Connection graph construction may take long time. |
f1c3cf5737dc
8066199: C2 escape analysis prevents VM from exiting quickly
kvn
parents:
27707
diff
changeset
|
1155 |
CompileBroker::maybe_block(); |
27424
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1156 |
double stop_time = time.seconds(); |
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1157 |
double time_per_iter = (stop_time - start_time) / (double)SAMPLE_SIZE; |
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1158 |
double time_until_end = time_per_iter * (double)(java_objects_length - next); |
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1159 |
if ((start_time + time_until_end) >= EscapeAnalysisTimeout) { |
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1160 |
timeout = true; |
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1161 |
break; // Timeout |
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1162 |
} |
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1163 |
start_time = stop_time; |
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1164 |
time.start(); |
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1165 |
} |
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1166 |
#undef SAMPLE_SIZE |
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1167 |
|
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1168 |
} |
27424
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1169 |
if (timeout) break; |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1170 |
if (new_edges > 0) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1171 |
// Update escape states on each iteration if graph was updated. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1172 |
if (!find_non_escaped_objects(ptnodes_worklist, non_escaped_worklist)) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1173 |
return false; // Nothing to do. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1174 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1175 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1176 |
time.stop(); |
27424
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1177 |
if (time.seconds() >= EscapeAnalysisTimeout) { |
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1178 |
timeout = true; |
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1179 |
break; |
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1180 |
} |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1181 |
} |
27424
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1182 |
if ((iterations < CG_BUILD_ITER_LIMIT) && !timeout) { |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1183 |
time.start(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1184 |
// Find fields which have unknown value. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1185 |
int fields_length = oop_fields_worklist.length(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1186 |
for (int next = 0; next < fields_length; next++) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1187 |
FieldNode* field = oop_fields_worklist.at(next); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1188 |
if (field->edge_count() == 0) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1189 |
new_edges += find_field_value(field); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1190 |
// This code may added new edges to phantom_object. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1191 |
// Need an other cycle to propagate references to phantom_object. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1192 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1193 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1194 |
time.stop(); |
27424
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1195 |
if (time.seconds() >= EscapeAnalysisTimeout) { |
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1196 |
timeout = true; |
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1197 |
break; |
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1198 |
} |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1199 |
} else { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1200 |
new_edges = 0; // Bailout |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1201 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1202 |
} while (new_edges > 0); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1203 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1204 |
// Bailout if passed limits. |
27424
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1205 |
if ((iterations >= CG_BUILD_ITER_LIMIT) || timeout) { |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1206 |
Compile* C = _compile; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1207 |
if (C->log() != NULL) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1208 |
C->log()->begin_elem("connectionGraph_bailout reason='reached "); |
27424
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1209 |
C->log()->text("%s", timeout ? "time" : "iterations"); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1210 |
C->log()->end_elem(" limit'"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1211 |
} |
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32581
diff
changeset
|
1212 |
assert(ExitEscapeAnalysisOnTimeout, "infinite EA connection graph build (%f sec, %d iterations) with %d nodes and worklist size %d", |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32581
diff
changeset
|
1213 |
time.seconds(), iterations, nodes_size(), ptnodes_worklist.length()); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1214 |
// Possible infinite build_connection_graph loop, |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1215 |
// bailout (no changes to ideal graph were made). |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1216 |
return false; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1217 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1218 |
#ifdef ASSERT |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1219 |
if (Verbose && PrintEscapeAnalysis) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1220 |
tty->print_cr("EA: %d iterations to build connection graph with %d nodes and worklist size %d", |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1221 |
iterations, nodes_size(), ptnodes_worklist.length()); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1222 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1223 |
#endif |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1224 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1225 |
#undef CG_BUILD_ITER_LIMIT |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1226 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1227 |
// Find fields initialized by NULL for non-escaping Allocations. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1228 |
int non_escaped_length = non_escaped_worklist.length(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1229 |
for (int next = 0; next < non_escaped_length; next++) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1230 |
JavaObjectNode* ptn = non_escaped_worklist.at(next); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1231 |
PointsToNode::EscapeState es = ptn->escape_state(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1232 |
assert(es <= PointsToNode::ArgEscape, "sanity"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1233 |
if (es == PointsToNode::NoEscape) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1234 |
if (find_init_values(ptn, null_obj, _igvn) > 0) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1235 |
// Adding references to NULL object does not change escape states |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1236 |
// since it does not escape. Also no fields are added to NULL object. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1237 |
add_java_object_edges(null_obj, false); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1238 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1239 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1240 |
Node* n = ptn->ideal_node(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1241 |
if (n->is_Allocate()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1242 |
// The object allocated by this Allocate node will never be |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1243 |
// seen by an other thread. Mark it so that when it is |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1244 |
// expanded no MemBarStoreStore is added. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1245 |
InitializeNode* ini = n->as_Allocate()->initialization(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1246 |
if (ini != NULL) |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1247 |
ini->set_does_not_escape(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1248 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1249 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1250 |
return true; // Finished graph construction. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1251 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1252 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1253 |
// Propagate GlobalEscape and ArgEscape escape states to all nodes |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1254 |
// and check that we still have non-escaping java objects. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1255 |
bool ConnectionGraph::find_non_escaped_objects(GrowableArray<PointsToNode*>& ptnodes_worklist, |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1256 |
GrowableArray<JavaObjectNode*>& non_escaped_worklist) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1257 |
GrowableArray<PointsToNode*> escape_worklist; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1258 |
// First, put all nodes with GlobalEscape and ArgEscape states on worklist. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1259 |
int ptnodes_length = ptnodes_worklist.length(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1260 |
for (int next = 0; next < ptnodes_length; ++next) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1261 |
PointsToNode* ptn = ptnodes_worklist.at(next); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1262 |
if (ptn->escape_state() >= PointsToNode::ArgEscape || |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1263 |
ptn->fields_escape_state() >= PointsToNode::ArgEscape) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1264 |
escape_worklist.push(ptn); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1265 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1266 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1267 |
// Set escape states to referenced nodes (edges list). |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1268 |
while (escape_worklist.length() > 0) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1269 |
PointsToNode* ptn = escape_worklist.pop(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1270 |
PointsToNode::EscapeState es = ptn->escape_state(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1271 |
PointsToNode::EscapeState field_es = ptn->fields_escape_state(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1272 |
if (ptn->is_Field() && ptn->as_Field()->is_oop() && |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1273 |
es >= PointsToNode::ArgEscape) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1274 |
// GlobalEscape or ArgEscape state of field means it has unknown value. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1275 |
if (add_edge(ptn, phantom_obj)) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1276 |
// New edge was added |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1277 |
add_field_uses_to_worklist(ptn->as_Field()); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1278 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1279 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1280 |
for (EdgeIterator i(ptn); i.has_next(); i.next()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1281 |
PointsToNode* e = i.get(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1282 |
if (e->is_Arraycopy()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1283 |
assert(ptn->arraycopy_dst(), "sanity"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1284 |
// Propagate only fields escape state through arraycopy edge. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1285 |
if (e->fields_escape_state() < field_es) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1286 |
set_fields_escape_state(e, field_es); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1287 |
escape_worklist.push(e); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1288 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1289 |
} else if (es >= field_es) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1290 |
// fields_escape_state is also set to 'es' if it is less than 'es'. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1291 |
if (e->escape_state() < es) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1292 |
set_escape_state(e, es); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1293 |
escape_worklist.push(e); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1294 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1295 |
} else { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1296 |
// Propagate field escape state. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1297 |
bool es_changed = false; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1298 |
if (e->fields_escape_state() < field_es) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1299 |
set_fields_escape_state(e, field_es); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1300 |
es_changed = true; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1301 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1302 |
if ((e->escape_state() < field_es) && |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1303 |
e->is_Field() && ptn->is_JavaObject() && |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1304 |
e->as_Field()->is_oop()) { |
30629
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
1305 |
// Change escape state of referenced fields. |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1306 |
set_escape_state(e, field_es); |
30629
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
1307 |
es_changed = true; |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1308 |
} else if (e->escape_state() < es) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1309 |
set_escape_state(e, es); |
30629
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
1310 |
es_changed = true; |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1311 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1312 |
if (es_changed) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1313 |
escape_worklist.push(e); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1314 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1315 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1316 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1317 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1318 |
// Remove escaped objects from non_escaped list. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1319 |
for (int next = non_escaped_worklist.length()-1; next >= 0 ; --next) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1320 |
JavaObjectNode* ptn = non_escaped_worklist.at(next); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1321 |
if (ptn->escape_state() >= PointsToNode::GlobalEscape) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1322 |
non_escaped_worklist.delete_at(next); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1323 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1324 |
if (ptn->escape_state() == PointsToNode::NoEscape) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1325 |
// Find fields in non-escaped allocations which have unknown value. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1326 |
find_init_values(ptn, phantom_obj, NULL); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1327 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1328 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1329 |
return (non_escaped_worklist.length() > 0); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1330 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1331 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1332 |
// Add all references to JavaObject node by walking over all uses. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1333 |
int ConnectionGraph::add_java_object_edges(JavaObjectNode* jobj, bool populate_worklist) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1334 |
int new_edges = 0; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1335 |
if (populate_worklist) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1336 |
// Populate _worklist by uses of jobj's uses. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1337 |
for (UseIterator i(jobj); i.has_next(); i.next()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1338 |
PointsToNode* use = i.get(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1339 |
if (use->is_Arraycopy()) |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1340 |
continue; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1341 |
add_uses_to_worklist(use); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1342 |
if (use->is_Field() && use->as_Field()->is_oop()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1343 |
// Put on worklist all field's uses (loads) and |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1344 |
// related field nodes (same base and offset). |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1345 |
add_field_uses_to_worklist(use->as_Field()); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1346 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1347 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1348 |
} |
27424
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1349 |
for (int l = 0; l < _worklist.length(); l++) { |
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1350 |
PointsToNode* use = _worklist.at(l); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1351 |
if (PointsToNode::is_base_use(use)) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1352 |
// Add reference from jobj to field and from field to jobj (field's base). |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1353 |
use = PointsToNode::get_use_node(use)->as_Field(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1354 |
if (add_base(use->as_Field(), jobj)) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1355 |
new_edges++; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1356 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1357 |
continue; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1358 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1359 |
assert(!use->is_JavaObject(), "sanity"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1360 |
if (use->is_Arraycopy()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1361 |
if (jobj == null_obj) // NULL object does not have field edges |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1362 |
continue; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1363 |
// Added edge from Arraycopy node to arraycopy's source java object |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1364 |
if (add_edge(use, jobj)) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1365 |
jobj->set_arraycopy_src(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1366 |
new_edges++; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1367 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1368 |
// and stop here. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1369 |
continue; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1370 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1371 |
if (!add_edge(use, jobj)) |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1372 |
continue; // No new edge added, there was such edge already. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1373 |
new_edges++; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1374 |
if (use->is_LocalVar()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1375 |
add_uses_to_worklist(use); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1376 |
if (use->arraycopy_dst()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1377 |
for (EdgeIterator i(use); i.has_next(); i.next()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1378 |
PointsToNode* e = i.get(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1379 |
if (e->is_Arraycopy()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1380 |
if (jobj == null_obj) // NULL object does not have field edges |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1381 |
continue; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1382 |
// Add edge from arraycopy's destination java object to Arraycopy node. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1383 |
if (add_edge(jobj, e)) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1384 |
new_edges++; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1385 |
jobj->set_arraycopy_dst(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1386 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1387 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1388 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1389 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1390 |
} else { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1391 |
// Added new edge to stored in field values. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1392 |
// Put on worklist all field's uses (loads) and |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1393 |
// related field nodes (same base and offset). |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1394 |
add_field_uses_to_worklist(use->as_Field()); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1395 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1396 |
} |
27424
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1397 |
_worklist.clear(); |
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1398 |
_in_worklist.Reset(); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1399 |
return new_edges; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1400 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1401 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1402 |
// Put on worklist all related field nodes. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1403 |
void ConnectionGraph::add_field_uses_to_worklist(FieldNode* field) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1404 |
assert(field->is_oop(), "sanity"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1405 |
int offset = field->offset(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1406 |
add_uses_to_worklist(field); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1407 |
// Loop over all bases of this field and push on worklist Field nodes |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1408 |
// with the same offset and base (since they may reference the same field). |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1409 |
for (BaseIterator i(field); i.has_next(); i.next()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1410 |
PointsToNode* base = i.get(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1411 |
add_fields_to_worklist(field, base); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1412 |
// Check if the base was source object of arraycopy and go over arraycopy's |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1413 |
// destination objects since values stored to a field of source object are |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1414 |
// accessable by uses (loads) of fields of destination objects. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1415 |
if (base->arraycopy_src()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1416 |
for (UseIterator j(base); j.has_next(); j.next()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1417 |
PointsToNode* arycp = j.get(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1418 |
if (arycp->is_Arraycopy()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1419 |
for (UseIterator k(arycp); k.has_next(); k.next()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1420 |
PointsToNode* abase = k.get(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1421 |
if (abase->arraycopy_dst() && abase != base) { |
30629
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
1422 |
// Look for the same arraycopy reference. |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1423 |
add_fields_to_worklist(field, abase); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1424 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1425 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1426 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1427 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1428 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1429 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1430 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1431 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1432 |
// Put on worklist all related field nodes. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1433 |
void ConnectionGraph::add_fields_to_worklist(FieldNode* field, PointsToNode* base) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1434 |
int offset = field->offset(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1435 |
if (base->is_LocalVar()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1436 |
for (UseIterator j(base); j.has_next(); j.next()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1437 |
PointsToNode* f = j.get(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1438 |
if (PointsToNode::is_base_use(f)) { // Field |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1439 |
f = PointsToNode::get_use_node(f); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1440 |
if (f == field || !f->as_Field()->is_oop()) |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1441 |
continue; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1442 |
int offs = f->as_Field()->offset(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1443 |
if (offs == offset || offset == Type::OffsetBot || offs == Type::OffsetBot) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1444 |
add_to_worklist(f); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1445 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1446 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1447 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1448 |
} else { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1449 |
assert(base->is_JavaObject(), "sanity"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1450 |
if (// Skip phantom_object since it is only used to indicate that |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1451 |
// this field's content globally escapes. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1452 |
(base != phantom_obj) && |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1453 |
// NULL object node does not have fields. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1454 |
(base != null_obj)) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1455 |
for (EdgeIterator i(base); i.has_next(); i.next()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1456 |
PointsToNode* f = i.get(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1457 |
// Skip arraycopy edge since store to destination object field |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1458 |
// does not update value in source object field. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1459 |
if (f->is_Arraycopy()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1460 |
assert(base->arraycopy_dst(), "sanity"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1461 |
continue; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1462 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1463 |
if (f == field || !f->as_Field()->is_oop()) |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1464 |
continue; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1465 |
int offs = f->as_Field()->offset(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1466 |
if (offs == offset || offset == Type::OffsetBot || offs == Type::OffsetBot) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1467 |
add_to_worklist(f); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1468 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1469 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1470 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1471 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1472 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1473 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1474 |
// Find fields which have unknown value. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1475 |
int ConnectionGraph::find_field_value(FieldNode* field) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1476 |
// Escaped fields should have init value already. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1477 |
assert(field->escape_state() == PointsToNode::NoEscape, "sanity"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1478 |
int new_edges = 0; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1479 |
for (BaseIterator i(field); i.has_next(); i.next()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1480 |
PointsToNode* base = i.get(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1481 |
if (base->is_JavaObject()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1482 |
// Skip Allocate's fields which will be processed later. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1483 |
if (base->ideal_node()->is_Allocate()) |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1484 |
return 0; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1485 |
assert(base == null_obj, "only NULL ptr base expected here"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1486 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1487 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1488 |
if (add_edge(field, phantom_obj)) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1489 |
// New edge was added |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1490 |
new_edges++; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1491 |
add_field_uses_to_worklist(field); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1492 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1493 |
return new_edges; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1494 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1495 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1496 |
// Find fields initializing values for allocations. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1497 |
int ConnectionGraph::find_init_values(JavaObjectNode* pta, PointsToNode* init_val, PhaseTransform* phase) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1498 |
assert(pta->escape_state() == PointsToNode::NoEscape, "Not escaped Allocate nodes only"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1499 |
int new_edges = 0; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1500 |
Node* alloc = pta->ideal_node(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1501 |
if (init_val == phantom_obj) { |
30629
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
1502 |
// Do nothing for Allocate nodes since its fields values are |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
1503 |
// "known" unless they are initialized by arraycopy/clone. |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
1504 |
if (alloc->is_Allocate() && !pta->arraycopy_dst()) |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1505 |
return 0; |
30629
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
1506 |
assert(pta->arraycopy_dst() || alloc->as_CallStaticJava(), "sanity"); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1507 |
#ifdef ASSERT |
30629
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
1508 |
if (!pta->arraycopy_dst() && alloc->as_CallStaticJava()->method() == NULL) { |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1509 |
const char* name = alloc->as_CallStaticJava()->_name; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1510 |
assert(strncmp(name, "_multianewarray", 15) == 0, "sanity"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1511 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1512 |
#endif |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1513 |
// Non-escaped allocation returned from Java or runtime call have |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1514 |
// unknown values in fields. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1515 |
for (EdgeIterator i(pta); i.has_next(); i.next()) { |
14395
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1516 |
PointsToNode* field = i.get(); |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1517 |
if (field->is_Field() && field->as_Field()->is_oop()) { |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1518 |
if (add_edge(field, phantom_obj)) { |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1519 |
// New edge was added |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1520 |
new_edges++; |
14395
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1521 |
add_field_uses_to_worklist(field->as_Field()); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1522 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1523 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1524 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1525 |
return new_edges; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1526 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1527 |
assert(init_val == null_obj, "sanity"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1528 |
// Do nothing for Call nodes since its fields values are unknown. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1529 |
if (!alloc->is_Allocate()) |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1530 |
return 0; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1531 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1532 |
InitializeNode* ini = alloc->as_Allocate()->initialization(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1533 |
bool visited_bottom_offset = false; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1534 |
GrowableArray<int> offsets_worklist; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1535 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1536 |
// Check if an oop field's initializing value is recorded and add |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1537 |
// a corresponding NULL if field's value if it is not recorded. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1538 |
// Connection Graph does not record a default initialization by NULL |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1539 |
// captured by Initialize node. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1540 |
// |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1541 |
for (EdgeIterator i(pta); i.has_next(); i.next()) { |
14395
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1542 |
PointsToNode* field = i.get(); // Field (AddP) |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1543 |
if (!field->is_Field() || !field->as_Field()->is_oop()) |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1544 |
continue; // Not oop field |
14395
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1545 |
int offset = field->as_Field()->offset(); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1546 |
if (offset == Type::OffsetBot) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1547 |
if (!visited_bottom_offset) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1548 |
// OffsetBot is used to reference array's element, |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1549 |
// always add reference to NULL to all Field nodes since we don't |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1550 |
// known which element is referenced. |
14395
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1551 |
if (add_edge(field, null_obj)) { |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1552 |
// New edge was added |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1553 |
new_edges++; |
14395
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1554 |
add_field_uses_to_worklist(field->as_Field()); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1555 |
visited_bottom_offset = true; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1556 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1557 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1558 |
} else { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1559 |
// Check only oop fields. |
14395
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1560 |
const Type* adr_type = field->ideal_node()->as_AddP()->bottom_type(); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1561 |
if (adr_type->isa_rawptr()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1562 |
#ifdef ASSERT |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1563 |
// Raw pointers are used for initializing stores so skip it |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1564 |
// since it should be recorded already |
14395
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1565 |
Node* base = get_addp_base(field->ideal_node()); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1566 |
assert(adr_type->isa_rawptr() && base->is_Proj() && |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1567 |
(base->in(0) == alloc),"unexpected pointer type"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1568 |
#endif |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1569 |
continue; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1570 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1571 |
if (!offsets_worklist.contains(offset)) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1572 |
offsets_worklist.append(offset); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1573 |
Node* value = NULL; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1574 |
if (ini != NULL) { |
14395
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1575 |
// StoreP::memory_type() == T_ADDRESS |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1576 |
BasicType ft = UseCompressedOops ? T_NARROWOOP : T_ADDRESS; |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1577 |
Node* store = ini->find_captured_store(offset, type2aelembytes(ft, true), phase); |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1578 |
// Make sure initializing store has the same type as this AddP. |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1579 |
// This AddP may reference non existing field because it is on a |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1580 |
// dead branch of bimorphic call which is not eliminated yet. |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1581 |
if (store != NULL && store->is_Store() && |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1582 |
store->as_Store()->memory_type() == ft) { |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1583 |
value = store->in(MemNode::ValueIn); |
14395
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1584 |
#ifdef ASSERT |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1585 |
if (VerifyConnectionGraph) { |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1586 |
// Verify that AddP already points to all objects the value points to. |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1587 |
PointsToNode* val = ptnode_adr(value->_idx); |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1588 |
assert((val != NULL), "should be processed already"); |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1589 |
PointsToNode* missed_obj = NULL; |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1590 |
if (val->is_JavaObject()) { |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1591 |
if (!field->points_to(val->as_JavaObject())) { |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1592 |
missed_obj = val; |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1593 |
} |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1594 |
} else { |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1595 |
if (!val->is_LocalVar() || (val->edge_count() == 0)) { |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1596 |
tty->print_cr("----------init store has invalid value -----"); |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1597 |
store->dump(); |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1598 |
val->dump(); |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1599 |
assert(val->is_LocalVar() && (val->edge_count() > 0), "should be processed already"); |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1600 |
} |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1601 |
for (EdgeIterator j(val); j.has_next(); j.next()) { |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1602 |
PointsToNode* obj = j.get(); |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1603 |
if (obj->is_JavaObject()) { |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1604 |
if (!field->points_to(obj->as_JavaObject())) { |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1605 |
missed_obj = obj; |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1606 |
break; |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1607 |
} |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1608 |
} |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1609 |
} |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1610 |
} |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1611 |
if (missed_obj != NULL) { |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1612 |
tty->print_cr("----------field---------------------------------"); |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1613 |
field->dump(); |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1614 |
tty->print_cr("----------missed referernce to object-----------"); |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1615 |
missed_obj->dump(); |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1616 |
tty->print_cr("----------object referernced by init store -----"); |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1617 |
store->dump(); |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1618 |
val->dump(); |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1619 |
assert(!field->points_to(missed_obj->as_JavaObject()), "missed JavaObject reference"); |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1620 |
} |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1621 |
} |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1622 |
#endif |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1623 |
} else { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1624 |
// There could be initializing stores which follow allocation. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1625 |
// For example, a volatile field store is not collected |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1626 |
// by Initialize node. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1627 |
// |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1628 |
// Need to check for dependent loads to separate such stores from |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1629 |
// stores which follow loads. For now, add initial value NULL so |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1630 |
// that compare pointers optimization works correctly. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1631 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1632 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1633 |
if (value == NULL) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1634 |
// A field's initializing value was not recorded. Add NULL. |
14395
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1635 |
if (add_edge(field, null_obj)) { |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1636 |
// New edge was added |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1637 |
new_edges++; |
14395
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1638 |
add_field_uses_to_worklist(field->as_Field()); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1639 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1640 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1641 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1642 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1643 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1644 |
return new_edges; |
1 | 1645 |
} |
1646 |
||
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1647 |
// Adjust scalar_replaceable state after Connection Graph is built. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1648 |
void ConnectionGraph::adjust_scalar_replaceable_state(JavaObjectNode* jobj) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1649 |
// Search for non-escaping objects which are not scalar replaceable |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1650 |
// and mark them to propagate the state to referenced objects. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1651 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1652 |
// 1. An object is not scalar replaceable if the field into which it is |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1653 |
// stored has unknown offset (stored into unknown element of an array). |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1654 |
// |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1655 |
for (UseIterator i(jobj); i.has_next(); i.next()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1656 |
PointsToNode* use = i.get(); |
30629
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
1657 |
if (use->is_Arraycopy()) { |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
1658 |
continue; |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
1659 |
} |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1660 |
if (use->is_Field()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1661 |
FieldNode* field = use->as_Field(); |
30629
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
1662 |
assert(field->is_oop() && field->scalar_replaceable(), "sanity"); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1663 |
if (field->offset() == Type::OffsetBot) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1664 |
jobj->set_scalar_replaceable(false); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1665 |
return; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1666 |
} |
22213
8b6e8f6a38ab
8027388: JVM crashes with SIGSEGV (0xb) at pc=0x00000001077cbbf6
iveresov
parents:
20698
diff
changeset
|
1667 |
// 2. An object is not scalar replaceable if the field into which it is |
8b6e8f6a38ab
8027388: JVM crashes with SIGSEGV (0xb) at pc=0x00000001077cbbf6
iveresov
parents:
20698
diff
changeset
|
1668 |
// stored has multiple bases one of which is null. |
8b6e8f6a38ab
8027388: JVM crashes with SIGSEGV (0xb) at pc=0x00000001077cbbf6
iveresov
parents:
20698
diff
changeset
|
1669 |
if (field->base_count() > 1) { |
8b6e8f6a38ab
8027388: JVM crashes with SIGSEGV (0xb) at pc=0x00000001077cbbf6
iveresov
parents:
20698
diff
changeset
|
1670 |
for (BaseIterator i(field); i.has_next(); i.next()) { |
8b6e8f6a38ab
8027388: JVM crashes with SIGSEGV (0xb) at pc=0x00000001077cbbf6
iveresov
parents:
20698
diff
changeset
|
1671 |
PointsToNode* base = i.get(); |
8b6e8f6a38ab
8027388: JVM crashes with SIGSEGV (0xb) at pc=0x00000001077cbbf6
iveresov
parents:
20698
diff
changeset
|
1672 |
if (base == null_obj) { |
8b6e8f6a38ab
8027388: JVM crashes with SIGSEGV (0xb) at pc=0x00000001077cbbf6
iveresov
parents:
20698
diff
changeset
|
1673 |
jobj->set_scalar_replaceable(false); |
8b6e8f6a38ab
8027388: JVM crashes with SIGSEGV (0xb) at pc=0x00000001077cbbf6
iveresov
parents:
20698
diff
changeset
|
1674 |
return; |
8b6e8f6a38ab
8027388: JVM crashes with SIGSEGV (0xb) at pc=0x00000001077cbbf6
iveresov
parents:
20698
diff
changeset
|
1675 |
} |
8b6e8f6a38ab
8027388: JVM crashes with SIGSEGV (0xb) at pc=0x00000001077cbbf6
iveresov
parents:
20698
diff
changeset
|
1676 |
} |
8b6e8f6a38ab
8027388: JVM crashes with SIGSEGV (0xb) at pc=0x00000001077cbbf6
iveresov
parents:
20698
diff
changeset
|
1677 |
} |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1678 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1679 |
assert(use->is_Field() || use->is_LocalVar(), "sanity"); |
22213
8b6e8f6a38ab
8027388: JVM crashes with SIGSEGV (0xb) at pc=0x00000001077cbbf6
iveresov
parents:
20698
diff
changeset
|
1680 |
// 3. An object is not scalar replaceable if it is merged with other objects. |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1681 |
for (EdgeIterator j(use); j.has_next(); j.next()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1682 |
PointsToNode* ptn = j.get(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1683 |
if (ptn->is_JavaObject() && ptn != jobj) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1684 |
// Mark all objects. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1685 |
jobj->set_scalar_replaceable(false); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1686 |
ptn->set_scalar_replaceable(false); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1687 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1688 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1689 |
if (!jobj->scalar_replaceable()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1690 |
return; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1691 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1692 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1693 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1694 |
for (EdgeIterator j(jobj); j.has_next(); j.next()) { |
30629
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
1695 |
if (j.get()->is_Arraycopy()) { |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
1696 |
continue; |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
1697 |
} |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
1698 |
|
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1699 |
// Non-escaping object node should point only to field nodes. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1700 |
FieldNode* field = j.get()->as_Field(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1701 |
int offset = field->as_Field()->offset(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1702 |
|
22213
8b6e8f6a38ab
8027388: JVM crashes with SIGSEGV (0xb) at pc=0x00000001077cbbf6
iveresov
parents:
20698
diff
changeset
|
1703 |
// 4. An object is not scalar replaceable if it has a field with unknown |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1704 |
// offset (array's element is accessed in loop). |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1705 |
if (offset == Type::OffsetBot) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1706 |
jobj->set_scalar_replaceable(false); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1707 |
return; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1708 |
} |
22213
8b6e8f6a38ab
8027388: JVM crashes with SIGSEGV (0xb) at pc=0x00000001077cbbf6
iveresov
parents:
20698
diff
changeset
|
1709 |
// 5. Currently an object is not scalar replaceable if a LoadStore node |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1710 |
// access its field since the field value is unknown after it. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1711 |
// |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1712 |
Node* n = field->ideal_node(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1713 |
for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1714 |
if (n->fast_out(i)->is_LoadStore()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1715 |
jobj->set_scalar_replaceable(false); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1716 |
return; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1717 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1718 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1719 |
|
22213
8b6e8f6a38ab
8027388: JVM crashes with SIGSEGV (0xb) at pc=0x00000001077cbbf6
iveresov
parents:
20698
diff
changeset
|
1720 |
// 6. Or the address may point to more then one object. This may produce |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1721 |
// the false positive result (set not scalar replaceable) |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1722 |
// since the flow-insensitive escape analysis can't separate |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1723 |
// the case when stores overwrite the field's value from the case |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1724 |
// when stores happened on different control branches. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1725 |
// |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1726 |
// Note: it will disable scalar replacement in some cases: |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1727 |
// |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1728 |
// Point p[] = new Point[1]; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1729 |
// p[0] = new Point(); // Will be not scalar replaced |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1730 |
// |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1731 |
// but it will save us from incorrect optimizations in next cases: |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1732 |
// |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1733 |
// Point p[] = new Point[1]; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1734 |
// if ( x ) p[0] = new Point(); // Will be not scalar replaced |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1735 |
// |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1736 |
if (field->base_count() > 1) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1737 |
for (BaseIterator i(field); i.has_next(); i.next()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1738 |
PointsToNode* base = i.get(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1739 |
// Don't take into account LocalVar nodes which |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1740 |
// may point to only one object which should be also |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1741 |
// this field's base by now. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1742 |
if (base->is_JavaObject() && base != jobj) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1743 |
// Mark all bases. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1744 |
jobj->set_scalar_replaceable(false); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1745 |
base->set_scalar_replaceable(false); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1746 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1747 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1748 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1749 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1750 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1751 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1752 |
#ifdef ASSERT |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1753 |
void ConnectionGraph::verify_connection_graph( |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1754 |
GrowableArray<PointsToNode*>& ptnodes_worklist, |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1755 |
GrowableArray<JavaObjectNode*>& non_escaped_worklist, |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1756 |
GrowableArray<JavaObjectNode*>& java_objects_worklist, |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1757 |
GrowableArray<Node*>& addp_worklist) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1758 |
// Verify that graph is complete - no new edges could be added. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1759 |
int java_objects_length = java_objects_worklist.length(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1760 |
int non_escaped_length = non_escaped_worklist.length(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1761 |
int new_edges = 0; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1762 |
for (int next = 0; next < java_objects_length; ++next) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1763 |
JavaObjectNode* ptn = java_objects_worklist.at(next); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1764 |
new_edges += add_java_object_edges(ptn, true); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1765 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1766 |
assert(new_edges == 0, "graph was not complete"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1767 |
// Verify that escape state is final. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1768 |
int length = non_escaped_worklist.length(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1769 |
find_non_escaped_objects(ptnodes_worklist, non_escaped_worklist); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1770 |
assert((non_escaped_length == non_escaped_worklist.length()) && |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1771 |
(non_escaped_length == length) && |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1772 |
(_worklist.length() == 0), "escape state was not final"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1773 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1774 |
// Verify fields information. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1775 |
int addp_length = addp_worklist.length(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1776 |
for (int next = 0; next < addp_length; ++next ) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1777 |
Node* n = addp_worklist.at(next); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1778 |
FieldNode* field = ptnode_adr(n->_idx)->as_Field(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1779 |
if (field->is_oop()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1780 |
// Verify that field has all bases |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1781 |
Node* base = get_addp_base(n); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1782 |
PointsToNode* ptn = ptnode_adr(base->_idx); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1783 |
if (ptn->is_JavaObject()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1784 |
assert(field->has_base(ptn->as_JavaObject()), "sanity"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1785 |
} else { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1786 |
assert(ptn->is_LocalVar(), "sanity"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1787 |
for (EdgeIterator i(ptn); i.has_next(); i.next()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1788 |
PointsToNode* e = i.get(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1789 |
if (e->is_JavaObject()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1790 |
assert(field->has_base(e->as_JavaObject()), "sanity"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1791 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1792 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1793 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1794 |
// Verify that all fields have initializing values. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1795 |
if (field->edge_count() == 0) { |
14395
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1796 |
tty->print_cr("----------field does not have references----------"); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1797 |
field->dump(); |
14395
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1798 |
for (BaseIterator i(field); i.has_next(); i.next()) { |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1799 |
PointsToNode* base = i.get(); |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1800 |
tty->print_cr("----------field has next base---------------------"); |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1801 |
base->dump(); |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1802 |
if (base->is_JavaObject() && (base != phantom_obj) && (base != null_obj)) { |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1803 |
tty->print_cr("----------base has fields-------------------------"); |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1804 |
for (EdgeIterator j(base); j.has_next(); j.next()) { |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1805 |
j.get()->dump(); |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1806 |
} |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1807 |
tty->print_cr("----------base has references---------------------"); |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1808 |
for (UseIterator j(base); j.has_next(); j.next()) { |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1809 |
j.get()->dump(); |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1810 |
} |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1811 |
} |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1812 |
} |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1813 |
for (UseIterator i(field); i.has_next(); i.next()) { |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1814 |
i.get()->dump(); |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1815 |
} |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1816 |
assert(field->edge_count() > 0, "sanity"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1817 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1818 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1819 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1820 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1821 |
#endif |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1822 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1823 |
// Optimize ideal graph. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1824 |
void ConnectionGraph::optimize_ideal_graph(GrowableArray<Node*>& ptr_cmp_worklist, |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1825 |
GrowableArray<Node*>& storestore_worklist) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1826 |
Compile* C = _compile; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1827 |
PhaseIterGVN* igvn = _igvn; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1828 |
if (EliminateLocks) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1829 |
// Mark locks before changing ideal graph. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1830 |
int cnt = C->macro_count(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1831 |
for( int i=0; i < cnt; i++ ) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1832 |
Node *n = C->macro_node(i); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1833 |
if (n->is_AbstractLock()) { // Lock and Unlock nodes |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1834 |
AbstractLockNode* alock = n->as_AbstractLock(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1835 |
if (!alock->is_non_esc_obj()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1836 |
if (not_global_escape(alock->obj_node())) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1837 |
assert(!alock->is_eliminated() || alock->is_coarsened(), "sanity"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1838 |
// The lock could be marked eliminated by lock coarsening |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1839 |
// code during first IGVN before EA. Replace coarsened flag |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1840 |
// to eliminate all associated locks/unlocks. |
29086
74100114a95a
8069412: Locks need better debug-printing support
drchase
parents:
28920
diff
changeset
|
1841 |
#ifdef ASSERT |
74100114a95a
8069412: Locks need better debug-printing support
drchase
parents:
28920
diff
changeset
|
1842 |
alock->log_lock_optimization(C, "eliminate_lock_set_non_esc3"); |
74100114a95a
8069412: Locks need better debug-printing support
drchase
parents:
28920
diff
changeset
|
1843 |
#endif |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1844 |
alock->set_non_esc_obj(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1845 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1846 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1847 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1848 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1849 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1850 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1851 |
if (OptimizePtrCompare) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1852 |
// Add ConI(#CC_GT) and ConI(#CC_EQ). |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1853 |
_pcmp_neq = igvn->makecon(TypeInt::CC_GT); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1854 |
_pcmp_eq = igvn->makecon(TypeInt::CC_EQ); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1855 |
// Optimize objects compare. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1856 |
while (ptr_cmp_worklist.length() != 0) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1857 |
Node *n = ptr_cmp_worklist.pop(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1858 |
Node *res = optimize_ptr_compare(n); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1859 |
if (res != NULL) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1860 |
#ifndef PRODUCT |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1861 |
if (PrintOptimizePtrCompare) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1862 |
tty->print_cr("++++ Replaced: %d %s(%d,%d) --> %s", n->_idx, (n->Opcode() == Op_CmpP ? "CmpP" : "CmpN"), n->in(1)->_idx, n->in(2)->_idx, (res == _pcmp_eq ? "EQ" : "NotEQ")); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1863 |
if (Verbose) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1864 |
n->dump(1); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1865 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1866 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1867 |
#endif |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1868 |
igvn->replace_node(n, res); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1869 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1870 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1871 |
// cleanup |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1872 |
if (_pcmp_neq->outcnt() == 0) |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1873 |
igvn->hash_delete(_pcmp_neq); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1874 |
if (_pcmp_eq->outcnt() == 0) |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1875 |
igvn->hash_delete(_pcmp_eq); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1876 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1877 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1878 |
// For MemBarStoreStore nodes added in library_call.cpp, check |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1879 |
// escape status of associated AllocateNode and optimize out |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1880 |
// MemBarStoreStore node if the allocated object never escapes. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1881 |
while (storestore_worklist.length() != 0) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1882 |
Node *n = storestore_worklist.pop(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1883 |
MemBarStoreStoreNode *storestore = n ->as_MemBarStoreStore(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1884 |
Node *alloc = storestore->in(MemBarNode::Precedent)->in(0); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1885 |
assert (alloc->is_Allocate(), "storestore should point to AllocateNode"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1886 |
if (not_global_escape(alloc)) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1887 |
MemBarNode* mb = MemBarNode::make(C, Op_MemBarCPUOrder, Compile::AliasIdxBot); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1888 |
mb->init_req(TypeFunc::Memory, storestore->in(TypeFunc::Memory)); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1889 |
mb->init_req(TypeFunc::Control, storestore->in(TypeFunc::Control)); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1890 |
igvn->register_new_node_with_optimizer(mb); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1891 |
igvn->replace_node(storestore, mb); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1892 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1893 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1894 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1895 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1896 |
// Optimize objects compare. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1897 |
Node* ConnectionGraph::optimize_ptr_compare(Node* n) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1898 |
assert(OptimizePtrCompare, "sanity"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1899 |
PointsToNode* ptn1 = ptnode_adr(n->in(1)->_idx); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1900 |
PointsToNode* ptn2 = ptnode_adr(n->in(2)->_idx); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1901 |
JavaObjectNode* jobj1 = unique_java_object(n->in(1)); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1902 |
JavaObjectNode* jobj2 = unique_java_object(n->in(2)); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1903 |
assert(ptn1->is_JavaObject() || ptn1->is_LocalVar(), "sanity"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1904 |
assert(ptn2->is_JavaObject() || ptn2->is_LocalVar(), "sanity"); |
1 | 1905 |
|
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1906 |
// Check simple cases first. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1907 |
if (jobj1 != NULL) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1908 |
if (jobj1->escape_state() == PointsToNode::NoEscape) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1909 |
if (jobj1 == jobj2) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1910 |
// Comparing the same not escaping object. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1911 |
return _pcmp_eq; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1912 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1913 |
Node* obj = jobj1->ideal_node(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1914 |
// Comparing not escaping allocation. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1915 |
if ((obj->is_Allocate() || obj->is_CallStaticJava()) && |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1916 |
!ptn2->points_to(jobj1)) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1917 |
return _pcmp_neq; // This includes nullness check. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1918 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1919 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1920 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1921 |
if (jobj2 != NULL) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1922 |
if (jobj2->escape_state() == PointsToNode::NoEscape) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1923 |
Node* obj = jobj2->ideal_node(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1924 |
// Comparing not escaping allocation. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1925 |
if ((obj->is_Allocate() || obj->is_CallStaticJava()) && |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1926 |
!ptn1->points_to(jobj2)) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1927 |
return _pcmp_neq; // This includes nullness check. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1928 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1929 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1930 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1931 |
if (jobj1 != NULL && jobj1 != phantom_obj && |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1932 |
jobj2 != NULL && jobj2 != phantom_obj && |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1933 |
jobj1->ideal_node()->is_Con() && |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1934 |
jobj2->ideal_node()->is_Con()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1935 |
// Klass or String constants compare. Need to be careful with |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1936 |
// compressed pointers - compare types of ConN and ConP instead of nodes. |
17384
4e6ea5fa04ad
8014189: JVM crash with SEGV in ConnectionGraph::record_for_escape_analysis()
kvn
parents:
17383
diff
changeset
|
1937 |
const Type* t1 = jobj1->ideal_node()->get_ptr_type(); |
4e6ea5fa04ad
8014189: JVM crash with SEGV in ConnectionGraph::record_for_escape_analysis()
kvn
parents:
17383
diff
changeset
|
1938 |
const Type* t2 = jobj2->ideal_node()->get_ptr_type(); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1939 |
if (t1->make_ptr() == t2->make_ptr()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1940 |
return _pcmp_eq; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1941 |
} else { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1942 |
return _pcmp_neq; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1943 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1944 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1945 |
if (ptn1->meet(ptn2)) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1946 |
return NULL; // Sets are not disjoint |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1947 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1948 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1949 |
// Sets are disjoint. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1950 |
bool set1_has_unknown_ptr = ptn1->points_to(phantom_obj); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1951 |
bool set2_has_unknown_ptr = ptn2->points_to(phantom_obj); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1952 |
bool set1_has_null_ptr = ptn1->points_to(null_obj); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1953 |
bool set2_has_null_ptr = ptn2->points_to(null_obj); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1954 |
if (set1_has_unknown_ptr && set2_has_null_ptr || |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1955 |
set2_has_unknown_ptr && set1_has_null_ptr) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1956 |
// Check nullness of unknown object. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1957 |
return NULL; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1958 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1959 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1960 |
// Disjointness by itself is not sufficient since |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1961 |
// alias analysis is not complete for escaped objects. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1962 |
// Disjoint sets are definitely unrelated only when |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1963 |
// at least one set has only not escaping allocations. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1964 |
if (!set1_has_unknown_ptr && !set1_has_null_ptr) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1965 |
if (ptn1->non_escaping_allocation()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1966 |
return _pcmp_neq; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1967 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1968 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1969 |
if (!set2_has_unknown_ptr && !set2_has_null_ptr) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1970 |
if (ptn2->non_escaping_allocation()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1971 |
return _pcmp_neq; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1972 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1973 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1974 |
return NULL; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1975 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1976 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1977 |
// Connection Graph constuction functions. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1978 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1979 |
void ConnectionGraph::add_local_var(Node *n, PointsToNode::EscapeState es) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1980 |
PointsToNode* ptadr = _nodes.at(n->_idx); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1981 |
if (ptadr != NULL) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1982 |
assert(ptadr->is_LocalVar() && ptadr->ideal_node() == n, "sanity"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1983 |
return; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1984 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1985 |
Compile* C = _compile; |
27424
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1986 |
ptadr = new (C->comp_arena()) LocalVarNode(this, n, es); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1987 |
_nodes.at_put(n->_idx, ptadr); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1988 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1989 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1990 |
void ConnectionGraph::add_java_object(Node *n, PointsToNode::EscapeState es) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1991 |
PointsToNode* ptadr = _nodes.at(n->_idx); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1992 |
if (ptadr != NULL) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1993 |
assert(ptadr->is_JavaObject() && ptadr->ideal_node() == n, "sanity"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1994 |
return; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1995 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1996 |
Compile* C = _compile; |
27424
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1997 |
ptadr = new (C->comp_arena()) JavaObjectNode(this, n, es); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1998 |
_nodes.at_put(n->_idx, ptadr); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1999 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2000 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2001 |
void ConnectionGraph::add_field(Node *n, PointsToNode::EscapeState es, int offset) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2002 |
PointsToNode* ptadr = _nodes.at(n->_idx); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2003 |
if (ptadr != NULL) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2004 |
assert(ptadr->is_Field() && ptadr->ideal_node() == n, "sanity"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2005 |
return; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2006 |
} |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12164
diff
changeset
|
2007 |
bool unsafe = false; |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12164
diff
changeset
|
2008 |
bool is_oop = is_oop_field(n, offset, &unsafe); |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12164
diff
changeset
|
2009 |
if (unsafe) { |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12164
diff
changeset
|
2010 |
es = PointsToNode::GlobalEscape; |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12164
diff
changeset
|
2011 |
} |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2012 |
Compile* C = _compile; |
27424
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
2013 |
FieldNode* field = new (C->comp_arena()) FieldNode(this, n, es, offset, is_oop); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2014 |
_nodes.at_put(n->_idx, field); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2015 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2016 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2017 |
void ConnectionGraph::add_arraycopy(Node *n, PointsToNode::EscapeState es, |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2018 |
PointsToNode* src, PointsToNode* dst) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2019 |
assert(!src->is_Field() && !dst->is_Field(), "only for JavaObject and LocalVar"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2020 |
assert((src != null_obj) && (dst != null_obj), "not for ConP NULL"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2021 |
PointsToNode* ptadr = _nodes.at(n->_idx); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2022 |
if (ptadr != NULL) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2023 |
assert(ptadr->is_Arraycopy() && ptadr->ideal_node() == n, "sanity"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2024 |
return; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2025 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2026 |
Compile* C = _compile; |
27424
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
2027 |
ptadr = new (C->comp_arena()) ArraycopyNode(this, n, es); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2028 |
_nodes.at_put(n->_idx, ptadr); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2029 |
// Add edge from arraycopy node to source object. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2030 |
(void)add_edge(ptadr, src); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2031 |
src->set_arraycopy_src(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2032 |
// Add edge from destination object to arraycopy node. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2033 |
(void)add_edge(dst, ptadr); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2034 |
dst->set_arraycopy_dst(); |
1 | 2035 |
} |
2036 |
||
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12164
diff
changeset
|
2037 |
bool ConnectionGraph::is_oop_field(Node* n, int offset, bool* unsafe) { |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2038 |
const Type* adr_type = n->as_AddP()->bottom_type(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2039 |
BasicType bt = T_INT; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2040 |
if (offset == Type::OffsetBot) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2041 |
// Check only oop fields. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2042 |
if (!adr_type->isa_aryptr() || |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2043 |
(adr_type->isa_aryptr()->klass() == NULL) || |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2044 |
adr_type->isa_aryptr()->klass()->is_obj_array_klass()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2045 |
// OffsetBot is used to reference array's element. Ignore first AddP. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2046 |
if (find_second_addp(n, n->in(AddPNode::Base)) == NULL) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2047 |
bt = T_OBJECT; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2048 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2049 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2050 |
} else if (offset != oopDesc::klass_offset_in_bytes()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2051 |
if (adr_type->isa_instptr()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2052 |
ciField* field = _compile->alias_type(adr_type->isa_instptr())->field(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2053 |
if (field != NULL) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2054 |
bt = field->layout_type(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2055 |
} else { |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12164
diff
changeset
|
2056 |
// Check for unsafe oop field access |
28643
a665e19ca007
8066312: Add new Node* Node::find_out(int opc) method.
zmajo
parents:
27919
diff
changeset
|
2057 |
if (n->has_out_with(Op_StoreP, Op_LoadP, Op_StoreN, Op_LoadN)) { |
a665e19ca007
8066312: Add new Node* Node::find_out(int opc) method.
zmajo
parents:
27919
diff
changeset
|
2058 |
bt = T_OBJECT; |
a665e19ca007
8066312: Add new Node* Node::find_out(int opc) method.
zmajo
parents:
27919
diff
changeset
|
2059 |
(*unsafe) = true; |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12164
diff
changeset
|
2060 |
} |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2061 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2062 |
} else if (adr_type->isa_aryptr()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2063 |
if (offset == arrayOopDesc::length_offset_in_bytes()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2064 |
// Ignore array length load. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2065 |
} else if (find_second_addp(n, n->in(AddPNode::Base)) != NULL) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2066 |
// Ignore first AddP. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2067 |
} else { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2068 |
const Type* elemtype = adr_type->isa_aryptr()->elem(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2069 |
bt = elemtype->array_element_basic_type(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2070 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2071 |
} else if (adr_type->isa_rawptr() || adr_type->isa_klassptr()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2072 |
// Allocation initialization, ThreadLocal field access, unsafe access |
28643
a665e19ca007
8066312: Add new Node* Node::find_out(int opc) method.
zmajo
parents:
27919
diff
changeset
|
2073 |
if (n->has_out_with(Op_StoreP, Op_LoadP, Op_StoreN, Op_LoadN)) { |
a665e19ca007
8066312: Add new Node* Node::find_out(int opc) method.
zmajo
parents:
27919
diff
changeset
|
2074 |
bt = T_OBJECT; |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2075 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2076 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2077 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2078 |
return (bt == T_OBJECT || bt == T_NARROWOOP || bt == T_ARRAY); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2079 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2080 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2081 |
// Returns unique pointed java object or NULL. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2082 |
JavaObjectNode* ConnectionGraph::unique_java_object(Node *n) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2083 |
assert(!_collecting, "should not call when contructed graph"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2084 |
// If the node was created after the escape computation we can't answer. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2085 |
uint idx = n->_idx; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2086 |
if (idx >= nodes_size()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2087 |
return NULL; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2088 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2089 |
PointsToNode* ptn = ptnode_adr(idx); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2090 |
if (ptn->is_JavaObject()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2091 |
return ptn->as_JavaObject(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2092 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2093 |
assert(ptn->is_LocalVar(), "sanity"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2094 |
// Check all java objects it points to. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2095 |
JavaObjectNode* jobj = NULL; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2096 |
for (EdgeIterator i(ptn); i.has_next(); i.next()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2097 |
PointsToNode* e = i.get(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2098 |
if (e->is_JavaObject()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2099 |
if (jobj == NULL) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2100 |
jobj = e->as_JavaObject(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2101 |
} else if (jobj != e) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2102 |
return NULL; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2103 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2104 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2105 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2106 |
return jobj; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2107 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2108 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2109 |
// Return true if this node points only to non-escaping allocations. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2110 |
bool PointsToNode::non_escaping_allocation() { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2111 |
if (is_JavaObject()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2112 |
Node* n = ideal_node(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2113 |
if (n->is_Allocate() || n->is_CallStaticJava()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2114 |
return (escape_state() == PointsToNode::NoEscape); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2115 |
} else { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2116 |
return false; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2117 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2118 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2119 |
assert(is_LocalVar(), "sanity"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2120 |
// Check all java objects it points to. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2121 |
for (EdgeIterator i(this); i.has_next(); i.next()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2122 |
PointsToNode* e = i.get(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2123 |
if (e->is_JavaObject()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2124 |
Node* n = e->ideal_node(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2125 |
if ((e->escape_state() != PointsToNode::NoEscape) || |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2126 |
!(n->is_Allocate() || n->is_CallStaticJava())) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2127 |
return false; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2128 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2129 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2130 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2131 |
return true; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2132 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2133 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2134 |
// Return true if we know the node does not escape globally. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2135 |
bool ConnectionGraph::not_global_escape(Node *n) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2136 |
assert(!_collecting, "should not call during graph construction"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2137 |
// If the node was created after the escape computation we can't answer. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2138 |
uint idx = n->_idx; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2139 |
if (idx >= nodes_size()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2140 |
return false; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2141 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2142 |
PointsToNode* ptn = ptnode_adr(idx); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2143 |
PointsToNode::EscapeState es = ptn->escape_state(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2144 |
// If we have already computed a value, return it. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2145 |
if (es >= PointsToNode::GlobalEscape) |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2146 |
return false; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2147 |
if (ptn->is_JavaObject()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2148 |
return true; // (es < PointsToNode::GlobalEscape); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2149 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2150 |
assert(ptn->is_LocalVar(), "sanity"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2151 |
// Check all java objects it points to. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2152 |
for (EdgeIterator i(ptn); i.has_next(); i.next()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2153 |
if (i.get()->escape_state() >= PointsToNode::GlobalEscape) |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2154 |
return false; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2155 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2156 |
return true; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2157 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2158 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2159 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2160 |
// Helper functions |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2161 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2162 |
// Return true if this node points to specified node or nodes it points to. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2163 |
bool PointsToNode::points_to(JavaObjectNode* ptn) const { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2164 |
if (is_JavaObject()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2165 |
return (this == ptn); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2166 |
} |
14395
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
2167 |
assert(is_LocalVar() || is_Field(), "sanity"); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2168 |
for (EdgeIterator i(this); i.has_next(); i.next()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2169 |
if (i.get() == ptn) |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2170 |
return true; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2171 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2172 |
return false; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2173 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2174 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2175 |
// Return true if one node points to an other. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2176 |
bool PointsToNode::meet(PointsToNode* ptn) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2177 |
if (this == ptn) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2178 |
return true; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2179 |
} else if (ptn->is_JavaObject()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2180 |
return this->points_to(ptn->as_JavaObject()); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2181 |
} else if (this->is_JavaObject()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2182 |
return ptn->points_to(this->as_JavaObject()); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2183 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2184 |
assert(this->is_LocalVar() && ptn->is_LocalVar(), "sanity"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2185 |
int ptn_count = ptn->edge_count(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2186 |
for (EdgeIterator i(this); i.has_next(); i.next()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2187 |
PointsToNode* this_e = i.get(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2188 |
for (int j = 0; j < ptn_count; j++) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2189 |
if (this_e == ptn->edge(j)) |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2190 |
return true; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2191 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2192 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2193 |
return false; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2194 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2195 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2196 |
#ifdef ASSERT |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2197 |
// Return true if bases point to this java object. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2198 |
bool FieldNode::has_base(JavaObjectNode* jobj) const { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2199 |
for (BaseIterator i(this); i.has_next(); i.next()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2200 |
if (i.get() == jobj) |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2201 |
return true; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2202 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2203 |
return false; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2204 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2205 |
#endif |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2206 |
|
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2207 |
int ConnectionGraph::address_offset(Node* adr, PhaseTransform *phase) { |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2208 |
const Type *adr_type = phase->type(adr); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2209 |
if (adr->is_AddP() && adr_type->isa_oopptr() == NULL && |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2210 |
adr->in(AddPNode::Address)->is_Proj() && |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2211 |
adr->in(AddPNode::Address)->in(0)->is_Allocate()) { |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2212 |
// We are computing a raw address for a store captured by an Initialize |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2213 |
// compute an appropriate address type. AddP cases #3 and #5 (see below). |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2214 |
int offs = (int)phase->find_intptr_t_con(adr->in(AddPNode::Offset), Type::OffsetBot); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2215 |
assert(offs != Type::OffsetBot || |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2216 |
adr->in(AddPNode::Address)->in(0)->is_AllocateArray(), |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2217 |
"offset must be a constant or it is initialization of array"); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2218 |
return offs; |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2219 |
} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2220 |
const TypePtr *t_ptr = adr_type->isa_ptr(); |
1 | 2221 |
assert(t_ptr != NULL, "must be a pointer type"); |
2222 |
return t_ptr->offset(); |
|
2223 |
} |
|
2224 |
||
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2225 |
Node* ConnectionGraph::get_addp_base(Node *addp) { |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2226 |
assert(addp->is_AddP(), "must be AddP"); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2227 |
// |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2228 |
// AddP cases for Base and Address inputs: |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2229 |
// case #1. Direct object's field reference: |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2230 |
// Allocate |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2231 |
// | |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2232 |
// Proj #5 ( oop result ) |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2233 |
// | |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2234 |
// CheckCastPP (cast to instance type) |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2235 |
// | | |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2236 |
// AddP ( base == address ) |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2237 |
// |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2238 |
// case #2. Indirect object's field reference: |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2239 |
// Phi |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2240 |
// | |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2241 |
// CastPP (cast to instance type) |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2242 |
// | | |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2243 |
// AddP ( base == address ) |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2244 |
// |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2245 |
// case #3. Raw object's field reference for Initialize node: |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2246 |
// Allocate |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2247 |
// | |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2248 |
// Proj #5 ( oop result ) |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2249 |
// top | |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2250 |
// \ | |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2251 |
// AddP ( base == top ) |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2252 |
// |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2253 |
// case #4. Array's element reference: |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2254 |
// {CheckCastPP | CastPP} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2255 |
// | | | |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2256 |
// | AddP ( array's element offset ) |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2257 |
// | | |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2258 |
// AddP ( array's offset ) |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2259 |
// |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2260 |
// case #5. Raw object's field reference for arraycopy stub call: |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2261 |
// The inline_native_clone() case when the arraycopy stub is called |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2262 |
// after the allocation before Initialize and CheckCastPP nodes. |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2263 |
// Allocate |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2264 |
// | |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2265 |
// Proj #5 ( oop result ) |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2266 |
// | | |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2267 |
// AddP ( base == address ) |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2268 |
// |
250 | 2269 |
// case #6. Constant Pool, ThreadLocal, CastX2P or |
2270 |
// Raw object's field reference: |
|
2271 |
// {ConP, ThreadLocal, CastX2P, raw Load} |
|
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2272 |
// top | |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2273 |
// \ | |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2274 |
// AddP ( base == top ) |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2275 |
// |
250 | 2276 |
// case #7. Klass's field reference. |
2277 |
// LoadKlass |
|
2278 |
// | | |
|
2279 |
// AddP ( base == address ) |
|
2280 |
// |
|
590
2954744d7bba
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
589
diff
changeset
|
2281 |
// case #8. narrow Klass's field reference. |
2954744d7bba
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
589
diff
changeset
|
2282 |
// LoadNKlass |
2954744d7bba
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
589
diff
changeset
|
2283 |
// | |
2954744d7bba
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
589
diff
changeset
|
2284 |
// DecodeN |
2954744d7bba
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
589
diff
changeset
|
2285 |
// | | |
2954744d7bba
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
589
diff
changeset
|
2286 |
// AddP ( base == address ) |
2954744d7bba
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
589
diff
changeset
|
2287 |
// |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2288 |
Node *base = addp->in(AddPNode::Base); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2289 |
if (base->uncast()->is_top()) { // The AddP case #3 and #6. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2290 |
base = addp->in(AddPNode::Address); |
3804 | 2291 |
while (base->is_AddP()) { |
2292 |
// Case #6 (unsafe access) may have several chained AddP nodes. |
|
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2293 |
assert(base->in(AddPNode::Base)->uncast()->is_top(), "expected unsafe access address only"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2294 |
base = base->in(AddPNode::Address); |
3804 | 2295 |
} |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2296 |
Node* uncast_base = base->uncast(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2297 |
int opcode = uncast_base->Opcode(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2298 |
assert(opcode == Op_ConP || opcode == Op_ThreadLocal || |
13969
d2a189b83b87
7054512: Compress class pointers after perm gen removal
roland
parents:
13886
diff
changeset
|
2299 |
opcode == Op_CastX2P || uncast_base->is_DecodeNarrowPtr() || |
17873
3bd093aedfe9
8015441: runThese crashed with assert(opcode == Op_ConP || opcode == Op_ThreadLocal || opcode == Op_CastX2P ..) failed: sanity
kvn
parents:
17386
diff
changeset
|
2300 |
(uncast_base->is_Mem() && (uncast_base->bottom_type()->isa_rawptr() != NULL)) || |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2301 |
(uncast_base->is_Proj() && uncast_base->in(0)->is_Allocate()), "sanity"); |
1 | 2302 |
} |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2303 |
return base; |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2304 |
} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2305 |
|
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2306 |
Node* ConnectionGraph::find_second_addp(Node* addp, Node* n) { |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2307 |
assert(addp->is_AddP() && addp->outcnt() > 0, "Don't process dead nodes"); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2308 |
Node* addp2 = addp->raw_out(0); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2309 |
if (addp->outcnt() == 1 && addp2->is_AddP() && |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2310 |
addp2->in(AddPNode::Base) == n && |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2311 |
addp2->in(AddPNode::Address) == addp) { |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2312 |
assert(addp->in(AddPNode::Base) == n, "expecting the same base"); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2313 |
// |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2314 |
// Find array's offset to push it on worklist first and |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2315 |
// as result process an array's element offset first (pushed second) |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2316 |
// to avoid CastPP for the array's offset. |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2317 |
// Otherwise the inserted CastPP (LocalVar) will point to what |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2318 |
// the AddP (Field) points to. Which would be wrong since |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2319 |
// the algorithm expects the CastPP has the same point as |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2320 |
// as AddP's base CheckCastPP (LocalVar). |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2321 |
// |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2322 |
// ArrayAllocation |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2323 |
// | |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2324 |
// CheckCastPP |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2325 |
// | |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2326 |
// memProj (from ArrayAllocation CheckCastPP) |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2327 |
// | || |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2328 |
// | || Int (element index) |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2329 |
// | || | ConI (log(element size)) |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2330 |
// | || | / |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2331 |
// | || LShift |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2332 |
// | || / |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2333 |
// | AddP (array's element offset) |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2334 |
// | | |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2335 |
// | | ConI (array's offset: #12(32-bits) or #24(64-bits)) |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2336 |
// | / / |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2337 |
// AddP (array's offset) |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2338 |
// | |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2339 |
// Load/Store (memory operation on array's element) |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2340 |
// |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2341 |
return addp2; |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2342 |
} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2343 |
return NULL; |
1 | 2344 |
} |
2345 |
||
2346 |
// |
|
2347 |
// Adjust the type and inputs of an AddP which computes the |
|
2348 |
// address of a field of an instance |
|
2349 |
// |
|
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2350 |
bool ConnectionGraph::split_AddP(Node *addp, Node *base) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2351 |
PhaseGVN* igvn = _igvn; |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2352 |
const TypeOopPtr *base_t = igvn->type(base)->isa_oopptr(); |
769 | 2353 |
assert(base_t != NULL && base_t->is_known_instance(), "expecting instance oopptr"); |
1 | 2354 |
const TypeOopPtr *t = igvn->type(addp)->isa_oopptr(); |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2355 |
if (t == NULL) { |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2356 |
// We are computing a raw address for a store captured by an Initialize |
1055
f4fb9fb08038
6731641: assert(m->adr_type() == mach->adr_type(),"matcher should not change adr type")
kvn
parents:
961
diff
changeset
|
2357 |
// compute an appropriate address type (cases #3 and #5). |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2358 |
assert(igvn->type(addp) == TypeRawPtr::NOTNULL, "must be raw pointer"); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2359 |
assert(addp->in(AddPNode::Address)->is_Proj(), "base of raw address must be result projection from allocation"); |
1068
720698d9c89b
6741738: TypePtr::add_offset() set incorrect offset when the add overflows
kvn
parents:
1055
diff
changeset
|
2360 |
intptr_t offs = (int)igvn->find_intptr_t_con(addp->in(AddPNode::Offset), Type::OffsetBot); |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2361 |
assert(offs != Type::OffsetBot, "offset must be a constant"); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2362 |
t = base_t->add_offset(offs)->is_oopptr(); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2363 |
} |
769 | 2364 |
int inst_id = base_t->instance_id(); |
2365 |
assert(!t->is_known_instance() || t->instance_id() == inst_id, |
|
1 | 2366 |
"old type must be non-instance or match new type"); |
1055
f4fb9fb08038
6731641: assert(m->adr_type() == mach->adr_type(),"matcher should not change adr type")
kvn
parents:
961
diff
changeset
|
2367 |
|
f4fb9fb08038
6731641: assert(m->adr_type() == mach->adr_type(),"matcher should not change adr type")
kvn
parents:
961
diff
changeset
|
2368 |
// The type 't' could be subclass of 'base_t'. |
f4fb9fb08038
6731641: assert(m->adr_type() == mach->adr_type(),"matcher should not change adr type")
kvn
parents:
961
diff
changeset
|
2369 |
// As result t->offset() could be large then base_t's size and it will |
f4fb9fb08038
6731641: assert(m->adr_type() == mach->adr_type(),"matcher should not change adr type")
kvn
parents:
961
diff
changeset
|
2370 |
// cause the failure in add_offset() with narrow oops since TypeOopPtr() |
f4fb9fb08038
6731641: assert(m->adr_type() == mach->adr_type(),"matcher should not change adr type")
kvn
parents:
961
diff
changeset
|
2371 |
// constructor verifies correctness of the offset. |
f4fb9fb08038
6731641: assert(m->adr_type() == mach->adr_type(),"matcher should not change adr type")
kvn
parents:
961
diff
changeset
|
2372 |
// |
2131 | 2373 |
// It could happened on subclass's branch (from the type profiling |
1055
f4fb9fb08038
6731641: assert(m->adr_type() == mach->adr_type(),"matcher should not change adr type")
kvn
parents:
961
diff
changeset
|
2374 |
// inlining) which was not eliminated during parsing since the exactness |
f4fb9fb08038
6731641: assert(m->adr_type() == mach->adr_type(),"matcher should not change adr type")
kvn
parents:
961
diff
changeset
|
2375 |
// of the allocation type was not propagated to the subclass type check. |
f4fb9fb08038
6731641: assert(m->adr_type() == mach->adr_type(),"matcher should not change adr type")
kvn
parents:
961
diff
changeset
|
2376 |
// |
3907
2a567f035d5c
6879362: assert(!klass_is_exact(),"only non-exact klass")
kvn
parents:
3804
diff
changeset
|
2377 |
// Or the type 't' could be not related to 'base_t' at all. |
2a567f035d5c
6879362: assert(!klass_is_exact(),"only non-exact klass")
kvn
parents:
3804
diff
changeset
|
2378 |
// It could happened when CHA type is different from MDO type on a dead path |
2a567f035d5c
6879362: assert(!klass_is_exact(),"only non-exact klass")
kvn
parents:
3804
diff
changeset
|
2379 |
// (for example, from instanceof check) which is not collapsed during parsing. |
2a567f035d5c
6879362: assert(!klass_is_exact(),"only non-exact klass")
kvn
parents:
3804
diff
changeset
|
2380 |
// |
1055
f4fb9fb08038
6731641: assert(m->adr_type() == mach->adr_type(),"matcher should not change adr type")
kvn
parents:
961
diff
changeset
|
2381 |
// Do nothing for such AddP node and don't process its users since |
f4fb9fb08038
6731641: assert(m->adr_type() == mach->adr_type(),"matcher should not change adr type")
kvn
parents:
961
diff
changeset
|
2382 |
// this code branch will go away. |
f4fb9fb08038
6731641: assert(m->adr_type() == mach->adr_type(),"matcher should not change adr type")
kvn
parents:
961
diff
changeset
|
2383 |
// |
f4fb9fb08038
6731641: assert(m->adr_type() == mach->adr_type(),"matcher should not change adr type")
kvn
parents:
961
diff
changeset
|
2384 |
if (!t->is_known_instance() && |
3907
2a567f035d5c
6879362: assert(!klass_is_exact(),"only non-exact klass")
kvn
parents:
3804
diff
changeset
|
2385 |
!base_t->klass()->is_subtype_of(t->klass())) { |
1055
f4fb9fb08038
6731641: assert(m->adr_type() == mach->adr_type(),"matcher should not change adr type")
kvn
parents:
961
diff
changeset
|
2386 |
return false; // bail out |
f4fb9fb08038
6731641: assert(m->adr_type() == mach->adr_type(),"matcher should not change adr type")
kvn
parents:
961
diff
changeset
|
2387 |
} |
1 | 2388 |
const TypeOopPtr *tinst = base_t->add_offset(t->offset())->is_oopptr(); |
4432
29b057bf202d
6896352: CTW fails hotspot/src/share/vm/opto/escape.cpp:1155
kvn
parents:
3907
diff
changeset
|
2389 |
// Do NOT remove the next line: ensure a new alias index is allocated |
29b057bf202d
6896352: CTW fails hotspot/src/share/vm/opto/escape.cpp:1155
kvn
parents:
3907
diff
changeset
|
2390 |
// for the instance type. Note: C++ will not remove it since the call |
29b057bf202d
6896352: CTW fails hotspot/src/share/vm/opto/escape.cpp:1155
kvn
parents:
3907
diff
changeset
|
2391 |
// has side effect. |
1 | 2392 |
int alias_idx = _compile->get_alias_index(tinst); |
2393 |
igvn->set_type(addp, tinst); |
|
2394 |
// record the allocation in the node map |
|
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2395 |
set_map(addp, get_map(base->_idx)); |
961
7fb3b13d4205
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
955
diff
changeset
|
2396 |
// Set addp's Base and Address to 'base'. |
7fb3b13d4205
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
955
diff
changeset
|
2397 |
Node *abase = addp->in(AddPNode::Base); |
7fb3b13d4205
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
955
diff
changeset
|
2398 |
Node *adr = addp->in(AddPNode::Address); |
7fb3b13d4205
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
955
diff
changeset
|
2399 |
if (adr->is_Proj() && adr->in(0)->is_Allocate() && |
7fb3b13d4205
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
955
diff
changeset
|
2400 |
adr->in(0)->_idx == (uint)inst_id) { |
7fb3b13d4205
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
955
diff
changeset
|
2401 |
// Skip AddP cases #3 and #5. |
7fb3b13d4205
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
955
diff
changeset
|
2402 |
} else { |
7fb3b13d4205
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
955
diff
changeset
|
2403 |
assert(!abase->is_top(), "sanity"); // AddP case #3 |
7fb3b13d4205
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
955
diff
changeset
|
2404 |
if (abase != base) { |
7fb3b13d4205
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
955
diff
changeset
|
2405 |
igvn->hash_delete(addp); |
7fb3b13d4205
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
955
diff
changeset
|
2406 |
addp->set_req(AddPNode::Base, base); |
7fb3b13d4205
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
955
diff
changeset
|
2407 |
if (abase == adr) { |
7fb3b13d4205
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
955
diff
changeset
|
2408 |
addp->set_req(AddPNode::Address, base); |
7fb3b13d4205
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
955
diff
changeset
|
2409 |
} else { |
7fb3b13d4205
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
955
diff
changeset
|
2410 |
// AddP case #4 (adr is array's element offset AddP node) |
7fb3b13d4205
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
955
diff
changeset
|
2411 |
#ifdef ASSERT |
7fb3b13d4205
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
955
diff
changeset
|
2412 |
const TypeOopPtr *atype = igvn->type(adr)->isa_oopptr(); |
7fb3b13d4205
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
955
diff
changeset
|
2413 |
assert(adr->is_AddP() && atype != NULL && |
7fb3b13d4205
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
955
diff
changeset
|
2414 |
atype->instance_id() == inst_id, "array's element offset should be processed first"); |
7fb3b13d4205
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
955
diff
changeset
|
2415 |
#endif |
7fb3b13d4205
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
955
diff
changeset
|
2416 |
} |
7fb3b13d4205
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
955
diff
changeset
|
2417 |
igvn->hash_insert(addp); |
1 | 2418 |
} |
2419 |
} |
|
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2420 |
// Put on IGVN worklist since at least addp's type was changed above. |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2421 |
record_for_optimizer(addp); |
1055
f4fb9fb08038
6731641: assert(m->adr_type() == mach->adr_type(),"matcher should not change adr type")
kvn
parents:
961
diff
changeset
|
2422 |
return true; |
1 | 2423 |
} |
2424 |
||
2425 |
// |
|
2426 |
// Create a new version of orig_phi if necessary. Returns either the newly |
|
9115
5a28312aa393
6992789: assert(phi->_idx >= nodes_size()) failed: only new Phi per instance memory slice
kvn
parents:
8319
diff
changeset
|
2427 |
// created phi or an existing phi. Sets create_new to indicate whether a new |
1 | 2428 |
// phi was created. Cache the last newly created phi in the node map. |
2429 |
// |
|
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2430 |
PhiNode *ConnectionGraph::create_split_phi(PhiNode *orig_phi, int alias_idx, GrowableArray<PhiNode *> &orig_phi_worklist, bool &new_created) { |
1 | 2431 |
Compile *C = _compile; |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2432 |
PhaseGVN* igvn = _igvn; |
1 | 2433 |
new_created = false; |
2434 |
int phi_alias_idx = C->get_alias_index(orig_phi->adr_type()); |
|
2435 |
// nothing to do if orig_phi is bottom memory or matches alias_idx |
|
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2436 |
if (phi_alias_idx == alias_idx) { |
1 | 2437 |
return orig_phi; |
2438 |
} |
|
3268
f034e0c86895
6851742: (EA) allocation elimination doesn't work with UseG1GC
kvn
parents:
2871
diff
changeset
|
2439 |
// Have we recently created a Phi for this alias index? |
1 | 2440 |
PhiNode *result = get_map_phi(orig_phi->_idx); |
2441 |
if (result != NULL && C->get_alias_index(result->adr_type()) == alias_idx) { |
|
2442 |
return result; |
|
2443 |
} |
|
3268
f034e0c86895
6851742: (EA) allocation elimination doesn't work with UseG1GC
kvn
parents:
2871
diff
changeset
|
2444 |
// Previous check may fail when the same wide memory Phi was split into Phis |
f034e0c86895
6851742: (EA) allocation elimination doesn't work with UseG1GC
kvn
parents:
2871
diff
changeset
|
2445 |
// for different memory slices. Search all Phis for this region. |
f034e0c86895
6851742: (EA) allocation elimination doesn't work with UseG1GC
kvn
parents:
2871
diff
changeset
|
2446 |
if (result != NULL) { |
f034e0c86895
6851742: (EA) allocation elimination doesn't work with UseG1GC
kvn
parents:
2871
diff
changeset
|
2447 |
Node* region = orig_phi->in(0); |
f034e0c86895
6851742: (EA) allocation elimination doesn't work with UseG1GC
kvn
parents:
2871
diff
changeset
|
2448 |
for (DUIterator_Fast imax, i = region->fast_outs(imax); i < imax; i++) { |
f034e0c86895
6851742: (EA) allocation elimination doesn't work with UseG1GC
kvn
parents:
2871
diff
changeset
|
2449 |
Node* phi = region->fast_out(i); |
f034e0c86895
6851742: (EA) allocation elimination doesn't work with UseG1GC
kvn
parents:
2871
diff
changeset
|
2450 |
if (phi->is_Phi() && |
f034e0c86895
6851742: (EA) allocation elimination doesn't work with UseG1GC
kvn
parents:
2871
diff
changeset
|
2451 |
C->get_alias_index(phi->as_Phi()->adr_type()) == alias_idx) { |
f034e0c86895
6851742: (EA) allocation elimination doesn't work with UseG1GC
kvn
parents:
2871
diff
changeset
|
2452 |
assert(phi->_idx >= nodes_size(), "only new Phi per instance memory slice"); |
f034e0c86895
6851742: (EA) allocation elimination doesn't work with UseG1GC
kvn
parents:
2871
diff
changeset
|
2453 |
return phi->as_Phi(); |
f034e0c86895
6851742: (EA) allocation elimination doesn't work with UseG1GC
kvn
parents:
2871
diff
changeset
|
2454 |
} |
f034e0c86895
6851742: (EA) allocation elimination doesn't work with UseG1GC
kvn
parents:
2871
diff
changeset
|
2455 |
} |
f034e0c86895
6851742: (EA) allocation elimination doesn't work with UseG1GC
kvn
parents:
2871
diff
changeset
|
2456 |
} |
27707
f7d26e5b8b5d
8058148: MaxNodeLimit and LiveNodeCountInliningCutoff
vlivanov
parents:
27424
diff
changeset
|
2457 |
if (C->live_nodes() + 2*NodeLimitFudgeFactor > C->max_node_limit()) { |
211
e2b60448c234
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
1
diff
changeset
|
2458 |
if (C->do_escape_analysis() == true && !C->failing()) { |
e2b60448c234
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
1
diff
changeset
|
2459 |
// Retry compilation without escape analysis. |
e2b60448c234
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
1
diff
changeset
|
2460 |
// If this is the first failure, the sentinel string will "stick" |
e2b60448c234
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
1
diff
changeset
|
2461 |
// to the Compile object, and the C2Compiler will see it and retry. |
e2b60448c234
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
1
diff
changeset
|
2462 |
C->record_failure(C2Compiler::retry_no_escape_analysis()); |
e2b60448c234
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
1
diff
changeset
|
2463 |
} |
e2b60448c234
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
1
diff
changeset
|
2464 |
return NULL; |
e2b60448c234
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
1
diff
changeset
|
2465 |
} |
1 | 2466 |
orig_phi_worklist.append_if_missing(orig_phi); |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2467 |
const TypePtr *atype = C->get_adr_type(alias_idx); |
1 | 2468 |
result = PhiNode::make(orig_phi->in(0), NULL, Type::MEMORY, atype); |
3268
f034e0c86895
6851742: (EA) allocation elimination doesn't work with UseG1GC
kvn
parents:
2871
diff
changeset
|
2469 |
C->copy_node_notes_to(result, orig_phi); |
1 | 2470 |
igvn->set_type(result, result->bottom_type()); |
2471 |
record_for_optimizer(result); |
|
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2472 |
set_map(orig_phi, result); |
1 | 2473 |
new_created = true; |
2474 |
return result; |
|
2475 |
} |
|
2476 |
||
2477 |
// |
|
9115
5a28312aa393
6992789: assert(phi->_idx >= nodes_size()) failed: only new Phi per instance memory slice
kvn
parents:
8319
diff
changeset
|
2478 |
// Return a new version of Memory Phi "orig_phi" with the inputs having the |
1 | 2479 |
// specified alias index. |
2480 |
// |
|
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2481 |
PhiNode *ConnectionGraph::split_memory_phi(PhiNode *orig_phi, int alias_idx, GrowableArray<PhiNode *> &orig_phi_worklist) { |
1 | 2482 |
assert(alias_idx != Compile::AliasIdxBot, "can't split out bottom memory"); |
2483 |
Compile *C = _compile; |
|
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2484 |
PhaseGVN* igvn = _igvn; |
1 | 2485 |
bool new_phi_created; |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2486 |
PhiNode *result = create_split_phi(orig_phi, alias_idx, orig_phi_worklist, new_phi_created); |
1 | 2487 |
if (!new_phi_created) { |
2488 |
return result; |
|
2489 |
} |
|
2490 |
GrowableArray<PhiNode *> phi_list; |
|
2491 |
GrowableArray<uint> cur_input; |
|
2492 |
PhiNode *phi = orig_phi; |
|
2493 |
uint idx = 1; |
|
2494 |
bool finished = false; |
|
2495 |
while(!finished) { |
|
2496 |
while (idx < phi->req()) { |
|
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2497 |
Node *mem = find_inst_mem(phi->in(idx), alias_idx, orig_phi_worklist); |
1 | 2498 |
if (mem != NULL && mem->is_Phi()) { |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2499 |
PhiNode *newphi = create_split_phi(mem->as_Phi(), alias_idx, orig_phi_worklist, new_phi_created); |
1 | 2500 |
if (new_phi_created) { |
2501 |
// found an phi for which we created a new split, push current one on worklist and begin |
|
2502 |
// processing new one |
|
2503 |
phi_list.push(phi); |
|
2504 |
cur_input.push(idx); |
|
2505 |
phi = mem->as_Phi(); |
|
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2506 |
result = newphi; |
1 | 2507 |
idx = 1; |
2508 |
continue; |
|
2509 |
} else { |
|
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2510 |
mem = newphi; |
1 | 2511 |
} |
2512 |
} |
|
211
e2b60448c234
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
1
diff
changeset
|
2513 |
if (C->failing()) { |
e2b60448c234
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
1
diff
changeset
|
2514 |
return NULL; |
e2b60448c234
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
1
diff
changeset
|
2515 |
} |
1 | 2516 |
result->set_req(idx++, mem); |
2517 |
} |
|
2518 |
#ifdef ASSERT |
|
2519 |
// verify that the new Phi has an input for each input of the original |
|
2520 |
assert( phi->req() == result->req(), "must have same number of inputs."); |
|
2521 |
assert( result->in(0) != NULL && result->in(0) == phi->in(0), "regions must match"); |
|
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2522 |
#endif |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2523 |
// Check if all new phi's inputs have specified alias index. |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2524 |
// Otherwise use old phi. |
1 | 2525 |
for (uint i = 1; i < phi->req(); i++) { |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2526 |
Node* in = result->in(i); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2527 |
assert((phi->in(i) == NULL) == (in == NULL), "inputs must correspond."); |
1 | 2528 |
} |
2529 |
// we have finished processing a Phi, see if there are any more to do |
|
2530 |
finished = (phi_list.length() == 0 ); |
|
2531 |
if (!finished) { |
|
2532 |
phi = phi_list.pop(); |
|
2533 |
idx = cur_input.pop(); |
|
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2534 |
PhiNode *prev_result = get_map_phi(phi->_idx); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2535 |
prev_result->set_req(idx++, result); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2536 |
result = prev_result; |
1 | 2537 |
} |
2538 |
} |
|
2539 |
return result; |
|
2540 |
} |
|
2541 |
||
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2542 |
// |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2543 |
// The next methods are derived from methods in MemNode. |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2544 |
// |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2545 |
Node* ConnectionGraph::step_through_mergemem(MergeMemNode *mmem, int alias_idx, const TypeOopPtr *toop) { |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2546 |
Node *mem = mmem; |
6741 | 2547 |
// TypeOopPtr::NOTNULL+any is an OOP with unknown offset - generally |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2548 |
// means an array I have not precisely typed yet. Do not do any |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2549 |
// alias stuff with it any time soon. |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2550 |
if (toop->base() != Type::AnyPtr && |
6741 | 2551 |
!(toop->klass() != NULL && |
2552 |
toop->klass()->is_java_lang_Object() && |
|
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2553 |
toop->offset() == Type::OffsetBot)) { |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2554 |
mem = mmem->memory_at(alias_idx); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2555 |
// Update input if it is progress over what we have now |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2556 |
} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2557 |
return mem; |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2558 |
} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2559 |
|
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2560 |
// |
4471
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2561 |
// Move memory users to their memory slices. |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2562 |
// |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2563 |
void ConnectionGraph::move_inst_mem(Node* n, GrowableArray<PhiNode *> &orig_phis) { |
4471
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2564 |
Compile* C = _compile; |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2565 |
PhaseGVN* igvn = _igvn; |
4471
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2566 |
const TypePtr* tp = igvn->type(n->in(MemNode::Address))->isa_ptr(); |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2567 |
assert(tp != NULL, "ptr type"); |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2568 |
int alias_idx = C->get_alias_index(tp); |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2569 |
int general_idx = C->get_general_index(alias_idx); |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2570 |
|
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2571 |
// Move users first |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2572 |
for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) { |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2573 |
Node* use = n->fast_out(i); |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2574 |
if (use->is_MergeMem()) { |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2575 |
MergeMemNode* mmem = use->as_MergeMem(); |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2576 |
assert(n == mmem->memory_at(alias_idx), "should be on instance memory slice"); |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2577 |
if (n != mmem->memory_at(general_idx) || alias_idx == general_idx) { |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2578 |
continue; // Nothing to do |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2579 |
} |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2580 |
// Replace previous general reference to mem node. |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2581 |
uint orig_uniq = C->unique(); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2582 |
Node* m = find_inst_mem(n, general_idx, orig_phis); |
4471
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2583 |
assert(orig_uniq == C->unique(), "no new nodes"); |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2584 |
mmem->set_memory_at(general_idx, m); |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2585 |
--imax; |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2586 |
--i; |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2587 |
} else if (use->is_MemBar()) { |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2588 |
assert(!use->is_Initialize(), "initializing stores should not be moved"); |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2589 |
if (use->req() > MemBarNode::Precedent && |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2590 |
use->in(MemBarNode::Precedent) == n) { |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2591 |
// Don't move related membars. |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2592 |
record_for_optimizer(use); |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2593 |
continue; |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2594 |
} |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2595 |
tp = use->as_MemBar()->adr_type()->isa_ptr(); |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2596 |
if (tp != NULL && C->get_alias_index(tp) == alias_idx || |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2597 |
alias_idx == general_idx) { |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2598 |
continue; // Nothing to do |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2599 |
} |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2600 |
// Move to general memory slice. |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2601 |
uint orig_uniq = C->unique(); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2602 |
Node* m = find_inst_mem(n, general_idx, orig_phis); |
4471
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2603 |
assert(orig_uniq == C->unique(), "no new nodes"); |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2604 |
igvn->hash_delete(use); |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2605 |
imax -= use->replace_edge(n, m); |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2606 |
igvn->hash_insert(use); |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2607 |
record_for_optimizer(use); |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2608 |
--i; |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2609 |
#ifdef ASSERT |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2610 |
} else if (use->is_Mem()) { |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2611 |
if (use->Opcode() == Op_StoreCM && use->in(MemNode::OopStore) == n) { |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2612 |
// Don't move related cardmark. |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2613 |
continue; |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2614 |
} |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2615 |
// Memory nodes should have new memory input. |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2616 |
tp = igvn->type(use->in(MemNode::Address))->isa_ptr(); |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2617 |
assert(tp != NULL, "ptr type"); |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2618 |
int idx = C->get_alias_index(tp); |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2619 |
assert(get_map(use->_idx) != NULL || idx == alias_idx, |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2620 |
"Following memory nodes should have new memory input or be on the same memory slice"); |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2621 |
} else if (use->is_Phi()) { |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2622 |
// Phi nodes should be split and moved already. |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2623 |
tp = use->as_Phi()->adr_type()->isa_ptr(); |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2624 |
assert(tp != NULL, "ptr type"); |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2625 |
int idx = C->get_alias_index(tp); |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2626 |
assert(idx == alias_idx, "Following Phi nodes should be on the same memory slice"); |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2627 |
} else { |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2628 |
use->dump(); |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2629 |
assert(false, "should not be here"); |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2630 |
#endif |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2631 |
} |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2632 |
} |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2633 |
} |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2634 |
|
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2635 |
// |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2636 |
// Search memory chain of "mem" to find a MemNode whose address |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2637 |
// is the specified alias index. |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2638 |
// |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2639 |
Node* ConnectionGraph::find_inst_mem(Node *orig_mem, int alias_idx, GrowableArray<PhiNode *> &orig_phis) { |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2640 |
if (orig_mem == NULL) |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2641 |
return orig_mem; |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2642 |
Compile* C = _compile; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2643 |
PhaseGVN* igvn = _igvn; |
6741 | 2644 |
const TypeOopPtr *toop = C->get_adr_type(alias_idx)->isa_oopptr(); |
2645 |
bool is_instance = (toop != NULL) && toop->is_known_instance(); |
|
961
7fb3b13d4205
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
955
diff
changeset
|
2646 |
Node *start_mem = C->start()->proj_out(TypeFunc::Memory); |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2647 |
Node *prev = NULL; |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2648 |
Node *result = orig_mem; |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2649 |
while (prev != result) { |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2650 |
prev = result; |
961
7fb3b13d4205
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
955
diff
changeset
|
2651 |
if (result == start_mem) |
2131 | 2652 |
break; // hit one of our sentinels |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2653 |
if (result->is_Mem()) { |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2654 |
const Type *at = igvn->type(result->in(MemNode::Address)); |
9115
5a28312aa393
6992789: assert(phi->_idx >= nodes_size()) failed: only new Phi per instance memory slice
kvn
parents:
8319
diff
changeset
|
2655 |
if (at == Type::TOP) |
5a28312aa393
6992789: assert(phi->_idx >= nodes_size()) failed: only new Phi per instance memory slice
kvn
parents:
8319
diff
changeset
|
2656 |
break; // Dead |
5a28312aa393
6992789: assert(phi->_idx >= nodes_size()) failed: only new Phi per instance memory slice
kvn
parents:
8319
diff
changeset
|
2657 |
assert (at->isa_ptr() != NULL, "pointer type required."); |
5a28312aa393
6992789: assert(phi->_idx >= nodes_size()) failed: only new Phi per instance memory slice
kvn
parents:
8319
diff
changeset
|
2658 |
int idx = C->get_alias_index(at->is_ptr()); |
5a28312aa393
6992789: assert(phi->_idx >= nodes_size()) failed: only new Phi per instance memory slice
kvn
parents:
8319
diff
changeset
|
2659 |
if (idx == alias_idx) |
5a28312aa393
6992789: assert(phi->_idx >= nodes_size()) failed: only new Phi per instance memory slice
kvn
parents:
8319
diff
changeset
|
2660 |
break; // Found |
5a28312aa393
6992789: assert(phi->_idx >= nodes_size()) failed: only new Phi per instance memory slice
kvn
parents:
8319
diff
changeset
|
2661 |
if (!is_instance && (at->isa_oopptr() == NULL || |
5a28312aa393
6992789: assert(phi->_idx >= nodes_size()) failed: only new Phi per instance memory slice
kvn
parents:
8319
diff
changeset
|
2662 |
!at->is_oopptr()->is_known_instance())) { |
5a28312aa393
6992789: assert(phi->_idx >= nodes_size()) failed: only new Phi per instance memory slice
kvn
parents:
8319
diff
changeset
|
2663 |
break; // Do not skip store to general memory slice. |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2664 |
} |
961
7fb3b13d4205
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
955
diff
changeset
|
2665 |
result = result->in(MemNode::Memory); |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2666 |
} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2667 |
if (!is_instance) |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2668 |
continue; // don't search further for non-instance types |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2669 |
// skip over a call which does not affect this memory slice |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2670 |
if (result->is_Proj() && result->as_Proj()->_con == TypeFunc::Memory) { |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2671 |
Node *proj_in = result->in(0); |
6741 | 2672 |
if (proj_in->is_Allocate() && proj_in->_idx == (uint)toop->instance_id()) { |
2131 | 2673 |
break; // hit one of our sentinels |
961
7fb3b13d4205
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
955
diff
changeset
|
2674 |
} else if (proj_in->is_Call()) { |
30629
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
2675 |
// ArrayCopy node processed here as well |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2676 |
CallNode *call = proj_in->as_Call(); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2677 |
if (!call->may_modify(toop, igvn)) { |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2678 |
result = call->in(TypeFunc::Memory); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2679 |
} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2680 |
} else if (proj_in->is_Initialize()) { |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2681 |
AllocateNode* alloc = proj_in->as_Initialize()->allocation(); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2682 |
// Stop if this is the initialization for the object instance which |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2683 |
// which contains this memory slice, otherwise skip over it. |
6741 | 2684 |
if (alloc == NULL || alloc->_idx != (uint)toop->instance_id()) { |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2685 |
result = proj_in->in(TypeFunc::Memory); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2686 |
} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2687 |
} else if (proj_in->is_MemBar()) { |
30629
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
2688 |
if (proj_in->in(TypeFunc::Memory)->is_MergeMem() && |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
2689 |
proj_in->in(TypeFunc::Memory)->as_MergeMem()->in(Compile::AliasIdxRaw)->is_Proj() && |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
2690 |
proj_in->in(TypeFunc::Memory)->as_MergeMem()->in(Compile::AliasIdxRaw)->in(0)->is_ArrayCopy()) { |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
2691 |
// clone |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
2692 |
ArrayCopyNode* ac = proj_in->in(TypeFunc::Memory)->as_MergeMem()->in(Compile::AliasIdxRaw)->in(0)->as_ArrayCopy(); |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
2693 |
if (ac->may_modify(toop, igvn)) { |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
2694 |
break; |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
2695 |
} |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
2696 |
} |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2697 |
result = proj_in->in(TypeFunc::Memory); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2698 |
} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2699 |
} else if (result->is_MergeMem()) { |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2700 |
MergeMemNode *mmem = result->as_MergeMem(); |
6741 | 2701 |
result = step_through_mergemem(mmem, alias_idx, toop); |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2702 |
if (result == mmem->base_memory()) { |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2703 |
// Didn't find instance memory, search through general slice recursively. |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2704 |
result = mmem->memory_at(C->get_general_index(alias_idx)); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2705 |
result = find_inst_mem(result, alias_idx, orig_phis); |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2706 |
if (C->failing()) { |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2707 |
return NULL; |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2708 |
} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2709 |
mmem->set_memory_at(alias_idx, result); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2710 |
} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2711 |
} else if (result->is_Phi() && |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2712 |
C->get_alias_index(result->as_Phi()->adr_type()) != alias_idx) { |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2713 |
Node *un = result->as_Phi()->unique_input(igvn); |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2714 |
if (un != NULL) { |
4471
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2715 |
orig_phis.append_if_missing(result->as_Phi()); |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2716 |
result = un; |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2717 |
} else { |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2718 |
break; |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2719 |
} |
4470
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
2720 |
} else if (result->is_ClearArray()) { |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2721 |
if (!ClearArrayNode::step_through(&result, (uint)toop->instance_id(), igvn)) { |
4470
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
2722 |
// Can not bypass initialization of the instance |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
2723 |
// we are looking for. |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
2724 |
break; |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
2725 |
} |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
2726 |
// Otherwise skip it (the call updated 'result' value). |
2110
40e42c95ac39
6802499: EA: assert(false,"unknown node on this path")
kvn
parents:
1613
diff
changeset
|
2727 |
} else if (result->Opcode() == Op_SCMemProj) { |
15242
695bb216be99
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
14623
diff
changeset
|
2728 |
Node* mem = result->in(0); |
695bb216be99
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
14623
diff
changeset
|
2729 |
Node* adr = NULL; |
695bb216be99
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
14623
diff
changeset
|
2730 |
if (mem->is_LoadStore()) { |
695bb216be99
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
14623
diff
changeset
|
2731 |
adr = mem->in(MemNode::Address); |
695bb216be99
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
14623
diff
changeset
|
2732 |
} else { |
33628 | 2733 |
assert(mem->Opcode() == Op_EncodeISOArray || |
2734 |
mem->Opcode() == Op_StrCompressedCopy, "sanity"); |
|
15242
695bb216be99
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
14623
diff
changeset
|
2735 |
adr = mem->in(3); // Memory edge corresponds to destination array |
695bb216be99
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
14623
diff
changeset
|
2736 |
} |
695bb216be99
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
14623
diff
changeset
|
2737 |
const Type *at = igvn->type(adr); |
2110
40e42c95ac39
6802499: EA: assert(false,"unknown node on this path")
kvn
parents:
1613
diff
changeset
|
2738 |
if (at != Type::TOP) { |
33628 | 2739 |
assert(at->isa_ptr() != NULL, "pointer type required."); |
2110
40e42c95ac39
6802499: EA: assert(false,"unknown node on this path")
kvn
parents:
1613
diff
changeset
|
2740 |
int idx = C->get_alias_index(at->is_ptr()); |
33628 | 2741 |
if (idx == alias_idx) { |
2742 |
// Assert in debug mode |
|
2743 |
assert(false, "Object is not scalar replaceable if a LoadStore node accesses its field"); |
|
2744 |
break; // In product mode return SCMemProj node |
|
2745 |
} |
|
2110
40e42c95ac39
6802499: EA: assert(false,"unknown node on this path")
kvn
parents:
1613
diff
changeset
|
2746 |
} |
15242
695bb216be99
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
14623
diff
changeset
|
2747 |
result = mem->in(MemNode::Memory); |
33628 | 2748 |
} else if (result->Opcode() == Op_StrInflatedCopy) { |
2749 |
Node* adr = result->in(3); // Memory edge corresponds to destination array |
|
2750 |
const Type *at = igvn->type(adr); |
|
2751 |
if (at != Type::TOP) { |
|
2752 |
assert(at->isa_ptr() != NULL, "pointer type required."); |
|
2753 |
int idx = C->get_alias_index(at->is_ptr()); |
|
2754 |
if (idx == alias_idx) { |
|
2755 |
// Assert in debug mode |
|
2756 |
assert(false, "Object is not scalar replaceable if a StrInflatedCopy node accesses its field"); |
|
2757 |
break; // In product mode return SCMemProj node |
|
2758 |
} |
|
2759 |
} |
|
2760 |
result = result->in(MemNode::Memory); |
|
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2761 |
} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2762 |
} |
955 | 2763 |
if (result->is_Phi()) { |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2764 |
PhiNode *mphi = result->as_Phi(); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2765 |
assert(mphi->bottom_type() == Type::MEMORY, "memory phi required"); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2766 |
const TypePtr *t = mphi->adr_type(); |
9115
5a28312aa393
6992789: assert(phi->_idx >= nodes_size()) failed: only new Phi per instance memory slice
kvn
parents:
8319
diff
changeset
|
2767 |
if (!is_instance) { |
955 | 2768 |
// Push all non-instance Phis on the orig_phis worklist to update inputs |
2769 |
// during Phase 4 if needed. |
|
2770 |
orig_phis.append_if_missing(mphi); |
|
9115
5a28312aa393
6992789: assert(phi->_idx >= nodes_size()) failed: only new Phi per instance memory slice
kvn
parents:
8319
diff
changeset
|
2771 |
} else if (C->get_alias_index(t) != alias_idx) { |
5a28312aa393
6992789: assert(phi->_idx >= nodes_size()) failed: only new Phi per instance memory slice
kvn
parents:
8319
diff
changeset
|
2772 |
// Create a new Phi with the specified alias index type. |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2773 |
result = split_memory_phi(mphi, alias_idx, orig_phis); |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2774 |
} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2775 |
} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2776 |
// the result is either MemNode, PhiNode, InitializeNode. |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2777 |
return result; |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2778 |
} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2779 |
|
1 | 2780 |
// |
2781 |
// Convert the types of unescaped object to instance types where possible, |
|
2782 |
// propagate the new type information through the graph, and update memory |
|
2783 |
// edges and MergeMem inputs to reflect the new type. |
|
2784 |
// |
|
2785 |
// We start with allocations (and calls which may be allocations) on alloc_worklist. |
|
2786 |
// The processing is done in 4 phases: |
|
2787 |
// |
|
2788 |
// Phase 1: Process possible allocations from alloc_worklist. Create instance |
|
2789 |
// types for the CheckCastPP for allocations where possible. |
|
30629
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
2790 |
// Propagate the new types through users as follows: |
1 | 2791 |
// casts and Phi: push users on alloc_worklist |
2792 |
// AddP: cast Base and Address inputs to the instance type |
|
2793 |
// push any AddP users on alloc_worklist and push any memnode |
|
2794 |
// users onto memnode_worklist. |
|
2795 |
// Phase 2: Process MemNode's from memnode_worklist. compute new address type and |
|
2796 |
// search the Memory chain for a store with the appropriate type |
|
2797 |
// address type. If a Phi is found, create a new version with |
|
2131 | 2798 |
// the appropriate memory slices from each of the Phi inputs. |
1 | 2799 |
// For stores, process the users as follows: |
2800 |
// MemNode: push on memnode_worklist |
|
2801 |
// MergeMem: push on mergemem_worklist |
|
2802 |
// Phase 3: Process MergeMem nodes from mergemem_worklist. Walk each memory slice |
|
2803 |
// moving the first node encountered of each instance type to the |
|
2804 |
// the input corresponding to its alias index. |
|
2805 |
// appropriate memory slice. |
|
2806 |
// Phase 4: Update the inputs of non-instance memory Phis and the Memory input of memnodes. |
|
2807 |
// |
|
2808 |
// In the following example, the CheckCastPP nodes are the cast of allocation |
|
2809 |
// results and the allocation of node 29 is unescaped and eligible to be an |
|
2810 |
// instance type. |
|
2811 |
// |
|
2812 |
// We start with: |
|
2813 |
// |
|
2814 |
// 7 Parm #memory |
|
2815 |
// 10 ConI "12" |
|
2816 |
// 19 CheckCastPP "Foo" |
|
2817 |
// 20 AddP _ 19 19 10 Foo+12 alias_index=4 |
|
2818 |
// 29 CheckCastPP "Foo" |
|
2819 |
// 30 AddP _ 29 29 10 Foo+12 alias_index=4 |
|
2820 |
// |
|
2821 |
// 40 StoreP 25 7 20 ... alias_index=4 |
|
2822 |
// 50 StoreP 35 40 30 ... alias_index=4 |
|
2823 |
// 60 StoreP 45 50 20 ... alias_index=4 |
|
2824 |
// 70 LoadP _ 60 30 ... alias_index=4 |
|
2825 |
// 80 Phi 75 50 60 Memory alias_index=4 |
|
2826 |
// 90 LoadP _ 80 30 ... alias_index=4 |
|
2827 |
// 100 LoadP _ 80 20 ... alias_index=4 |
|
2828 |
// |
|
2829 |
// |
|
2830 |
// Phase 1 creates an instance type for node 29 assigning it an instance id of 24 |
|
2831 |
// and creating a new alias index for node 30. This gives: |
|
2832 |
// |
|
2833 |
// 7 Parm #memory |
|
2834 |
// 10 ConI "12" |
|
2835 |
// 19 CheckCastPP "Foo" |
|
2836 |
// 20 AddP _ 19 19 10 Foo+12 alias_index=4 |
|
2837 |
// 29 CheckCastPP "Foo" iid=24 |
|
2838 |
// 30 AddP _ 29 29 10 Foo+12 alias_index=6 iid=24 |
|
2839 |
// |
|
2840 |
// 40 StoreP 25 7 20 ... alias_index=4 |
|
2841 |
// 50 StoreP 35 40 30 ... alias_index=6 |
|
2842 |
// 60 StoreP 45 50 20 ... alias_index=4 |
|
2843 |
// 70 LoadP _ 60 30 ... alias_index=6 |
|
2844 |
// 80 Phi 75 50 60 Memory alias_index=4 |
|
2845 |
// 90 LoadP _ 80 30 ... alias_index=6 |
|
2846 |
// 100 LoadP _ 80 20 ... alias_index=4 |
|
2847 |
// |
|
2848 |
// In phase 2, new memory inputs are computed for the loads and stores, |
|
2849 |
// And a new version of the phi is created. In phase 4, the inputs to |
|
2850 |
// node 80 are updated and then the memory nodes are updated with the |
|
2851 |
// values computed in phase 2. This results in: |
|
2852 |
// |
|
2853 |
// 7 Parm #memory |
|
2854 |
// 10 ConI "12" |
|
2855 |
// 19 CheckCastPP "Foo" |
|
2856 |
// 20 AddP _ 19 19 10 Foo+12 alias_index=4 |
|
2857 |
// 29 CheckCastPP "Foo" iid=24 |
|
2858 |
// 30 AddP _ 29 29 10 Foo+12 alias_index=6 iid=24 |
|
2859 |
// |
|
2860 |
// 40 StoreP 25 7 20 ... alias_index=4 |
|
2861 |
// 50 StoreP 35 7 30 ... alias_index=6 |
|
2862 |
// 60 StoreP 45 40 20 ... alias_index=4 |
|
2863 |
// 70 LoadP _ 50 30 ... alias_index=6 |
|
2864 |
// 80 Phi 75 40 60 Memory alias_index=4 |
|
2865 |
// 120 Phi 75 50 50 Memory alias_index=6 |
|
2866 |
// 90 LoadP _ 120 30 ... alias_index=6 |
|
2867 |
// 100 LoadP _ 80 20 ... alias_index=4 |
|
2868 |
// |
|
30629
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
2869 |
void ConnectionGraph::split_unique_types(GrowableArray<Node *> &alloc_worklist, GrowableArray<ArrayCopyNode*> &arraycopy_worklist) { |
1 | 2870 |
GrowableArray<Node *> memnode_worklist; |
2871 |
GrowableArray<PhiNode *> orig_phis; |
|
7122 | 2872 |
PhaseIterGVN *igvn = _igvn; |
1 | 2873 |
uint new_index_start = (uint) _compile->num_alias_types(); |
4471
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2874 |
Arena* arena = Thread::current()->resource_area(); |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2875 |
VectorSet visited(arena); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2876 |
ideal_nodes.clear(); // Reset for use with set_map/get_map. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2877 |
uint unique_old = _compile->unique(); |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2878 |
|
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2879 |
// Phase 1: Process possible allocations from alloc_worklist. |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2880 |
// Create instance types for the CheckCastPP for allocations where possible. |
952
38812d18eec0
6684714: Optimize EA Connection Graph build performance
kvn
parents:
769
diff
changeset
|
2881 |
// |
38812d18eec0
6684714: Optimize EA Connection Graph build performance
kvn
parents:
769
diff
changeset
|
2882 |
// (Note: don't forget to change the order of the second AddP node on |
38812d18eec0
6684714: Optimize EA Connection Graph build performance
kvn
parents:
769
diff
changeset
|
2883 |
// the alloc_worklist if the order of the worklist processing is changed, |
38812d18eec0
6684714: Optimize EA Connection Graph build performance
kvn
parents:
769
diff
changeset
|
2884 |
// see the comment in find_second_addp().) |
38812d18eec0
6684714: Optimize EA Connection Graph build performance
kvn
parents:
769
diff
changeset
|
2885 |
// |
1 | 2886 |
while (alloc_worklist.length() != 0) { |
2887 |
Node *n = alloc_worklist.pop(); |
|
2888 |
uint ni = n->_idx; |
|
2889 |
if (n->is_Call()) { |
|
2890 |
CallNode *alloc = n->as_Call(); |
|
2891 |
// copy escape information to call node |
|
952
38812d18eec0
6684714: Optimize EA Connection Graph build performance
kvn
parents:
769
diff
changeset
|
2892 |
PointsToNode* ptn = ptnode_adr(alloc->_idx); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2893 |
PointsToNode::EscapeState es = ptn->escape_state(); |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2894 |
// We have an allocation or call which returns a Java object, |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2895 |
// see if it is unescaped. |
10982
85bcf8ef9cc8
7059047: EA: can't find initializing store with several CheckCastPP
kvn
parents:
10970
diff
changeset
|
2896 |
if (es != PointsToNode::NoEscape || !ptn->scalar_replaceable()) |
1 | 2897 |
continue; |
2871
519e22b6900d
6836054: java/util/Arrays/CopyMethods.java fails on solaris-sparc with IllegalArgumentException
kvn
parents:
2131
diff
changeset
|
2898 |
// Find CheckCastPP for the allocate or for the return value of a call |
519e22b6900d
6836054: java/util/Arrays/CopyMethods.java fails on solaris-sparc with IllegalArgumentException
kvn
parents:
2131
diff
changeset
|
2899 |
n = alloc->result_cast(); |
519e22b6900d
6836054: java/util/Arrays/CopyMethods.java fails on solaris-sparc with IllegalArgumentException
kvn
parents:
2131
diff
changeset
|
2900 |
if (n == NULL) { // No uses except Initialize node |
519e22b6900d
6836054: java/util/Arrays/CopyMethods.java fails on solaris-sparc with IllegalArgumentException
kvn
parents:
2131
diff
changeset
|
2901 |
if (alloc->is_Allocate()) { |
519e22b6900d
6836054: java/util/Arrays/CopyMethods.java fails on solaris-sparc with IllegalArgumentException
kvn
parents:
2131
diff
changeset
|
2902 |
// Set the scalar_replaceable flag for allocation |
519e22b6900d
6836054: java/util/Arrays/CopyMethods.java fails on solaris-sparc with IllegalArgumentException
kvn
parents:
2131
diff
changeset
|
2903 |
// so it could be eliminated if it has no uses. |
519e22b6900d
6836054: java/util/Arrays/CopyMethods.java fails on solaris-sparc with IllegalArgumentException
kvn
parents:
2131
diff
changeset
|
2904 |
alloc->as_Allocate()->_is_scalar_replaceable = true; |
519e22b6900d
6836054: java/util/Arrays/CopyMethods.java fails on solaris-sparc with IllegalArgumentException
kvn
parents:
2131
diff
changeset
|
2905 |
} |
17383 | 2906 |
if (alloc->is_CallStaticJava()) { |
2907 |
// Set the scalar_replaceable flag for boxing method |
|
2908 |
// so it could be eliminated if it has no uses. |
|
2909 |
alloc->as_CallStaticJava()->_is_scalar_replaceable = true; |
|
2910 |
} |
|
2871
519e22b6900d
6836054: java/util/Arrays/CopyMethods.java fails on solaris-sparc with IllegalArgumentException
kvn
parents:
2131
diff
changeset
|
2911 |
continue; |
212
cd4963e67949
6667612: (Escape Analysis) disable loop cloning if it has a scalar replaceable allocation
kvn
parents:
211
diff
changeset
|
2912 |
} |
2871
519e22b6900d
6836054: java/util/Arrays/CopyMethods.java fails on solaris-sparc with IllegalArgumentException
kvn
parents:
2131
diff
changeset
|
2913 |
if (!n->is_CheckCastPP()) { // not unique CheckCastPP. |
519e22b6900d
6836054: java/util/Arrays/CopyMethods.java fails on solaris-sparc with IllegalArgumentException
kvn
parents:
2131
diff
changeset
|
2914 |
assert(!alloc->is_Allocate(), "allocation should have unique type"); |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2915 |
continue; |
2871
519e22b6900d
6836054: java/util/Arrays/CopyMethods.java fails on solaris-sparc with IllegalArgumentException
kvn
parents:
2131
diff
changeset
|
2916 |
} |
519e22b6900d
6836054: java/util/Arrays/CopyMethods.java fails on solaris-sparc with IllegalArgumentException
kvn
parents:
2131
diff
changeset
|
2917 |
|
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2918 |
// The inline code for Object.clone() casts the allocation result to |
955 | 2919 |
// java.lang.Object and then to the actual type of the allocated |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2920 |
// object. Detect this case and use the second cast. |
955 | 2921 |
// Also detect j.l.reflect.Array.newInstance(jobject, jint) case when |
2922 |
// the allocation result is cast to java.lang.Object and then |
|
2923 |
// to the actual Array type. |
|
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2924 |
if (alloc->is_Allocate() && n->as_Type()->type() == TypeInstPtr::NOTNULL |
955 | 2925 |
&& (alloc->is_AllocateArray() || |
2926 |
igvn->type(alloc->in(AllocateNode::KlassNode)) != TypeKlassPtr::OBJECT)) { |
|
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2927 |
Node *cast2 = NULL; |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2928 |
for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) { |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2929 |
Node *use = n->fast_out(i); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2930 |
if (use->is_CheckCastPP()) { |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2931 |
cast2 = use; |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2932 |
break; |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2933 |
} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2934 |
} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2935 |
if (cast2 != NULL) { |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2936 |
n = cast2; |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2937 |
} else { |
2871
519e22b6900d
6836054: java/util/Arrays/CopyMethods.java fails on solaris-sparc with IllegalArgumentException
kvn
parents:
2131
diff
changeset
|
2938 |
// Non-scalar replaceable if the allocation type is unknown statically |
519e22b6900d
6836054: java/util/Arrays/CopyMethods.java fails on solaris-sparc with IllegalArgumentException
kvn
parents:
2131
diff
changeset
|
2939 |
// (reflection allocation), the object can't be restored during |
519e22b6900d
6836054: java/util/Arrays/CopyMethods.java fails on solaris-sparc with IllegalArgumentException
kvn
parents:
2131
diff
changeset
|
2940 |
// deoptimization without precise type. |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2941 |
continue; |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2942 |
} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2943 |
} |
26917
c3574c0b2da0
8058825: EA: ConnectionGraph::split_unique_types does incorrect scalar replacement
vlivanov
parents:
26913
diff
changeset
|
2944 |
|
c3574c0b2da0
8058825: EA: ConnectionGraph::split_unique_types does incorrect scalar replacement
vlivanov
parents:
26913
diff
changeset
|
2945 |
const TypeOopPtr *t = igvn->type(n)->isa_oopptr(); |
c3574c0b2da0
8058825: EA: ConnectionGraph::split_unique_types does incorrect scalar replacement
vlivanov
parents:
26913
diff
changeset
|
2946 |
if (t == NULL) |
c3574c0b2da0
8058825: EA: ConnectionGraph::split_unique_types does incorrect scalar replacement
vlivanov
parents:
26913
diff
changeset
|
2947 |
continue; // not a TypeOopPtr |
c3574c0b2da0
8058825: EA: ConnectionGraph::split_unique_types does incorrect scalar replacement
vlivanov
parents:
26913
diff
changeset
|
2948 |
if (!t->klass_is_exact()) |
c3574c0b2da0
8058825: EA: ConnectionGraph::split_unique_types does incorrect scalar replacement
vlivanov
parents:
26913
diff
changeset
|
2949 |
continue; // not an unique type |
c3574c0b2da0
8058825: EA: ConnectionGraph::split_unique_types does incorrect scalar replacement
vlivanov
parents:
26913
diff
changeset
|
2950 |
|
2871
519e22b6900d
6836054: java/util/Arrays/CopyMethods.java fails on solaris-sparc with IllegalArgumentException
kvn
parents:
2131
diff
changeset
|
2951 |
if (alloc->is_Allocate()) { |
519e22b6900d
6836054: java/util/Arrays/CopyMethods.java fails on solaris-sparc with IllegalArgumentException
kvn
parents:
2131
diff
changeset
|
2952 |
// Set the scalar_replaceable flag for allocation |
519e22b6900d
6836054: java/util/Arrays/CopyMethods.java fails on solaris-sparc with IllegalArgumentException
kvn
parents:
2131
diff
changeset
|
2953 |
// so it could be eliminated. |
519e22b6900d
6836054: java/util/Arrays/CopyMethods.java fails on solaris-sparc with IllegalArgumentException
kvn
parents:
2131
diff
changeset
|
2954 |
alloc->as_Allocate()->_is_scalar_replaceable = true; |
519e22b6900d
6836054: java/util/Arrays/CopyMethods.java fails on solaris-sparc with IllegalArgumentException
kvn
parents:
2131
diff
changeset
|
2955 |
} |
17383 | 2956 |
if (alloc->is_CallStaticJava()) { |
2957 |
// Set the scalar_replaceable flag for boxing method |
|
2958 |
// so it could be eliminated. |
|
2959 |
alloc->as_CallStaticJava()->_is_scalar_replaceable = true; |
|
2960 |
} |
|
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2961 |
set_escape_state(ptnode_adr(n->_idx), es); // CheckCastPP escape state |
955 | 2962 |
// in order for an object to be scalar-replaceable, it must be: |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2963 |
// - a direct allocation (not a call returning an object) |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2964 |
// - non-escaping |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2965 |
// - eligible to be a unique type |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2966 |
// - not determined to be ineligible by escape analysis |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2967 |
set_map(alloc, n); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2968 |
set_map(n, alloc); |
26917
c3574c0b2da0
8058825: EA: ConnectionGraph::split_unique_types does incorrect scalar replacement
vlivanov
parents:
26913
diff
changeset
|
2969 |
const TypeOopPtr* tinst = t->cast_to_instance_id(ni); |
1 | 2970 |
igvn->hash_delete(n); |
2971 |
igvn->set_type(n, tinst); |
|
2972 |
n->raise_bottom_type(tinst); |
|
2973 |
igvn->hash_insert(n); |
|
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2974 |
record_for_optimizer(n); |
10982
85bcf8ef9cc8
7059047: EA: can't find initializing store with several CheckCastPP
kvn
parents:
10970
diff
changeset
|
2975 |
if (alloc->is_Allocate() && (t->isa_instptr() || t->isa_aryptr())) { |
589 | 2976 |
|
2977 |
// First, put on the worklist all Field edges from Connection Graph |
|
30629
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
2978 |
// which is more accurate than putting immediate users from Ideal Graph. |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2979 |
for (EdgeIterator e(ptn); e.has_next(); e.next()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2980 |
PointsToNode* tgt = e.get(); |
30629
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
2981 |
if (tgt->is_Arraycopy()) { |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
2982 |
continue; |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
2983 |
} |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2984 |
Node* use = tgt->ideal_node(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2985 |
assert(tgt->is_Field() && use->is_AddP(), |
589 | 2986 |
"only AddP nodes are Field edges in CG"); |
2987 |
if (use->outcnt() > 0) { // Don't process dead nodes |
|
2988 |
Node* addp2 = find_second_addp(use, use->in(AddPNode::Base)); |
|
2989 |
if (addp2 != NULL) { |
|
2990 |
assert(alloc->is_AllocateArray(),"array allocation was expected"); |
|
2991 |
alloc_worklist.append_if_missing(addp2); |
|
2992 |
} |
|
2993 |
alloc_worklist.append_if_missing(use); |
|
2994 |
} |
|
2995 |
} |
|
2996 |
||
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2997 |
// An allocation may have an Initialize which has raw stores. Scan |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2998 |
// the users of the raw allocation result and push AddP users |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2999 |
// on alloc_worklist. |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3000 |
Node *raw_result = alloc->proj_out(TypeFunc::Parms); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3001 |
assert (raw_result != NULL, "must have an allocation result"); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3002 |
for (DUIterator_Fast imax, i = raw_result->fast_outs(imax); i < imax; i++) { |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3003 |
Node *use = raw_result->fast_out(i); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3004 |
if (use->is_AddP() && use->outcnt() > 0) { // Don't process dead nodes |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3005 |
Node* addp2 = find_second_addp(use, raw_result); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3006 |
if (addp2 != NULL) { |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3007 |
assert(alloc->is_AllocateArray(),"array allocation was expected"); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3008 |
alloc_worklist.append_if_missing(addp2); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3009 |
} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3010 |
alloc_worklist.append_if_missing(use); |
4470
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3011 |
} else if (use->is_MemBar()) { |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3012 |
memnode_worklist.append_if_missing(use); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3013 |
} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3014 |
} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3015 |
} |
1 | 3016 |
} else if (n->is_AddP()) { |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3017 |
JavaObjectNode* jobj = unique_java_object(get_addp_base(n)); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3018 |
if (jobj == NULL || jobj == phantom_obj) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3019 |
#ifdef ASSERT |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3020 |
ptnode_adr(get_addp_base(n)->_idx)->dump(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3021 |
ptnode_adr(n->_idx)->dump(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3022 |
assert(jobj != NULL && jobj != phantom_obj, "escaped allocation"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3023 |
#endif |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3024 |
_compile->record_failure(C2Compiler::retry_no_escape_analysis()); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3025 |
return; |
4470
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3026 |
} |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3027 |
Node *base = get_map(jobj->idx()); // CheckCastPP node |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3028 |
if (!split_AddP(n, base)) continue; // wrong type from dead path |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3029 |
} else if (n->is_Phi() || |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3030 |
n->is_CheckCastPP() || |
594
9f4474e5dbaf
6705887: Compressed Oops: generate x64 addressing and implicit null checks with narrow oops
kvn
parents:
590
diff
changeset
|
3031 |
n->is_EncodeP() || |
9f4474e5dbaf
6705887: Compressed Oops: generate x64 addressing and implicit null checks with narrow oops
kvn
parents:
590
diff
changeset
|
3032 |
n->is_DecodeN() || |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3033 |
(n->is_ConstraintCast() && n->Opcode() == Op_CastPP)) { |
1 | 3034 |
if (visited.test_set(n->_idx)) { |
3035 |
assert(n->is_Phi(), "loops only through Phi's"); |
|
3036 |
continue; // already processed |
|
3037 |
} |
|
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3038 |
JavaObjectNode* jobj = unique_java_object(n); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3039 |
if (jobj == NULL || jobj == phantom_obj) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3040 |
#ifdef ASSERT |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3041 |
ptnode_adr(n->_idx)->dump(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3042 |
assert(jobj != NULL && jobj != phantom_obj, "escaped allocation"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3043 |
#endif |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3044 |
_compile->record_failure(C2Compiler::retry_no_escape_analysis()); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3045 |
return; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3046 |
} else { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3047 |
Node *val = get_map(jobj->idx()); // CheckCastPP node |
1 | 3048 |
TypeNode *tn = n->as_Type(); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3049 |
const TypeOopPtr* tinst = igvn->type(val)->isa_oopptr(); |
769 | 3050 |
assert(tinst != NULL && tinst->is_known_instance() && |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3051 |
tinst->instance_id() == jobj->idx() , "instance type expected."); |
589 | 3052 |
|
3053 |
const Type *tn_type = igvn->type(tn); |
|
769 | 3054 |
const TypeOopPtr *tn_t; |
3055 |
if (tn_type->isa_narrowoop()) { |
|
3056 |
tn_t = tn_type->make_ptr()->isa_oopptr(); |
|
3057 |
} else { |
|
3058 |
tn_t = tn_type->isa_oopptr(); |
|
3059 |
} |
|
4470
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3060 |
if (tn_t != NULL && tinst->klass()->is_subtype_of(tn_t->klass())) { |
589 | 3061 |
if (tn_type->isa_narrowoop()) { |
3062 |
tn_type = tinst->make_narrowoop(); |
|
3063 |
} else { |
|
3064 |
tn_type = tinst; |
|
3065 |
} |
|
1 | 3066 |
igvn->hash_delete(tn); |
589 | 3067 |
igvn->set_type(tn, tn_type); |
3068 |
tn->set_type(tn_type); |
|
1 | 3069 |
igvn->hash_insert(tn); |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3070 |
record_for_optimizer(n); |
1055
f4fb9fb08038
6731641: assert(m->adr_type() == mach->adr_type(),"matcher should not change adr type")
kvn
parents:
961
diff
changeset
|
3071 |
} else { |
4470
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3072 |
assert(tn_type == TypePtr::NULL_PTR || |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3073 |
tn_t != NULL && !tinst->klass()->is_subtype_of(tn_t->klass()), |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3074 |
"unexpected type"); |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3075 |
continue; // Skip dead path with different type |
1 | 3076 |
} |
3077 |
} |
|
3078 |
} else { |
|
4470
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3079 |
debug_only(n->dump();) |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3080 |
assert(false, "EA: unexpected node"); |
1 | 3081 |
continue; |
3082 |
} |
|
4470
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3083 |
// push allocation's users on appropriate worklist |
1 | 3084 |
for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) { |
3085 |
Node *use = n->fast_out(i); |
|
3086 |
if(use->is_Mem() && use->in(MemNode::Address) == n) { |
|
4470
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3087 |
// Load/store to instance's field |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3088 |
memnode_worklist.append_if_missing(use); |
4470
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3089 |
} else if (use->is_MemBar()) { |
17383 | 3090 |
if (use->in(TypeFunc::Memory) == n) { // Ignore precedent edge |
3091 |
memnode_worklist.append_if_missing(use); |
|
3092 |
} |
|
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3093 |
} else if (use->is_AddP() && use->outcnt() > 0) { // No dead nodes |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3094 |
Node* addp2 = find_second_addp(use, n); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3095 |
if (addp2 != NULL) { |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3096 |
alloc_worklist.append_if_missing(addp2); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3097 |
} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3098 |
alloc_worklist.append_if_missing(use); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3099 |
} else if (use->is_Phi() || |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3100 |
use->is_CheckCastPP() || |
13969
d2a189b83b87
7054512: Compress class pointers after perm gen removal
roland
parents:
13886
diff
changeset
|
3101 |
use->is_EncodeNarrowPtr() || |
d2a189b83b87
7054512: Compress class pointers after perm gen removal
roland
parents:
13886
diff
changeset
|
3102 |
use->is_DecodeNarrowPtr() || |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3103 |
(use->is_ConstraintCast() && use->Opcode() == Op_CastPP)) { |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3104 |
alloc_worklist.append_if_missing(use); |
4470
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3105 |
#ifdef ASSERT |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3106 |
} else if (use->is_Mem()) { |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3107 |
assert(use->in(MemNode::Address) != n, "EA: missing allocation reference path"); |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3108 |
} else if (use->is_MergeMem()) { |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3109 |
assert(_mergemem_worklist.contains(use->as_MergeMem()), "EA: missing MergeMem node in the worklist"); |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3110 |
} else if (use->is_SafePoint()) { |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3111 |
// Look for MergeMem nodes for calls which reference unique allocation |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3112 |
// (through CheckCastPP nodes) even for debug info. |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3113 |
Node* m = use->in(TypeFunc::Memory); |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3114 |
if (m->is_MergeMem()) { |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3115 |
assert(_mergemem_worklist.contains(m->as_MergeMem()), "EA: missing MergeMem node in the worklist"); |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3116 |
} |
15242
695bb216be99
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
14623
diff
changeset
|
3117 |
} else if (use->Opcode() == Op_EncodeISOArray) { |
695bb216be99
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
14623
diff
changeset
|
3118 |
if (use->in(MemNode::Memory) == n || use->in(3) == n) { |
695bb216be99
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
14623
diff
changeset
|
3119 |
// EncodeISOArray overwrites destination array |
695bb216be99
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
14623
diff
changeset
|
3120 |
memnode_worklist.append_if_missing(use); |
695bb216be99
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
14623
diff
changeset
|
3121 |
} |
4470
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3122 |
} else { |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3123 |
uint op = use->Opcode(); |
33628 | 3124 |
if ((use->in(MemNode::Memory) == n) && |
3125 |
(op == Op_StrCompressedCopy || op == Op_StrInflatedCopy)) { |
|
3126 |
// They overwrite memory edge corresponding to destination array, |
|
3127 |
memnode_worklist.append_if_missing(use); |
|
3128 |
} else if (!(op == Op_CmpP || op == Op_Conv2B || |
|
4470
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3129 |
op == Op_CastP2X || op == Op_StoreCM || |
33628 | 3130 |
op == Op_FastLock || op == Op_AryEq || op == Op_StrComp || op == Op_HasNegatives || |
3131 |
op == Op_StrCompressedCopy || op == Op_StrInflatedCopy || |
|
3132 |
op == Op_StrEquals || op == Op_StrIndexOf || op == Op_StrIndexOfChar)) { |
|
4470
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3133 |
n->dump(); |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3134 |
use->dump(); |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3135 |
assert(false, "EA: missing allocation reference path"); |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3136 |
} |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3137 |
#endif |
1 | 3138 |
} |
3139 |
} |
|
3140 |
||
3141 |
} |
|
30629
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3142 |
|
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3143 |
// Go over all ArrayCopy nodes and if one of the inputs has a unique |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3144 |
// type, record it in the ArrayCopy node so we know what memory this |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3145 |
// node uses/modified. |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3146 |
for (int next = 0; next < arraycopy_worklist.length(); next++) { |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3147 |
ArrayCopyNode* ac = arraycopy_worklist.at(next); |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3148 |
Node* dest = ac->in(ArrayCopyNode::Dest); |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3149 |
if (dest->is_AddP()) { |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3150 |
dest = get_addp_base(dest); |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3151 |
} |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3152 |
JavaObjectNode* jobj = unique_java_object(dest); |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3153 |
if (jobj != NULL) { |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3154 |
Node *base = get_map(jobj->idx()); |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3155 |
if (base != NULL) { |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3156 |
const TypeOopPtr *base_t = _igvn->type(base)->isa_oopptr(); |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3157 |
ac->_dest_type = base_t; |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3158 |
} |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3159 |
} |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3160 |
Node* src = ac->in(ArrayCopyNode::Src); |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3161 |
if (src->is_AddP()) { |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3162 |
src = get_addp_base(src); |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3163 |
} |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3164 |
jobj = unique_java_object(src); |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3165 |
if (jobj != NULL) { |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3166 |
Node* base = get_map(jobj->idx()); |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3167 |
if (base != NULL) { |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3168 |
const TypeOopPtr *base_t = _igvn->type(base)->isa_oopptr(); |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3169 |
ac->_src_type = base_t; |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3170 |
} |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3171 |
} |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3172 |
} |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3173 |
|
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3174 |
// New alias types were created in split_AddP(). |
1 | 3175 |
uint new_index_end = (uint) _compile->num_alias_types(); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3176 |
assert(unique_old == _compile->unique(), "there should be no new ideal nodes after Phase 1"); |
1 | 3177 |
|
3178 |
// Phase 2: Process MemNode's from memnode_worklist. compute new address type and |
|
3179 |
// compute new values for Memory inputs (the Memory inputs are not |
|
3180 |
// actually updated until phase 4.) |
|
3181 |
if (memnode_worklist.length() == 0) |
|
3182 |
return; // nothing to do |
|
3183 |
while (memnode_worklist.length() != 0) { |
|
3184 |
Node *n = memnode_worklist.pop(); |
|
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3185 |
if (visited.test_set(n->_idx)) |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3186 |
continue; |
4470
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3187 |
if (n->is_Phi() || n->is_ClearArray()) { |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3188 |
// we don't need to do anything, but the users must be pushed |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3189 |
} else if (n->is_MemBar()) { // Initialize, MemBar nodes |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3190 |
// we don't need to do anything, but the users must be pushed |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3191 |
n = n->as_MemBar()->proj_out(TypeFunc::Memory); |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3192 |
if (n == NULL) |
1 | 3193 |
continue; |
33628 | 3194 |
} else if (n->Opcode() == Op_StrCompressedCopy || |
3195 |
n->Opcode() == Op_EncodeISOArray) { |
|
15242
695bb216be99
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
14623
diff
changeset
|
3196 |
// get the memory projection |
28643
a665e19ca007
8066312: Add new Node* Node::find_out(int opc) method.
zmajo
parents:
27919
diff
changeset
|
3197 |
n = n->find_out_with(Op_SCMemProj); |
15242
695bb216be99
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
14623
diff
changeset
|
3198 |
assert(n->Opcode() == Op_SCMemProj, "memory projection required"); |
1 | 3199 |
} else { |
3200 |
assert(n->is_Mem(), "memory node required."); |
|
3201 |
Node *addr = n->in(MemNode::Address); |
|
3202 |
const Type *addr_t = igvn->type(addr); |
|
3203 |
if (addr_t == Type::TOP) |
|
3204 |
continue; |
|
3205 |
assert (addr_t->isa_ptr() != NULL, "pointer type required."); |
|
3206 |
int alias_idx = _compile->get_alias_index(addr_t->is_ptr()); |
|
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3207 |
assert ((uint)alias_idx < new_index_end, "wrong alias index"); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3208 |
Node *mem = find_inst_mem(n->in(MemNode::Memory), alias_idx, orig_phis); |
211
e2b60448c234
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
1
diff
changeset
|
3209 |
if (_compile->failing()) { |
e2b60448c234
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
1
diff
changeset
|
3210 |
return; |
e2b60448c234
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
1
diff
changeset
|
3211 |
} |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3212 |
if (mem != n->in(MemNode::Memory)) { |
4471
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
3213 |
// We delay the memory edge update since we need old one in |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
3214 |
// MergeMem code below when instances memory slices are separated. |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3215 |
set_map(n, mem); |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3216 |
} |
1 | 3217 |
if (n->is_Load()) { |
3218 |
continue; // don't push users |
|
3219 |
} else if (n->is_LoadStore()) { |
|
3220 |
// get the memory projection |
|
28643
a665e19ca007
8066312: Add new Node* Node::find_out(int opc) method.
zmajo
parents:
27919
diff
changeset
|
3221 |
n = n->find_out_with(Op_SCMemProj); |
1 | 3222 |
assert(n->Opcode() == Op_SCMemProj, "memory projection required"); |
3223 |
} |
|
3224 |
} |
|
3225 |
// push user on appropriate worklist |
|
3226 |
for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) { |
|
3227 |
Node *use = n->fast_out(i); |
|
4470
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3228 |
if (use->is_Phi() || use->is_ClearArray()) { |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3229 |
memnode_worklist.append_if_missing(use); |
15242
695bb216be99
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
14623
diff
changeset
|
3230 |
} else if (use->is_Mem() && use->in(MemNode::Memory) == n) { |
4470
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3231 |
if (use->Opcode() == Op_StoreCM) // Ignore cardmark stores |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3232 |
continue; |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3233 |
memnode_worklist.append_if_missing(use); |
4470
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3234 |
} else if (use->is_MemBar()) { |
17383 | 3235 |
if (use->in(TypeFunc::Memory) == n) { // Ignore precedent edge |
3236 |
memnode_worklist.append_if_missing(use); |
|
3237 |
} |
|
4470
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3238 |
#ifdef ASSERT |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3239 |
} else if(use->is_Mem()) { |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3240 |
assert(use->in(MemNode::Memory) != n, "EA: missing memory path"); |
1 | 3241 |
} else if (use->is_MergeMem()) { |
4470
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3242 |
assert(_mergemem_worklist.contains(use->as_MergeMem()), "EA: missing MergeMem node in the worklist"); |
15242
695bb216be99
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
14623
diff
changeset
|
3243 |
} else if (use->Opcode() == Op_EncodeISOArray) { |
695bb216be99
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
14623
diff
changeset
|
3244 |
if (use->in(MemNode::Memory) == n || use->in(3) == n) { |
695bb216be99
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
14623
diff
changeset
|
3245 |
// EncodeISOArray overwrites destination array |
695bb216be99
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
14623
diff
changeset
|
3246 |
memnode_worklist.append_if_missing(use); |
695bb216be99
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
14623
diff
changeset
|
3247 |
} |
4470
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3248 |
} else { |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3249 |
uint op = use->Opcode(); |
33628 | 3250 |
if ((use->in(MemNode::Memory) == n) && |
3251 |
(op == Op_StrCompressedCopy || op == Op_StrInflatedCopy)) { |
|
3252 |
// They overwrite memory edge corresponding to destination array, |
|
3253 |
memnode_worklist.append_if_missing(use); |
|
3254 |
} else if (!(op == Op_StoreCM || |
|
4470
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3255 |
(op == Op_CallLeaf && use->as_CallLeaf()->_name != NULL && |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3256 |
strcmp(use->as_CallLeaf()->_name, "g1_wb_pre") == 0) || |
33628 | 3257 |
op == Op_AryEq || op == Op_StrComp || op == Op_HasNegatives || |
3258 |
op == Op_StrCompressedCopy || op == Op_StrInflatedCopy || |
|
3259 |
op == Op_StrEquals || op == Op_StrIndexOf || op == Op_StrIndexOfChar)) { |
|
4470
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3260 |
n->dump(); |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3261 |
use->dump(); |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3262 |
assert(false, "EA: missing memory path"); |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3263 |
} |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3264 |
#endif |
1 | 3265 |
} |
3266 |
} |
|
3267 |
} |
|
3268 |
||
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3269 |
// Phase 3: Process MergeMem nodes from mergemem_worklist. |
4470
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3270 |
// Walk each memory slice moving the first node encountered of each |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3271 |
// instance type to the the input corresponding to its alias index. |
4470
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3272 |
uint length = _mergemem_worklist.length(); |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3273 |
for( uint next = 0; next < length; ++next ) { |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3274 |
MergeMemNode* nmm = _mergemem_worklist.at(next); |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3275 |
assert(!visited.test_set(nmm->_idx), "should not be visited before"); |
1 | 3276 |
// Note: we don't want to use MergeMemStream here because we only want to |
4470
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3277 |
// scan inputs which exist at the start, not ones we add during processing. |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3278 |
// Note 2: MergeMem may already contains instance memory slices added |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3279 |
// during find_inst_mem() call when memory nodes were processed above. |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3280 |
igvn->hash_delete(nmm); |
32579
268acc7bc111
8134031: Incorrect JIT compilation of complex code with inlining and escape analysis
roland
parents:
31866
diff
changeset
|
3281 |
uint nslices = MIN2(nmm->req(), new_index_start); |
1 | 3282 |
for (uint i = Compile::AliasIdxRaw+1; i < nslices; i++) { |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3283 |
Node* mem = nmm->in(i); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3284 |
Node* cur = NULL; |
1 | 3285 |
if (mem == NULL || mem->is_top()) |
3286 |
continue; |
|
4471
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
3287 |
// First, update mergemem by moving memory nodes to corresponding slices |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
3288 |
// if their type became more precise since this mergemem was created. |
1 | 3289 |
while (mem->is_Mem()) { |
3290 |
const Type *at = igvn->type(mem->in(MemNode::Address)); |
|
3291 |
if (at != Type::TOP) { |
|
3292 |
assert (at->isa_ptr() != NULL, "pointer type required."); |
|
3293 |
uint idx = (uint)_compile->get_alias_index(at->is_ptr()); |
|
3294 |
if (idx == i) { |
|
3295 |
if (cur == NULL) |
|
3296 |
cur = mem; |
|
3297 |
} else { |
|
3298 |
if (idx >= nmm->req() || nmm->is_empty_memory(nmm->in(idx))) { |
|
3299 |
nmm->set_memory_at(idx, mem); |
|
3300 |
} |
|
3301 |
} |
|
3302 |
} |
|
3303 |
mem = mem->in(MemNode::Memory); |
|
3304 |
} |
|
3305 |
nmm->set_memory_at(i, (cur != NULL) ? cur : mem); |
|
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3306 |
// Find any instance of the current type if we haven't encountered |
4471
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
3307 |
// already a memory slice of the instance along the memory chain. |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3308 |
for (uint ni = new_index_start; ni < new_index_end; ni++) { |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3309 |
if((uint)_compile->get_general_index(ni) == i) { |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3310 |
Node *m = (ni >= nmm->req()) ? nmm->empty_memory() : nmm->in(ni); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3311 |
if (nmm->is_empty_memory(m)) { |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3312 |
Node* result = find_inst_mem(mem, ni, orig_phis); |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3313 |
if (_compile->failing()) { |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3314 |
return; |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3315 |
} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3316 |
nmm->set_memory_at(ni, result); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3317 |
} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3318 |
} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3319 |
} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3320 |
} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3321 |
// Find the rest of instances values |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3322 |
for (uint ni = new_index_start; ni < new_index_end; ni++) { |
4471
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
3323 |
const TypeOopPtr *tinst = _compile->get_adr_type(ni)->isa_oopptr(); |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3324 |
Node* result = step_through_mergemem(nmm, ni, tinst); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3325 |
if (result == nmm->base_memory()) { |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3326 |
// Didn't find instance memory, search through general slice recursively. |
4471
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
3327 |
result = nmm->memory_at(_compile->get_general_index(ni)); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3328 |
result = find_inst_mem(result, ni, orig_phis); |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3329 |
if (_compile->failing()) { |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3330 |
return; |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3331 |
} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3332 |
nmm->set_memory_at(ni, result); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3333 |
} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3334 |
} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3335 |
igvn->hash_insert(nmm); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3336 |
record_for_optimizer(nmm); |
1 | 3337 |
} |
3338 |
||
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3339 |
// Phase 4: Update the inputs of non-instance memory Phis and |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3340 |
// the Memory input of memnodes |
1 | 3341 |
// First update the inputs of any non-instance Phi's from |
3342 |
// which we split out an instance Phi. Note we don't have |
|
3343 |
// to recursively process Phi's encounted on the input memory |
|
3344 |
// chains as is done in split_memory_phi() since they will |
|
3345 |
// also be processed here. |
|
955 | 3346 |
for (int j = 0; j < orig_phis.length(); j++) { |
3347 |
PhiNode *phi = orig_phis.at(j); |
|
1 | 3348 |
int alias_idx = _compile->get_alias_index(phi->adr_type()); |
3349 |
igvn->hash_delete(phi); |
|
3350 |
for (uint i = 1; i < phi->req(); i++) { |
|
3351 |
Node *mem = phi->in(i); |
|
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3352 |
Node *new_mem = find_inst_mem(mem, alias_idx, orig_phis); |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3353 |
if (_compile->failing()) { |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3354 |
return; |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3355 |
} |
1 | 3356 |
if (mem != new_mem) { |
3357 |
phi->set_req(i, new_mem); |
|
3358 |
} |
|
3359 |
} |
|
3360 |
igvn->hash_insert(phi); |
|
3361 |
record_for_optimizer(phi); |
|
3362 |
} |
|
3363 |
||
3364 |
// Update the memory inputs of MemNodes with the value we computed |
|
4471
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
3365 |
// in Phase 2 and move stores memory users to corresponding memory slices. |
9327
23532ae85295
7026700: regression in 6u24-rev-b23: Crash in C2 compiler in PhaseIdealLoop::build_loop_late_post
kvn
parents:
9115
diff
changeset
|
3366 |
// Disable memory split verification code until the fix for 6984348. |
23532ae85295
7026700: regression in 6u24-rev-b23: Crash in C2 compiler in PhaseIdealLoop::build_loop_late_post
kvn
parents:
9115
diff
changeset
|
3367 |
// Currently it produces false negative results since it does not cover all cases. |
23532ae85295
7026700: regression in 6u24-rev-b23: Crash in C2 compiler in PhaseIdealLoop::build_loop_late_post
kvn
parents:
9115
diff
changeset
|
3368 |
#if 0 // ifdef ASSERT |
8319 | 3369 |
visited.Reset(); |
4471
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
3370 |
Node_Stack old_mems(arena, _compile->unique() >> 2); |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
3371 |
#endif |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3372 |
for (uint i = 0; i < ideal_nodes.size(); i++) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3373 |
Node* n = ideal_nodes.at(i); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3374 |
Node* nmem = get_map(n->_idx); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3375 |
assert(nmem != NULL, "sanity"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3376 |
if (n->is_Mem()) { |
9327
23532ae85295
7026700: regression in 6u24-rev-b23: Crash in C2 compiler in PhaseIdealLoop::build_loop_late_post
kvn
parents:
9115
diff
changeset
|
3377 |
#if 0 // ifdef ASSERT |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3378 |
Node* old_mem = n->in(MemNode::Memory); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3379 |
if (!visited.test_set(old_mem->_idx)) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3380 |
old_mems.push(old_mem, old_mem->outcnt()); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3381 |
} |
4471
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
3382 |
#endif |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3383 |
assert(n->in(MemNode::Memory) != nmem, "sanity"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3384 |
if (!n->is_Load()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3385 |
// Move memory users of a store first. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3386 |
move_inst_mem(n, orig_phis); |
1 | 3387 |
} |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3388 |
// Now update memory input |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3389 |
igvn->hash_delete(n); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3390 |
n->set_req(MemNode::Memory, nmem); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3391 |
igvn->hash_insert(n); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3392 |
record_for_optimizer(n); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3393 |
} else { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3394 |
assert(n->is_Allocate() || n->is_CheckCastPP() || |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3395 |
n->is_AddP() || n->is_Phi(), "unknown node used for set_map()"); |
1 | 3396 |
} |
3397 |
} |
|
9327
23532ae85295
7026700: regression in 6u24-rev-b23: Crash in C2 compiler in PhaseIdealLoop::build_loop_late_post
kvn
parents:
9115
diff
changeset
|
3398 |
#if 0 // ifdef ASSERT |
4471
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
3399 |
// Verify that memory was split correctly |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
3400 |
while (old_mems.is_nonempty()) { |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
3401 |
Node* old_mem = old_mems.node(); |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
3402 |
uint old_cnt = old_mems.index(); |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
3403 |
old_mems.pop(); |
9327
23532ae85295
7026700: regression in 6u24-rev-b23: Crash in C2 compiler in PhaseIdealLoop::build_loop_late_post
kvn
parents:
9115
diff
changeset
|
3404 |
assert(old_cnt == old_mem->outcnt(), "old mem could be lost"); |
4471
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
3405 |
} |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
3406 |
#endif |
1 | 3407 |
} |
3408 |
||
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3409 |
#ifndef PRODUCT |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3410 |
static const char *node_type_names[] = { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3411 |
"UnknownType", |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3412 |
"JavaObject", |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3413 |
"LocalVar", |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3414 |
"Field", |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3415 |
"Arraycopy" |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3416 |
}; |
11781
f99a70966575
7129284: +DoEscapeAnalysis regression w/ early build of 7u4 (HotSpot 23) on Linux
kvn
parents:
11445
diff
changeset
|
3417 |
|
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3418 |
static const char *esc_names[] = { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3419 |
"UnknownEscape", |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3420 |
"NoEscape", |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3421 |
"ArgEscape", |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3422 |
"GlobalEscape" |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3423 |
}; |
1 | 3424 |
|
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3425 |
void PointsToNode::dump(bool print_state) const { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3426 |
NodeType nt = node_type(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3427 |
tty->print("%s ", node_type_names[(int) nt]); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3428 |
if (print_state) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3429 |
EscapeState es = escape_state(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3430 |
EscapeState fields_es = fields_escape_state(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3431 |
tty->print("%s(%s) ", esc_names[(int)es], esc_names[(int)fields_es]); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3432 |
if (nt == PointsToNode::JavaObject && !this->scalar_replaceable()) |
14395
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
3433 |
tty->print("NSR "); |
11189 | 3434 |
} |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3435 |
if (is_Field()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3436 |
FieldNode* f = (FieldNode*)this; |
14395
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
3437 |
if (f->is_oop()) |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
3438 |
tty->print("oop "); |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
3439 |
if (f->offset() > 0) |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
3440 |
tty->print("+%d ", f->offset()); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3441 |
tty->print("("); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3442 |
for (BaseIterator i(f); i.has_next(); i.next()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3443 |
PointsToNode* b = i.get(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3444 |
tty->print(" %d%s", b->idx(),(b->is_JavaObject() ? "P" : "")); |
11431
5ca3a19e559a
7121140: Allocation paths require explicit memory synchronization operations for RMO systems
roland
parents:
11198
diff
changeset
|
3445 |
} |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3446 |
tty->print(" )"); |
1 | 3447 |
} |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3448 |
tty->print("["); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3449 |
for (EdgeIterator i(this); i.has_next(); i.next()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3450 |
PointsToNode* e = i.get(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3451 |
tty->print(" %d%s%s", e->idx(),(e->is_JavaObject() ? "P" : (e->is_Field() ? "F" : "")), e->is_Arraycopy() ? "cp" : ""); |
4470
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3452 |
} |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3453 |
tty->print(" ["); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3454 |
for (UseIterator i(this); i.has_next(); i.next()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3455 |
PointsToNode* u = i.get(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3456 |
bool is_base = false; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3457 |
if (PointsToNode::is_base_use(u)) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3458 |
is_base = true; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3459 |
u = PointsToNode::get_use_node(u)->as_Field(); |
10982
85bcf8ef9cc8
7059047: EA: can't find initializing store with several CheckCastPP
kvn
parents:
10970
diff
changeset
|
3460 |
} |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3461 |
tty->print(" %d%s%s", u->idx(), is_base ? "b" : "", u->is_Arraycopy() ? "cp" : ""); |
11189 | 3462 |
} |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3463 |
tty->print(" ]] "); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3464 |
if (_node == NULL) |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3465 |
tty->print_cr("<null>"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3466 |
else |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3467 |
_node->dump(); |
11189 | 3468 |
} |
3469 |
||
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3470 |
void ConnectionGraph::dump(GrowableArray<PointsToNode*>& ptnodes_worklist) { |
1 | 3471 |
bool first = true; |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3472 |
int ptnodes_length = ptnodes_worklist.length(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3473 |
for (int i = 0; i < ptnodes_length; i++) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3474 |
PointsToNode *ptn = ptnodes_worklist.at(i); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3475 |
if (ptn == NULL || !ptn->is_JavaObject()) |
1 | 3476 |
continue; |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3477 |
PointsToNode::EscapeState es = ptn->escape_state(); |
17383 | 3478 |
if ((es != PointsToNode::NoEscape) && !Verbose) { |
3479 |
continue; |
|
3480 |
} |
|
3481 |
Node* n = ptn->ideal_node(); |
|
3482 |
if (n->is_Allocate() || (n->is_CallStaticJava() && |
|
3483 |
n->as_CallStaticJava()->is_boxing_method())) { |
|
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3484 |
if (first) { |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3485 |
tty->cr(); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3486 |
tty->print("======== Connection graph for "); |
952
38812d18eec0
6684714: Optimize EA Connection Graph build performance
kvn
parents:
769
diff
changeset
|
3487 |
_compile->method()->print_short_name(); |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3488 |
tty->cr(); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3489 |
first = false; |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3490 |
} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3491 |
ptn->dump(); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3492 |
// Print all locals and fields which reference this allocation |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3493 |
for (UseIterator j(ptn); j.has_next(); j.next()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3494 |
PointsToNode* use = j.get(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3495 |
if (use->is_LocalVar()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3496 |
use->dump(Verbose); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3497 |
} else if (Verbose) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3498 |
use->dump(); |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3499 |
} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3500 |
} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3501 |
tty->cr(); |
1 | 3502 |
} |
3503 |
} |
|
3504 |
} |
|
3505 |
#endif |