author | roland |
Thu, 07 Feb 2019 09:55:57 +0100 | |
changeset 53706 | b5b373bda814 |
parent 53288 | f0490430ef7a |
child 53875 | 7a6fb8a48434 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
48595
5d699d81c10c
8194988: 8 Null pointer dereference defect groups related to MultiNode::proj_out()
dlong
parents:
47216
diff
changeset
|
2 |
* Copyright (c) 2005, 2018, 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" |
52568 | 28 |
#include "gc/shared/barrierSet.hpp" |
50180 | 29 |
#include "gc/shared/c2/barrierSetC2.hpp" |
7397 | 30 |
#include "libadt/vectset.hpp" |
31 |
#include "memory/allocation.hpp" |
|
37248 | 32 |
#include "memory/resourceArea.hpp" |
7397 | 33 |
#include "opto/c2compiler.hpp" |
30629
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
34 |
#include "opto/arraycopynode.hpp" |
7397 | 35 |
#include "opto/callnode.hpp" |
36 |
#include "opto/cfgnode.hpp" |
|
37 |
#include "opto/compile.hpp" |
|
38 |
#include "opto/escape.hpp" |
|
39 |
#include "opto/phaseX.hpp" |
|
23528 | 40 |
#include "opto/movenode.hpp" |
7397 | 41 |
#include "opto/rootnode.hpp" |
50525
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
50180
diff
changeset
|
42 |
#include "utilities/macros.hpp" |
1 | 43 |
|
5914
8363e7e6915a
6966411: escape.cpp:450 assert(base->Opcode() == Op_ConP
kvn
parents:
5547
diff
changeset
|
44 |
ConnectionGraph::ConnectionGraph(Compile * C, PhaseIterGVN *igvn) : |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
45 |
_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
|
46 |
_in_worklist(C->comp_arena()), |
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
47 |
_next_pidx(0), |
952
38812d18eec0
6684714: Optimize EA Connection Graph build performance
kvn
parents:
769
diff
changeset
|
48 |
_collecting(true), |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
49 |
_verify(false), |
952
38812d18eec0
6684714: Optimize EA Connection Graph build performance
kvn
parents:
769
diff
changeset
|
50 |
_compile(C), |
5914
8363e7e6915a
6966411: escape.cpp:450 assert(base->Opcode() == Op_ConP
kvn
parents:
5547
diff
changeset
|
51 |
_igvn(igvn), |
952
38812d18eec0
6684714: Optimize EA Connection Graph build performance
kvn
parents:
769
diff
changeset
|
52 |
_node_map(C->comp_arena()) { |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
53 |
// Add unknown java object. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
54 |
add_java_object(C->top(), PointsToNode::GlobalEscape); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
55 |
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
|
56 |
// 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
|
57 |
Node* oop_null = igvn->zerocon(T_OBJECT); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
58 |
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
|
59 |
add_java_object(oop_null, PointsToNode::NoEscape); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
60 |
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
|
61 |
if (UseCompressedOops) { |
7fb3b13d4205
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
955
diff
changeset
|
62 |
Node* noop_null = igvn->zerocon(T_NARROWOOP); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
63 |
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
|
64 |
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
|
65 |
} |
11189 | 66 |
_pcmp_neq = NULL; // Should be initialized |
67 |
_pcmp_eq = NULL; |
|
1 | 68 |
} |
69 |
||
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
70 |
bool ConnectionGraph::has_candidates(Compile *C) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
71 |
// 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
|
72 |
// are represented by ideal Macro nodes. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
73 |
int cnt = C->macro_count(); |
17383 | 74 |
for (int i = 0; i < cnt; i++) { |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
75 |
Node *n = C->macro_node(i); |
17383 | 76 |
if (n->is_Allocate()) |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
77 |
return true; |
17383 | 78 |
if (n->is_Lock()) { |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
79 |
Node* obj = n->as_Lock()->obj_node()->uncast(); |
17383 | 80 |
if (!(obj->is_Parm() || obj->is_Con())) |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
81 |
return true; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
82 |
} |
17383 | 83 |
if (n->is_CallStaticJava() && |
84 |
n->as_CallStaticJava()->is_boxing_method()) { |
|
85 |
return true; |
|
86 |
} |
|
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
87 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
88 |
return false; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
89 |
} |
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 |
void ConnectionGraph::do_analysis(Compile *C, PhaseIterGVN *igvn) { |
26913 | 92 |
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
|
93 |
ResourceMark rm; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
94 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
95 |
// 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
|
96 |
// to create space for them in ConnectionGraph::_nodes[]. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
97 |
Node* oop_null = igvn->zerocon(T_OBJECT); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
98 |
Node* noop_null = igvn->zerocon(T_NARROWOOP); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
99 |
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
|
100 |
// Perform escape analysis |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
101 |
if (congraph->compute_escape()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
102 |
// There are non escaping objects. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
103 |
C->set_congraph(congraph); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
104 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
105 |
// Cleanup. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
106 |
if (oop_null->outcnt() == 0) |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
107 |
igvn->hash_delete(oop_null); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
108 |
if (noop_null->outcnt() == 0) |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
109 |
igvn->hash_delete(noop_null); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
110 |
} |
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 |
bool ConnectionGraph::compute_escape() { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
113 |
Compile* C = _compile; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
114 |
PhaseGVN* igvn = _igvn; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
115 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
116 |
// Worklists used by EA. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
117 |
Unique_Node_List delayed_worklist; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
118 |
GrowableArray<Node*> alloc_worklist; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
119 |
GrowableArray<Node*> ptr_cmp_worklist; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
120 |
GrowableArray<Node*> storestore_worklist; |
30629
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
121 |
GrowableArray<ArrayCopyNode*> arraycopy_worklist; |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
122 |
GrowableArray<PointsToNode*> ptnodes_worklist; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
123 |
GrowableArray<JavaObjectNode*> java_objects_worklist; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
124 |
GrowableArray<JavaObjectNode*> non_escaped_worklist; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
125 |
GrowableArray<FieldNode*> oop_fields_worklist; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
126 |
DEBUG_ONLY( GrowableArray<Node*> addp_worklist; ) |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
127 |
|
26913 | 128 |
{ 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
|
129 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
130 |
// 1. Populate Connection Graph (CG) with PointsTo nodes. |
17383 | 131 |
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
|
132 |
// Initialize worklist |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
133 |
if (C->root() != NULL) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
134 |
ideal_nodes.push(C->root()); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
135 |
} |
27424
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
136 |
// 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
|
137 |
// 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
|
138 |
// 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
|
139 |
// 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
|
140 |
ptnodes_worklist.append(phantom_obj); |
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
141 |
java_objects_worklist.append(phantom_obj); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
142 |
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
|
143 |
Node* n = ideal_nodes.at(next); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
144 |
// 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
|
145 |
// 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
|
146 |
add_node_to_connection_graph(n, &delayed_worklist); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
147 |
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
|
148 |
if (ptn != NULL && ptn != phantom_obj) { |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
149 |
ptnodes_worklist.append(ptn); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
150 |
if (ptn->is_JavaObject()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
151 |
java_objects_worklist.append(ptn->as_JavaObject()); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
152 |
if ((n->is_Allocate() || n->is_CallStaticJava()) && |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
153 |
(ptn->escape_state() < PointsToNode::GlobalEscape)) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
154 |
// 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
|
155 |
non_escaped_worklist.append(ptn->as_JavaObject()); |
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 |
} 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
|
158 |
oop_fields_worklist.append(ptn->as_Field()); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
159 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
160 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
161 |
if (n->is_MergeMem()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
162 |
// 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
|
163 |
// scalar replaceable objects in split_unique_types(). |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
164 |
_mergemem_worklist.append(n->as_MergeMem()); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
165 |
} else if (OptimizePtrCompare && n->is_Cmp() && |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
166 |
(n->Opcode() == Op_CmpP || n->Opcode() == Op_CmpN)) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
167 |
// Collect compare pointers nodes. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
168 |
ptr_cmp_worklist.append(n); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
169 |
} else if (n->is_MemBarStoreStore()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
170 |
// 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
|
171 |
// 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
|
172 |
// may be eliminated. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
173 |
storestore_worklist.append(n); |
17383 | 174 |
} else if (n->is_MemBar() && (n->Opcode() == Op_MemBarRelease) && |
175 |
(n->req() > MemBarNode::Precedent)) { |
|
176 |
record_for_optimizer(n); |
|
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
177 |
#ifdef ASSERT |
17383 | 178 |
} else if (n->is_AddP()) { |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
179 |
// Collect address nodes for graph verification. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
180 |
addp_worklist.append(n); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
181 |
#endif |
30629
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
182 |
} else if (n->is_ArrayCopy()) { |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
183 |
// 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
|
184 |
// escaping, we can record a unique type |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
185 |
arraycopy_worklist.append(n->as_ArrayCopy()); |
12158
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 |
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
|
188 |
Node* m = n->fast_out(i); // Get user |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
189 |
ideal_nodes.push(m); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
190 |
} |
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 |
if (non_escaped_worklist.length() == 0) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
193 |
_collecting = false; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
194 |
return false; // Nothing to do. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
195 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
196 |
// Add final simple edges to graph. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
197 |
while(delayed_worklist.size() > 0) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
198 |
Node* n = delayed_worklist.pop(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
199 |
add_final_edges(n); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
200 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
201 |
int ptnodes_length = ptnodes_worklist.length(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
202 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
203 |
#ifdef ASSERT |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
204 |
if (VerifyConnectionGraph) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
205 |
// 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
|
206 |
// local vars has edges. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
207 |
_verify = true; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
208 |
for (int next = 0; next < ptnodes_length; ++next) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
209 |
PointsToNode* ptn = ptnodes_worklist.at(next); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
210 |
add_final_edges(ptn->ideal_node()); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
211 |
if (ptn->is_LocalVar() && ptn->edge_count() == 0) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
212 |
ptn->dump(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
213 |
assert(ptn->as_LocalVar()->edge_count() > 0, "sanity"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
214 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
215 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
216 |
_verify = false; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
217 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
218 |
#endif |
28920
254044e6ad7c
8071534: assert(!failing()) failed: Must not have pending failure. Reason is: out of memory
kvn
parents:
28643
diff
changeset
|
219 |
// 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
|
220 |
// 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
|
221 |
// 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
|
222 |
// 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
|
223 |
if (C->failing()) return false; |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
224 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
225 |
// 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
|
226 |
// java objects through graph. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
227 |
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
|
228 |
java_objects_worklist, oop_fields_worklist)) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
229 |
// 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
|
230 |
_collecting = false; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
231 |
return false; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
232 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
233 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
234 |
// 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
|
235 |
// scalar replaceable allocations on alloc_worklist for processing |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
236 |
// in split_unique_types(). |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
237 |
int non_escaped_length = non_escaped_worklist.length(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
238 |
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
|
239 |
JavaObjectNode* ptn = non_escaped_worklist.at(next); |
17383 | 240 |
bool noescape = (ptn->escape_state() == PointsToNode::NoEscape); |
241 |
Node* n = ptn->ideal_node(); |
|
242 |
if (n->is_Allocate()) { |
|
243 |
n->as_Allocate()->_is_non_escaping = noescape; |
|
244 |
} |
|
245 |
if (n->is_CallStaticJava()) { |
|
246 |
n->as_CallStaticJava()->_is_non_escaping = noescape; |
|
247 |
} |
|
248 |
if (noescape && ptn->scalar_replaceable()) { |
|
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
249 |
adjust_scalar_replaceable_state(ptn); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
250 |
if (ptn->scalar_replaceable()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
251 |
alloc_worklist.append(ptn->ideal_node()); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
252 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
253 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
254 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
255 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
256 |
#ifdef ASSERT |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
257 |
if (VerifyConnectionGraph) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
258 |
// 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
|
259 |
verify_connection_graph(ptnodes_worklist, non_escaped_worklist, |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
260 |
java_objects_worklist, addp_worklist); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
261 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
262 |
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
|
263 |
assert(null_obj->escape_state() == PointsToNode::NoEscape && |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
264 |
null_obj->edge_count() == 0 && |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
265 |
!null_obj->arraycopy_src() && |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
266 |
!null_obj->arraycopy_dst(), "sanity"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
267 |
#endif |
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 |
_collecting = false; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
270 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
271 |
} // TracePhase t3("connectionGraph") |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
272 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
273 |
// 4. Optimize ideal graph based on EA information. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
274 |
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
|
275 |
if (has_non_escaping_obj) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
276 |
optimize_ideal_graph(ptr_cmp_worklist, storestore_worklist); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
277 |
} |
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 |
#ifndef PRODUCT |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
280 |
if (PrintEscapeAnalysis) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
281 |
dump(ptnodes_worklist); // Dump ConnectionGraph |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
282 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
283 |
#endif |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
284 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
285 |
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
|
286 |
#ifdef ASSERT |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
287 |
if (VerifyConnectionGraph) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
288 |
int alloc_length = alloc_worklist.length(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
289 |
for (int next = 0; next < alloc_length; ++next) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
290 |
Node* n = alloc_worklist.at(next); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
291 |
PointsToNode* ptn = ptnode_adr(n->_idx); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
292 |
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
|
293 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
294 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
295 |
#endif |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
296 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
297 |
// 5. Separate memory graph for scalar replaceable allcations. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
298 |
if (has_scalar_replaceable_candidates && |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
299 |
C->AliasLevel() >= 3 && EliminateAllocations) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
300 |
// 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
|
301 |
// scalar replaceable objects. |
30629
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
302 |
split_unique_types(alloc_worklist, arraycopy_worklist); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
303 |
if (C->failing()) return false; |
18025 | 304 |
C->print_method(PHASE_AFTER_EA, 2); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
305 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
306 |
#ifdef ASSERT |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
307 |
} else if (Verbose && (PrintEscapeAnalysis || PrintEliminateAllocations)) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
308 |
tty->print("=== No allocations eliminated for "); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
309 |
C->method()->print_short_name(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
310 |
if(!EliminateAllocations) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
311 |
tty->print(" since EliminateAllocations is off ==="); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
312 |
} else if(!has_scalar_replaceable_candidates) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
313 |
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
|
314 |
} else if(C->AliasLevel() < 3) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
315 |
tty->print(" since AliasLevel < 3 ==="); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
316 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
317 |
tty->cr(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
318 |
#endif |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
319 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
320 |
return has_non_escaping_obj; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
321 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
322 |
|
13886
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13393
diff
changeset
|
323 |
// Utility function for nodes that load an object |
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13393
diff
changeset
|
324 |
void ConnectionGraph::add_objload_to_connection_graph(Node *n, Unique_Node_List *delayed_worklist) { |
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13393
diff
changeset
|
325 |
// Using isa_ptr() instead of isa_oopptr() for LoadP and Phi because |
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13393
diff
changeset
|
326 |
// ThreadLocal has RawPtr type. |
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13393
diff
changeset
|
327 |
const Type* t = _igvn->type(n); |
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13393
diff
changeset
|
328 |
if (t->make_ptr() != NULL) { |
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13393
diff
changeset
|
329 |
Node* adr = n->in(MemNode::Address); |
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13393
diff
changeset
|
330 |
#ifdef ASSERT |
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13393
diff
changeset
|
331 |
if (!adr->is_AddP()) { |
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13393
diff
changeset
|
332 |
assert(_igvn->type(adr)->isa_rawptr(), "sanity"); |
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13393
diff
changeset
|
333 |
} else { |
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13393
diff
changeset
|
334 |
assert((ptnode_adr(adr->_idx) == NULL || |
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13393
diff
changeset
|
335 |
ptnode_adr(adr->_idx)->as_Field()->is_oop()), "sanity"); |
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13393
diff
changeset
|
336 |
} |
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13393
diff
changeset
|
337 |
#endif |
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13393
diff
changeset
|
338 |
add_local_var_and_edge(n, PointsToNode::NoEscape, |
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13393
diff
changeset
|
339 |
adr, delayed_worklist); |
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13393
diff
changeset
|
340 |
} |
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13393
diff
changeset
|
341 |
} |
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13393
diff
changeset
|
342 |
|
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
343 |
// 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
|
344 |
// connection graph edges. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
345 |
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
|
346 |
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
|
347 |
PhaseGVN* igvn = _igvn; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
348 |
uint n_idx = n->_idx; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
349 |
PointsToNode* n_ptn = ptnode_adr(n_idx); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
350 |
if (n_ptn != NULL) |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
351 |
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
|
352 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
353 |
if (n->is_Call()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
354 |
// Arguments to allocation and locking don't escape. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
355 |
if (n->is_AbstractLock()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
356 |
// 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
|
357 |
// 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
|
358 |
record_for_optimizer(n); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
359 |
} else if (n->is_Allocate()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
360 |
add_call_node(n->as_Call()); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
361 |
record_for_optimizer(n); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
362 |
} else { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
363 |
if (n->is_CallStaticJava()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
364 |
const char* name = n->as_CallStaticJava()->_name; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
365 |
if (name != NULL && strcmp(name, "uncommon_trap") == 0) |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
366 |
return; // Skip uncommon traps |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
367 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
368 |
// 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
|
369 |
delayed_worklist->push(n); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
370 |
// Check if a call returns an object. |
17383 | 371 |
if ((n->as_Call()->returns_pointer() && |
48595
5d699d81c10c
8194988: 8 Null pointer dereference defect groups related to MultiNode::proj_out()
dlong
parents:
47216
diff
changeset
|
372 |
n->as_Call()->proj_out_or_null(TypeFunc::Parms) != NULL) || |
17383 | 373 |
(n->is_CallStaticJava() && |
374 |
n->as_CallStaticJava()->is_boxing_method())) { |
|
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
375 |
add_call_node(n->as_Call()); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
376 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
377 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
378 |
return; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
379 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
380 |
// 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
|
381 |
// point to phantom_obj. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
382 |
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
|
383 |
return; // Skip predefined nodes. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
384 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
385 |
int opcode = n->Opcode(); |
52568 | 386 |
bool gc_handled = BarrierSet::barrier_set()->barrier_set_c2()->escape_add_to_con_graph(this, igvn, delayed_worklist, n, opcode); |
387 |
if (gc_handled) { |
|
388 |
return; // Ignore node if already handled by GC. |
|
389 |
} |
|
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
390 |
switch (opcode) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
391 |
case Op_AddP: { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
392 |
Node* base = get_addp_base(n); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
393 |
PointsToNode* ptn_base = ptnode_adr(base->_idx); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
394 |
// 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
|
395 |
// adjust_scalar_replaceable_state() and split_unique_types(). |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
396 |
// 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
|
397 |
// 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
|
398 |
int offset = address_offset(n, igvn); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
399 |
add_field(n, PointsToNode::NoEscape, offset); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
400 |
if (ptn_base == NULL) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
401 |
delayed_worklist->push(n); // Process it later. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
402 |
} else { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
403 |
n_ptn = ptnode_adr(n_idx); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
404 |
add_base(n_ptn->as_Field(), ptn_base); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
405 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
406 |
break; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
407 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
408 |
case Op_CastX2P: { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
409 |
map_ideal_node(n, phantom_obj); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
410 |
break; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
411 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
412 |
case Op_CastPP: |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
413 |
case Op_CheckCastPP: |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
414 |
case Op_EncodeP: |
13969
d2a189b83b87
7054512: Compress class pointers after perm gen removal
roland
parents:
13886
diff
changeset
|
415 |
case Op_DecodeN: |
d2a189b83b87
7054512: Compress class pointers after perm gen removal
roland
parents:
13886
diff
changeset
|
416 |
case Op_EncodePKlass: |
d2a189b83b87
7054512: Compress class pointers after perm gen removal
roland
parents:
13886
diff
changeset
|
417 |
case Op_DecodeNKlass: { |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
418 |
add_local_var_and_edge(n, PointsToNode::NoEscape, |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
419 |
n->in(1), delayed_worklist); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
420 |
break; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
421 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
422 |
case Op_CMoveP: { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
423 |
add_local_var(n, PointsToNode::NoEscape); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
424 |
// 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
|
425 |
// not defined yet. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
426 |
delayed_worklist->push(n); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
427 |
break; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
428 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
429 |
case Op_ConP: |
13969
d2a189b83b87
7054512: Compress class pointers after perm gen removal
roland
parents:
13886
diff
changeset
|
430 |
case Op_ConN: |
d2a189b83b87
7054512: Compress class pointers after perm gen removal
roland
parents:
13886
diff
changeset
|
431 |
case Op_ConNKlass: { |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
432 |
// 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
|
433 |
PointsToNode::EscapeState es; |
17383 | 434 |
const Type* t = igvn->type(n); |
435 |
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
|
436 |
es = PointsToNode::NoEscape; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
437 |
} else { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
438 |
es = PointsToNode::GlobalEscape; |
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 |
add_java_object(n, es); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
441 |
break; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
442 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
443 |
case Op_CreateEx: { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
444 |
// 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
|
445 |
map_ideal_node(n, phantom_obj); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
446 |
break; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
447 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
448 |
case Op_LoadKlass: |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
449 |
case Op_LoadNKlass: { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
450 |
// Unknown class is loaded |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
451 |
map_ideal_node(n, phantom_obj); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
452 |
break; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
453 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
454 |
case Op_LoadP: |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
455 |
case Op_LoadN: |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
456 |
case Op_LoadPLocked: { |
13886
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13393
diff
changeset
|
457 |
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
|
458 |
break; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
459 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
460 |
case Op_Parm: { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
461 |
map_ideal_node(n, phantom_obj); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
462 |
break; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
463 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
464 |
case Op_PartialSubtypeCheck: { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
465 |
// 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
|
466 |
// phantom_obj could be used. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
467 |
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
|
468 |
break; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
469 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
470 |
case Op_Phi: { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
471 |
// Using isa_ptr() instead of isa_oopptr() for LoadP and Phi because |
13886
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13393
diff
changeset
|
472 |
// ThreadLocal has RawPtr type. |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
473 |
const Type* t = n->as_Phi()->type(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
474 |
if (t->make_ptr() != NULL) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
475 |
add_local_var(n, PointsToNode::NoEscape); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
476 |
// 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
|
477 |
// not defined yet. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
478 |
delayed_worklist->push(n); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
479 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
480 |
break; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
481 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
482 |
case Op_Proj: { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
483 |
// 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
|
484 |
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
|
485 |
n->in(0)->as_Call()->returns_pointer()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
486 |
add_local_var_and_edge(n, PointsToNode::NoEscape, |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
487 |
n->in(0), delayed_worklist); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
488 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
489 |
break; |
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 |
case Op_Rethrow: // Exception object escapes |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
492 |
case Op_Return: { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
493 |
if (n->req() > TypeFunc::Parms && |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
494 |
igvn->type(n->in(TypeFunc::Parms))->isa_oopptr()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
495 |
// 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
|
496 |
add_local_var_and_edge(n, PointsToNode::GlobalEscape, |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
497 |
n->in(TypeFunc::Parms), delayed_worklist); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
498 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
499 |
break; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
500 |
} |
36316
7a83de7aabca
8148146: Integrate new internal Unsafe entry points, and basic intrinsic support for VarHandles
shade
parents:
35567
diff
changeset
|
501 |
case Op_CompareAndExchangeP: |
7a83de7aabca
8148146: Integrate new internal Unsafe entry points, and basic intrinsic support for VarHandles
shade
parents:
35567
diff
changeset
|
502 |
case Op_CompareAndExchangeN: |
13886
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13393
diff
changeset
|
503 |
case Op_GetAndSetP: |
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13393
diff
changeset
|
504 |
case Op_GetAndSetN: { |
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13393
diff
changeset
|
505 |
add_objload_to_connection_graph(n, delayed_worklist); |
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13393
diff
changeset
|
506 |
// fallthrough |
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13393
diff
changeset
|
507 |
} |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
508 |
case Op_StoreP: |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
509 |
case Op_StoreN: |
13969
d2a189b83b87
7054512: Compress class pointers after perm gen removal
roland
parents:
13886
diff
changeset
|
510 |
case Op_StoreNKlass: |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
511 |
case Op_StorePConditional: |
36316
7a83de7aabca
8148146: Integrate new internal Unsafe entry points, and basic intrinsic support for VarHandles
shade
parents:
35567
diff
changeset
|
512 |
case Op_WeakCompareAndSwapP: |
7a83de7aabca
8148146: Integrate new internal Unsafe entry points, and basic intrinsic support for VarHandles
shade
parents:
35567
diff
changeset
|
513 |
case Op_WeakCompareAndSwapN: |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
514 |
case Op_CompareAndSwapP: |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
515 |
case Op_CompareAndSwapN: { |
52568 | 516 |
add_to_congraph_unsafe_access(n, opcode, delayed_worklist); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
517 |
break; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
518 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
519 |
case Op_AryEq: |
33628 | 520 |
case Op_HasNegatives: |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
521 |
case Op_StrComp: |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
522 |
case Op_StrEquals: |
15242
695bb216be99
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
14623
diff
changeset
|
523 |
case Op_StrIndexOf: |
33628 | 524 |
case Op_StrIndexOfChar: |
525 |
case Op_StrInflatedCopy: |
|
526 |
case Op_StrCompressedCopy: |
|
15242
695bb216be99
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
14623
diff
changeset
|
527 |
case Op_EncodeISOArray: { |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
528 |
add_local_var(n, PointsToNode::ArgEscape); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
529 |
delayed_worklist->push(n); // Process it later. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
530 |
break; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
531 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
532 |
case Op_ThreadLocal: { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
533 |
add_java_object(n, PointsToNode::ArgEscape); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
534 |
break; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
535 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
536 |
default: |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
537 |
; // Do nothing for nodes not related to EA. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
538 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
539 |
return; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
540 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
541 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
542 |
#ifdef ASSERT |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
543 |
#define ELSE_FAIL(name) \ |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
544 |
/* Should not be called for not pointer type. */ \ |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
545 |
n->dump(1); \ |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
546 |
assert(false, name); \ |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
547 |
break; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
548 |
#else |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
549 |
#define ELSE_FAIL(name) \ |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
550 |
break; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
551 |
#endif |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
552 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
553 |
// Add final simple edges to graph. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
554 |
void ConnectionGraph::add_final_edges(Node *n) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
555 |
PointsToNode* n_ptn = ptnode_adr(n->_idx); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
556 |
#ifdef ASSERT |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
557 |
if (_verify && n_ptn->is_JavaObject()) |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
558 |
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
|
559 |
#endif |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
560 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
561 |
if (n->is_Call()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
562 |
process_call_arguments(n->as_Call()); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
563 |
return; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
564 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
565 |
assert(n->is_Store() || n->is_LoadStore() || |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
566 |
(n_ptn != NULL) && (n_ptn->ideal_node() != NULL), |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
567 |
"node should be registered already"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
568 |
int opcode = n->Opcode(); |
52568 | 569 |
bool gc_handled = BarrierSet::barrier_set()->barrier_set_c2()->escape_add_final_edges(this, _igvn, n, opcode); |
570 |
if (gc_handled) { |
|
571 |
return; // Ignore node if already handled by GC. |
|
572 |
} |
|
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
573 |
switch (opcode) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
574 |
case Op_AddP: { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
575 |
Node* base = get_addp_base(n); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
576 |
PointsToNode* ptn_base = ptnode_adr(base->_idx); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
577 |
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
|
578 |
add_base(n_ptn->as_Field(), ptn_base); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
579 |
break; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
580 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
581 |
case Op_CastPP: |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
582 |
case Op_CheckCastPP: |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
583 |
case Op_EncodeP: |
13969
d2a189b83b87
7054512: Compress class pointers after perm gen removal
roland
parents:
13886
diff
changeset
|
584 |
case Op_DecodeN: |
d2a189b83b87
7054512: Compress class pointers after perm gen removal
roland
parents:
13886
diff
changeset
|
585 |
case Op_EncodePKlass: |
d2a189b83b87
7054512: Compress class pointers after perm gen removal
roland
parents:
13886
diff
changeset
|
586 |
case Op_DecodeNKlass: { |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
587 |
add_local_var_and_edge(n, PointsToNode::NoEscape, |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
588 |
n->in(1), NULL); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
589 |
break; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
590 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
591 |
case Op_CMoveP: { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
592 |
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
|
593 |
Node* in = n->in(i); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
594 |
if (in == NULL) |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
595 |
continue; // ignore NULL |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
596 |
Node* uncast_in = in->uncast(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
597 |
if (uncast_in->is_top() || uncast_in == n) |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
598 |
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
|
599 |
PointsToNode* ptn = ptnode_adr(in->_idx); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
600 |
assert(ptn != NULL, "node should be registered"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
601 |
add_edge(n_ptn, ptn); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
602 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
603 |
break; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
604 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
605 |
case Op_LoadP: |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
606 |
case Op_LoadN: |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
607 |
case Op_LoadPLocked: { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
608 |
// Using isa_ptr() instead of isa_oopptr() for LoadP and Phi because |
13886
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13393
diff
changeset
|
609 |
// ThreadLocal has RawPtr type. |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
610 |
const Type* t = _igvn->type(n); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
611 |
if (t->make_ptr() != NULL) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
612 |
Node* adr = n->in(MemNode::Address); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
613 |
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
|
614 |
break; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
615 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
616 |
ELSE_FAIL("Op_LoadP"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
617 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
618 |
case Op_Phi: { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
619 |
// Using isa_ptr() instead of isa_oopptr() for LoadP and Phi because |
13886
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13393
diff
changeset
|
620 |
// ThreadLocal has RawPtr type. |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
621 |
const Type* t = n->as_Phi()->type(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
622 |
if (t->make_ptr() != NULL) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
623 |
for (uint i = 1; i < n->req(); i++) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
624 |
Node* in = n->in(i); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
625 |
if (in == NULL) |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
626 |
continue; // ignore NULL |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
627 |
Node* uncast_in = in->uncast(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
628 |
if (uncast_in->is_top() || uncast_in == n) |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
629 |
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
|
630 |
PointsToNode* ptn = ptnode_adr(in->_idx); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
631 |
assert(ptn != NULL, "node should be registered"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
632 |
add_edge(n_ptn, ptn); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
633 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
634 |
break; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
635 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
636 |
ELSE_FAIL("Op_Phi"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
637 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
638 |
case Op_Proj: { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
639 |
// 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
|
640 |
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
|
641 |
n->in(0)->as_Call()->returns_pointer()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
642 |
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
|
643 |
break; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
644 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
645 |
ELSE_FAIL("Op_Proj"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
646 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
647 |
case Op_Rethrow: // Exception object escapes |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
648 |
case Op_Return: { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
649 |
if (n->req() > TypeFunc::Parms && |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
650 |
_igvn->type(n->in(TypeFunc::Parms))->isa_oopptr()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
651 |
// 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
|
652 |
add_local_var_and_edge(n, PointsToNode::GlobalEscape, |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
653 |
n->in(TypeFunc::Parms), NULL); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
654 |
break; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
655 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
656 |
ELSE_FAIL("Op_Return"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
657 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
658 |
case Op_StoreP: |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
659 |
case Op_StoreN: |
13969
d2a189b83b87
7054512: Compress class pointers after perm gen removal
roland
parents:
13886
diff
changeset
|
660 |
case Op_StoreNKlass: |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
661 |
case Op_StorePConditional: |
36316
7a83de7aabca
8148146: Integrate new internal Unsafe entry points, and basic intrinsic support for VarHandles
shade
parents:
35567
diff
changeset
|
662 |
case Op_CompareAndExchangeP: |
7a83de7aabca
8148146: Integrate new internal Unsafe entry points, and basic intrinsic support for VarHandles
shade
parents:
35567
diff
changeset
|
663 |
case Op_CompareAndExchangeN: |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
664 |
case Op_CompareAndSwapP: |
13886
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13393
diff
changeset
|
665 |
case Op_CompareAndSwapN: |
36316
7a83de7aabca
8148146: Integrate new internal Unsafe entry points, and basic intrinsic support for VarHandles
shade
parents:
35567
diff
changeset
|
666 |
case Op_WeakCompareAndSwapP: |
7a83de7aabca
8148146: Integrate new internal Unsafe entry points, and basic intrinsic support for VarHandles
shade
parents:
35567
diff
changeset
|
667 |
case Op_WeakCompareAndSwapN: |
13886
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13393
diff
changeset
|
668 |
case Op_GetAndSetP: |
8d82c4dfa722
7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
roland
parents:
13393
diff
changeset
|
669 |
case Op_GetAndSetN: { |
52568 | 670 |
if (add_final_edges_unsafe_access(n, opcode)) { |
12164
5fa74ba174b7
7154997: assert(false) failed: not G1 barrier raw StoreP
kvn
parents:
12158
diff
changeset
|
671 |
break; |
12158
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 |
ELSE_FAIL("Op_StoreP"); |
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 |
case Op_AryEq: |
33628 | 676 |
case Op_HasNegatives: |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
677 |
case Op_StrComp: |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
678 |
case Op_StrEquals: |
15242
695bb216be99
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
14623
diff
changeset
|
679 |
case Op_StrIndexOf: |
33628 | 680 |
case Op_StrIndexOfChar: |
681 |
case Op_StrInflatedCopy: |
|
682 |
case Op_StrCompressedCopy: |
|
15242
695bb216be99
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
14623
diff
changeset
|
683 |
case Op_EncodeISOArray: { |
33628 | 684 |
// 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
|
685 |
// 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
|
686 |
// 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
|
687 |
for (uint i = 2; i < n->req(); i++) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
688 |
Node* adr = n->in(i); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
689 |
const Type* at = _igvn->type(adr); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
690 |
if (!adr->is_top() && at->isa_ptr()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
691 |
assert(at == Type::TOP || at == TypePtr::NULL_PTR || |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
692 |
at->isa_ptr() != NULL, "expecting a pointer"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
693 |
if (adr->is_AddP()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
694 |
adr = get_addp_base(adr); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
695 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
696 |
PointsToNode* ptn = ptnode_adr(adr->_idx); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
697 |
assert(ptn != NULL, "node should be registered"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
698 |
add_edge(n_ptn, ptn); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
699 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
700 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
701 |
break; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
702 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
703 |
default: { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
704 |
// 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
|
705 |
// miss some edges when they were created. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
706 |
#ifdef ASSERT |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
707 |
n->dump(1); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
708 |
#endif |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
709 |
guarantee(false, "unknown node"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
710 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
711 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
712 |
return; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
713 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
714 |
|
52568 | 715 |
void ConnectionGraph::add_to_congraph_unsafe_access(Node* n, uint opcode, Unique_Node_List* delayed_worklist) { |
716 |
Node* adr = n->in(MemNode::Address); |
|
717 |
const Type* adr_type = _igvn->type(adr); |
|
718 |
adr_type = adr_type->make_ptr(); |
|
719 |
if (adr_type == NULL) { |
|
720 |
return; // skip dead nodes |
|
721 |
} |
|
722 |
if (adr_type->isa_oopptr() |
|
723 |
|| ((opcode == Op_StoreP || opcode == Op_StoreN || opcode == Op_StoreNKlass) |
|
724 |
&& adr_type == TypeRawPtr::NOTNULL |
|
725 |
&& adr->in(AddPNode::Address)->is_Proj() |
|
726 |
&& adr->in(AddPNode::Address)->in(0)->is_Allocate())) { |
|
727 |
delayed_worklist->push(n); // Process it later. |
|
728 |
#ifdef ASSERT |
|
729 |
assert (adr->is_AddP(), "expecting an AddP"); |
|
730 |
if (adr_type == TypeRawPtr::NOTNULL) { |
|
731 |
// Verify a raw address for a store captured by Initialize node. |
|
732 |
int offs = (int) _igvn->find_intptr_t_con(adr->in(AddPNode::Offset), Type::OffsetBot); |
|
733 |
assert(offs != Type::OffsetBot, "offset must be a constant"); |
|
734 |
} |
|
735 |
#endif |
|
736 |
} else { |
|
737 |
// Ignore copy the displaced header to the BoxNode (OSR compilation). |
|
738 |
if (adr->is_BoxLock()) { |
|
739 |
return; |
|
740 |
} |
|
741 |
// Stored value escapes in unsafe access. |
|
742 |
if ((opcode == Op_StoreP) && adr_type->isa_rawptr()) { |
|
743 |
delayed_worklist->push(n); // Process unsafe access later. |
|
744 |
return; |
|
745 |
} |
|
746 |
#ifdef ASSERT |
|
747 |
n->dump(1); |
|
748 |
assert(false, "not unsafe"); |
|
749 |
#endif |
|
750 |
} |
|
751 |
} |
|
752 |
||
753 |
bool ConnectionGraph::add_final_edges_unsafe_access(Node* n, uint opcode) { |
|
754 |
Node* adr = n->in(MemNode::Address); |
|
755 |
const Type *adr_type = _igvn->type(adr); |
|
756 |
adr_type = adr_type->make_ptr(); |
|
757 |
#ifdef ASSERT |
|
758 |
if (adr_type == NULL) { |
|
759 |
n->dump(1); |
|
760 |
assert(adr_type != NULL, "dead node should not be on list"); |
|
761 |
return true; |
|
762 |
} |
|
763 |
#endif |
|
764 |
||
765 |
if (opcode == Op_GetAndSetP || opcode == Op_GetAndSetN || |
|
766 |
opcode == Op_CompareAndExchangeN || opcode == Op_CompareAndExchangeP) { |
|
767 |
add_local_var_and_edge(n, PointsToNode::NoEscape, adr, NULL); |
|
768 |
} |
|
769 |
||
770 |
if (adr_type->isa_oopptr() |
|
771 |
|| ((opcode == Op_StoreP || opcode == Op_StoreN || opcode == Op_StoreNKlass) |
|
772 |
&& adr_type == TypeRawPtr::NOTNULL |
|
773 |
&& adr->in(AddPNode::Address)->is_Proj() |
|
774 |
&& adr->in(AddPNode::Address)->in(0)->is_Allocate())) { |
|
775 |
// Point Address to Value |
|
776 |
PointsToNode* adr_ptn = ptnode_adr(adr->_idx); |
|
777 |
assert(adr_ptn != NULL && |
|
778 |
adr_ptn->as_Field()->is_oop(), "node should be registered"); |
|
779 |
Node* val = n->in(MemNode::ValueIn); |
|
780 |
PointsToNode* ptn = ptnode_adr(val->_idx); |
|
781 |
assert(ptn != NULL, "node should be registered"); |
|
782 |
add_edge(adr_ptn, ptn); |
|
783 |
return true; |
|
784 |
} else if ((opcode == Op_StoreP) && adr_type->isa_rawptr()) { |
|
785 |
// Stored value escapes in unsafe access. |
|
786 |
Node* val = n->in(MemNode::ValueIn); |
|
787 |
PointsToNode* ptn = ptnode_adr(val->_idx); |
|
788 |
assert(ptn != NULL, "node should be registered"); |
|
789 |
set_escape_state(ptn, PointsToNode::GlobalEscape); |
|
790 |
// Add edge to object for unsafe access with offset. |
|
791 |
PointsToNode* adr_ptn = ptnode_adr(adr->_idx); |
|
792 |
assert(adr_ptn != NULL, "node should be registered"); |
|
793 |
if (adr_ptn->is_Field()) { |
|
794 |
assert(adr_ptn->as_Field()->is_oop(), "should be oop field"); |
|
795 |
add_edge(adr_ptn, ptn); |
|
796 |
} |
|
797 |
return true; |
|
798 |
} |
|
799 |
return false; |
|
800 |
} |
|
801 |
||
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
802 |
void ConnectionGraph::add_call_node(CallNode* call) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
803 |
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
|
804 |
uint call_idx = call->_idx; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
805 |
if (call->is_Allocate()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
806 |
Node* k = call->in(AllocateNode::KlassNode); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
807 |
const TypeKlassPtr* kt = k->bottom_type()->isa_klassptr(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
808 |
assert(kt != NULL, "TypeKlassPtr required."); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
809 |
ciKlass* cik = kt->klass(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
810 |
PointsToNode::EscapeState es = PointsToNode::NoEscape; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
811 |
bool scalar_replaceable = true; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
812 |
if (call->is_AllocateArray()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
813 |
if (!cik->is_array_klass()) { // StressReflectiveCode |
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 |
} else { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
816 |
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
|
817 |
if (length < 0 || length > EliminateAllocationArraySizeLimit) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
818 |
// 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
|
819 |
scalar_replaceable = false; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
820 |
} |
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 { // Allocate instance |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
823 |
if (cik->is_subclass_of(_compile->env()->Thread_klass()) || |
20698 | 824 |
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
|
825 |
!cik->is_instance_klass() || // StressReflectiveCode |
35567
4b293ebd9ef9
8140001: _allocateInstance intrinsic does not throw InstantiationException for abstract classes and interfaces
vlivanov
parents:
35154
diff
changeset
|
826 |
!cik->as_instance_klass()->can_be_instantiated() || |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
827 |
cik->as_instance_klass()->has_finalizer()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
828 |
es = PointsToNode::GlobalEscape; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
829 |
} |
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 |
add_java_object(call, es); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
832 |
PointsToNode* ptn = ptnode_adr(call_idx); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
833 |
if (!scalar_replaceable && ptn->scalar_replaceable()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
834 |
ptn->set_scalar_replaceable(false); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
835 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
836 |
} else if (call->is_CallStaticJava()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
837 |
// Call nodes could be different types: |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
838 |
// |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
839 |
// 1. CallDynamicJavaNode (what happened during call is unknown): |
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 |
// - 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
|
842 |
// |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
843 |
// - all oop arguments are escaping globally; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
844 |
// |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
845 |
// 2. CallStaticJavaNode (execute bytecode analysis if possible): |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
846 |
// |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
847 |
// - 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
|
848 |
// |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
849 |
// - 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
|
850 |
// - 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
|
851 |
// during call is returned; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
852 |
// - 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
|
853 |
// 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
|
854 |
// |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
855 |
// - 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
|
856 |
// |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
857 |
// 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
|
858 |
// 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
|
859 |
ciMethod* meth = call->as_CallJava()->method(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
860 |
if (meth == NULL) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
861 |
const char* name = call->as_CallStaticJava()->_name; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
862 |
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
|
863 |
// Returns a newly allocated unescaped object. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
864 |
add_java_object(call, PointsToNode::NoEscape); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
865 |
ptnode_adr(call_idx)->set_scalar_replaceable(false); |
17383 | 866 |
} else if (meth->is_boxing_method()) { |
867 |
// Returns boxing object |
|
17386
e3b1a1af9968
8014286: failed java/lang/Math/DivModTests.java after 6934604 changes
kvn
parents:
17384
diff
changeset
|
868 |
PointsToNode::EscapeState es; |
e3b1a1af9968
8014286: failed java/lang/Math/DivModTests.java after 6934604 changes
kvn
parents:
17384
diff
changeset
|
869 |
vmIntrinsics::ID intr = meth->intrinsic_id(); |
e3b1a1af9968
8014286: failed java/lang/Math/DivModTests.java after 6934604 changes
kvn
parents:
17384
diff
changeset
|
870 |
if (intr == vmIntrinsics::_floatValue || intr == vmIntrinsics::_doubleValue) { |
e3b1a1af9968
8014286: failed java/lang/Math/DivModTests.java after 6934604 changes
kvn
parents:
17384
diff
changeset
|
871 |
// 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
|
872 |
es = PointsToNode::NoEscape; |
e3b1a1af9968
8014286: failed java/lang/Math/DivModTests.java after 6934604 changes
kvn
parents:
17384
diff
changeset
|
873 |
} else { |
e3b1a1af9968
8014286: failed java/lang/Math/DivModTests.java after 6934604 changes
kvn
parents:
17384
diff
changeset
|
874 |
// 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
|
875 |
es = PointsToNode::GlobalEscape; |
e3b1a1af9968
8014286: failed java/lang/Math/DivModTests.java after 6934604 changes
kvn
parents:
17384
diff
changeset
|
876 |
} |
e3b1a1af9968
8014286: failed java/lang/Math/DivModTests.java after 6934604 changes
kvn
parents:
17384
diff
changeset
|
877 |
add_java_object(call, es); |
11198
34c860ff41e3
7112478: after 7105605 JRuby bench_define_method_methods.rb fails with NPE
kvn
parents:
11191
diff
changeset
|
878 |
} else { |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
879 |
BCEscapeAnalyzer* call_analyzer = meth->get_bcea(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
880 |
call_analyzer->copy_dependencies(_compile->dependencies()); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
881 |
if (call_analyzer->is_return_allocated()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
882 |
// Returns a newly allocated unescaped object, simply |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
883 |
// update dependency information. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
884 |
// 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
|
885 |
// 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
|
886 |
add_java_object(call, PointsToNode::NoEscape); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
887 |
ptnode_adr(call_idx)->set_scalar_replaceable(false); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
888 |
} else { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
889 |
// Determine whether any arguments are returned. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
890 |
const TypeTuple* d = call->tf()->domain(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
891 |
bool ret_arg = false; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
892 |
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
|
893 |
if (d->field_at(i)->isa_ptr() != NULL && |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
894 |
call_analyzer->is_arg_returned(i - TypeFunc::Parms)) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
895 |
ret_arg = true; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
896 |
break; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
897 |
} |
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 |
if (ret_arg) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
900 |
add_local_var(call, PointsToNode::ArgEscape); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
901 |
} else { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
902 |
// Returns unknown object. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
903 |
map_ideal_node(call, phantom_obj); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
904 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
905 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
906 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
907 |
} else { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
908 |
// 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
|
909 |
// returned value is unknown and globally escapes. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
910 |
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
|
911 |
map_ideal_node(call, phantom_obj); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
912 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
913 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
914 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
915 |
void ConnectionGraph::process_call_arguments(CallNode *call) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
916 |
bool is_arraycopy = false; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
917 |
switch (call->Opcode()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
918 |
#ifdef ASSERT |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
919 |
case Op_Allocate: |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
920 |
case Op_AllocateArray: |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
921 |
case Op_Lock: |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
922 |
case Op_Unlock: |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
923 |
assert(false, "should be done already"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
924 |
break; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
925 |
#endif |
27142
31444af8b365
8058746: escape analysis special case code for array copy broken by 7173584
roland
parents:
26917
diff
changeset
|
926 |
case Op_ArrayCopy: |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
927 |
case Op_CallLeafNoFP: |
27142
31444af8b365
8058746: escape analysis special case code for array copy broken by 7173584
roland
parents:
26917
diff
changeset
|
928 |
// 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
|
929 |
// 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
|
930 |
// PhaseStringOpts::copy_string()) |
31444af8b365
8058746: escape analysis special case code for array copy broken by 7173584
roland
parents:
26917
diff
changeset
|
931 |
is_arraycopy = (call->Opcode() == Op_ArrayCopy) || |
30629
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
932 |
call->as_CallLeaf()->is_call_to_arraycopystub(); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
933 |
// fall through |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
934 |
case Op_CallLeaf: { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
935 |
// 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
|
936 |
// Adjust escape state for outgoing arguments. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
937 |
const TypeTuple * d = call->tf()->domain(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
938 |
bool src_has_oops = false; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
939 |
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
|
940 |
const Type* at = d->field_at(i); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
941 |
Node *arg = call->in(i); |
27142
31444af8b365
8058746: escape analysis special case code for array copy broken by 7173584
roland
parents:
26917
diff
changeset
|
942 |
if (arg == NULL) { |
31444af8b365
8058746: escape analysis special case code for array copy broken by 7173584
roland
parents:
26917
diff
changeset
|
943 |
continue; |
31444af8b365
8058746: escape analysis special case code for array copy broken by 7173584
roland
parents:
26917
diff
changeset
|
944 |
} |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
945 |
const Type *aat = _igvn->type(arg); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
946 |
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
|
947 |
continue; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
948 |
if (arg->is_AddP()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
949 |
// |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
950 |
// 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
|
951 |
// after the allocation before Initialize and CheckCastPP nodes. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
952 |
// Or normal arraycopy for object arrays case. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
953 |
// |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
954 |
// 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
|
955 |
// 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
|
956 |
// |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
957 |
arg = get_addp_base(arg); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
958 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
959 |
PointsToNode* arg_ptn = ptnode_adr(arg->_idx); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
960 |
assert(arg_ptn != NULL, "should be registered"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
961 |
PointsToNode::EscapeState arg_esc = arg_ptn->escape_state(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
962 |
if (is_arraycopy || arg_esc < PointsToNode::ArgEscape) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
963 |
assert(aat == Type::TOP || aat == TypePtr::NULL_PTR || |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
964 |
aat->isa_ptr() != NULL, "expecting an Ptr"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
965 |
bool arg_has_oops = aat->isa_oopptr() && |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
966 |
(aat->isa_oopptr()->klass() == NULL || aat->isa_instptr() || |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
967 |
(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
|
968 |
if (i == TypeFunc::Parms) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
969 |
src_has_oops = arg_has_oops; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
970 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
971 |
// |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
972 |
// 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
|
973 |
// |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
974 |
// arraycopy(char[],0,Object*,0,size); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
975 |
// arraycopy(Object*,0,char[],0,size); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
976 |
// |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
977 |
// Don't add edges in such cases. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
978 |
// |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
979 |
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
|
980 |
arg_has_oops && (i > TypeFunc::Parms); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
981 |
#ifdef ASSERT |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
982 |
if (!(is_arraycopy || |
50180 | 983 |
BarrierSet::barrier_set()->barrier_set_c2()->is_gc_barrier_node(call) || |
14132 | 984 |
(call->as_CallLeaf()->_name != NULL && |
50180 | 985 |
(strcmp(call->as_CallLeaf()->_name, "updateBytesCRC32") == 0 || |
31515 | 986 |
strcmp(call->as_CallLeaf()->_name, "updateBytesCRC32C") == 0 || |
32581 | 987 |
strcmp(call->as_CallLeaf()->_name, "updateBytesAdler32") == 0 || |
14132 | 988 |
strcmp(call->as_CallLeaf()->_name, "aescrypt_encryptBlock") == 0 || |
989 |
strcmp(call->as_CallLeaf()->_name, "aescrypt_decryptBlock") == 0 || |
|
990 |
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
|
991 |
strcmp(call->as_CallLeaf()->_name, "cipherBlockChaining_decryptAESCrypt") == 0 || |
35154 | 992 |
strcmp(call->as_CallLeaf()->_name, "counterMode_AESCrypt") == 0 || |
31404
63e8fcd70bfc
8073108: Use x86 and SPARC CPU instructions for GHASH acceleration
ascarpino
parents:
31129
diff
changeset
|
993 |
strcmp(call->as_CallLeaf()->_name, "ghash_processBlocks") == 0 || |
50860
480a96a43b62
8205528: Base64 encoding algorithm using AVX512 instructions
kvn
parents:
50525
diff
changeset
|
994 |
strcmp(call->as_CallLeaf()->_name, "encodeBlock") == 0 || |
24953
9680119572be
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
24021
diff
changeset
|
995 |
strcmp(call->as_CallLeaf()->_name, "sha1_implCompress") == 0 || |
9680119572be
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
24021
diff
changeset
|
996 |
strcmp(call->as_CallLeaf()->_name, "sha1_implCompressMB") == 0 || |
9680119572be
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
24021
diff
changeset
|
997 |
strcmp(call->as_CallLeaf()->_name, "sha256_implCompress") == 0 || |
9680119572be
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
24021
diff
changeset
|
998 |
strcmp(call->as_CallLeaf()->_name, "sha256_implCompressMB") == 0 || |
9680119572be
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
24021
diff
changeset
|
999 |
strcmp(call->as_CallLeaf()->_name, "sha512_implCompress") == 0 || |
26434
09ad55e5f486
8055494: Add C2 x86 intrinsic for BigInteger::multiplyToLen() method
kvn
parents:
25930
diff
changeset
|
1000 |
strcmp(call->as_CallLeaf()->_name, "sha512_implCompressMB") == 0 || |
31129
02ee7609f0e1
8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents:
30629
diff
changeset
|
1001 |
strcmp(call->as_CallLeaf()->_name, "multiplyToLen") == 0 || |
02ee7609f0e1
8081778: Use Intel x64 CPU instructions for RSA acceleration
kvn
parents:
30629
diff
changeset
|
1002 |
strcmp(call->as_CallLeaf()->_name, "squareToLen") == 0 || |
31583
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1003 |
strcmp(call->as_CallLeaf()->_name, "mulAdd") == 0 || |
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1004 |
strcmp(call->as_CallLeaf()->_name, "montgomery_multiply") == 0 || |
35110
f19bcdf40799
8143355: Update for addition of vectorizedMismatch intrinsic for x86
kvn
parents:
34148
diff
changeset
|
1005 |
strcmp(call->as_CallLeaf()->_name, "montgomery_square") == 0 || |
f19bcdf40799
8143355: Update for addition of vectorizedMismatch intrinsic for x86
kvn
parents:
34148
diff
changeset
|
1006 |
strcmp(call->as_CallLeaf()->_name, "vectorizedMismatch") == 0) |
31583
eb5bea7b4835
8130150: Implement BigInteger.montgomeryMultiply intrinsic
aph
parents:
31129
diff
changeset
|
1007 |
))) { |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1008 |
call->dump(); |
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32581
diff
changeset
|
1009 |
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
|
1010 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1011 |
#endif |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1012 |
// Always process arraycopy's destination object since |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1013 |
// 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
|
1014 |
// source object. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1015 |
if (arg_esc >= PointsToNode::ArgEscape && |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1016 |
!arg_is_arraycopy_dest) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1017 |
continue; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1018 |
} |
30629
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
1019 |
PointsToNode::EscapeState es = PointsToNode::ArgEscape; |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
1020 |
if (call->is_ArrayCopy()) { |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
1021 |
ArrayCopyNode* ac = call->as_ArrayCopy(); |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
1022 |
if (ac->is_clonebasic() || |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
1023 |
ac->is_arraycopy_validated() || |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
1024 |
ac->is_copyof_validated() || |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
1025 |
ac->is_copyofrange_validated()) { |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
1026 |
es = PointsToNode::NoEscape; |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
1027 |
} |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
1028 |
} |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
1029 |
set_escape_state(arg_ptn, es); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1030 |
if (arg_is_arraycopy_dest) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1031 |
Node* src = call->in(TypeFunc::Parms); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1032 |
if (src->is_AddP()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1033 |
src = get_addp_base(src); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1034 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1035 |
PointsToNode* src_ptn = ptnode_adr(src->_idx); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1036 |
assert(src_ptn != NULL, "should be registered"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1037 |
if (arg_ptn != src_ptn) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1038 |
// Special arraycopy edge: |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1039 |
// 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
|
1040 |
// 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
|
1041 |
// 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
|
1042 |
// escape state of fields in source object. |
30629
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
1043 |
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
|
1044 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1045 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1046 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1047 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1048 |
break; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1049 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1050 |
case Op_CallStaticJava: { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1051 |
// 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
|
1052 |
// 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
|
1053 |
#ifdef ASSERT |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1054 |
const char* name = call->as_CallStaticJava()->_name; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1055 |
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
|
1056 |
#endif |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1057 |
ciMethod* meth = call->as_CallJava()->method(); |
17383 | 1058 |
if ((meth != NULL) && meth->is_boxing_method()) { |
1059 |
break; // Boxing methods do not modify any oops. |
|
1060 |
} |
|
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1061 |
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
|
1062 |
// 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
|
1063 |
if (call_analyzer != NULL) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1064 |
PointsToNode* call_ptn = ptnode_adr(call->_idx); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1065 |
const TypeTuple* d = call->tf()->domain(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1066 |
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
|
1067 |
const Type* at = d->field_at(i); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1068 |
int k = i - TypeFunc::Parms; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1069 |
Node* arg = call->in(i); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1070 |
PointsToNode* arg_ptn = ptnode_adr(arg->_idx); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1071 |
if (at->isa_ptr() != NULL && |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1072 |
call_analyzer->is_arg_returned(k)) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1073 |
// The call returns arguments. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1074 |
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
|
1075 |
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
|
1076 |
assert(arg_ptn != NULL, "node should be registered"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1077 |
add_edge(call_ptn, arg_ptn); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1078 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1079 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1080 |
if (at->isa_oopptr() != NULL && |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1081 |
arg_ptn->escape_state() < PointsToNode::GlobalEscape) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1082 |
if (!call_analyzer->is_arg_stack(k)) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1083 |
// The argument global escapes |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1084 |
set_escape_state(arg_ptn, PointsToNode::GlobalEscape); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1085 |
} else { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1086 |
set_escape_state(arg_ptn, PointsToNode::ArgEscape); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1087 |
if (!call_analyzer->is_arg_local(k)) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1088 |
// 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
|
1089 |
set_fields_escape_state(arg_ptn, PointsToNode::GlobalEscape); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1090 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1091 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1092 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1093 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1094 |
if (call_ptn != NULL && call_ptn->is_LocalVar()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1095 |
// The call returns arguments. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1096 |
assert(call_ptn->edge_count() > 0, "sanity"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1097 |
if (!call_analyzer->is_return_local()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1098 |
// Returns also unknown object. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1099 |
add_edge(call_ptn, phantom_obj); |
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 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1102 |
break; |
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 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1105 |
default: { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1106 |
// 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
|
1107 |
// 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
|
1108 |
// globally escape. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1109 |
const TypeTuple* d = call->tf()->domain(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1110 |
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
|
1111 |
const Type* at = d->field_at(i); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1112 |
if (at->isa_oopptr() != NULL) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1113 |
Node* arg = call->in(i); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1114 |
if (arg->is_AddP()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1115 |
arg = get_addp_base(arg); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1116 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1117 |
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
|
1118 |
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
|
1119 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1120 |
} |
11198
34c860ff41e3
7112478: after 7105605 JRuby bench_define_method_methods.rb fails with NPE
kvn
parents:
11191
diff
changeset
|
1121 |
} |
34c860ff41e3
7112478: after 7105605 JRuby bench_define_method_methods.rb fails with NPE
kvn
parents:
11191
diff
changeset
|
1122 |
} |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1123 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1124 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1125 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1126 |
// Finish Graph construction. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1127 |
bool ConnectionGraph::complete_connection_graph( |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1128 |
GrowableArray<PointsToNode*>& ptnodes_worklist, |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1129 |
GrowableArray<JavaObjectNode*>& non_escaped_worklist, |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1130 |
GrowableArray<JavaObjectNode*>& java_objects_worklist, |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1131 |
GrowableArray<FieldNode*>& oop_fields_worklist) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1132 |
// 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
|
1133 |
// 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
|
1134 |
// 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
|
1135 |
// bailout Escape Analysis. |
27424
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1136 |
// 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
|
1137 |
#define CG_BUILD_ITER_LIMIT 20 |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1138 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1139 |
// 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
|
1140 |
// 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
|
1141 |
// Field nodes which reference phantom_object. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1142 |
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
|
1143 |
return false; // Nothing to do. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1144 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1145 |
// Now propagate references to all JavaObject nodes. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1146 |
int java_objects_length = java_objects_worklist.length(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1147 |
elapsedTimer time; |
27424
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1148 |
bool timeout = false; |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1149 |
int new_edges = 1; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1150 |
int iterations = 0; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1151 |
do { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1152 |
while ((new_edges > 0) && |
27424
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1153 |
(iterations++ < CG_BUILD_ITER_LIMIT)) { |
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1154 |
double start_time = time.seconds(); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1155 |
time.start(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1156 |
new_edges = 0; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1157 |
// 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
|
1158 |
// 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
|
1159 |
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
|
1160 |
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
|
1161 |
JavaObjectNode* ptn = java_objects_worklist.at(next); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1162 |
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
|
1163 |
|
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1164 |
#define SAMPLE_SIZE 4 |
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1165 |
if ((next % SAMPLE_SIZE) == 0) { |
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1166 |
// 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
|
1167 |
// to complete graph construction. |
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1168 |
time.stop(); |
27919
f1c3cf5737dc
8066199: C2 escape analysis prevents VM from exiting quickly
kvn
parents:
27707
diff
changeset
|
1169 |
// Poll for requests from shutdown mechanism to quiesce compiler |
f1c3cf5737dc
8066199: C2 escape analysis prevents VM from exiting quickly
kvn
parents:
27707
diff
changeset
|
1170 |
// because Connection graph construction may take long time. |
f1c3cf5737dc
8066199: C2 escape analysis prevents VM from exiting quickly
kvn
parents:
27707
diff
changeset
|
1171 |
CompileBroker::maybe_block(); |
27424
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1172 |
double stop_time = time.seconds(); |
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1173 |
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
|
1174 |
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
|
1175 |
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
|
1176 |
timeout = true; |
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1177 |
break; // Timeout |
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1178 |
} |
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1179 |
start_time = stop_time; |
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1180 |
time.start(); |
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1181 |
} |
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1182 |
#undef SAMPLE_SIZE |
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1183 |
|
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1184 |
} |
27424
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1185 |
if (timeout) break; |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1186 |
if (new_edges > 0) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1187 |
// 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
|
1188 |
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
|
1189 |
return false; // Nothing to do. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1190 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1191 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1192 |
time.stop(); |
27424
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1193 |
if (time.seconds() >= EscapeAnalysisTimeout) { |
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1194 |
timeout = true; |
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1195 |
break; |
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1196 |
} |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1197 |
} |
27424
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1198 |
if ((iterations < CG_BUILD_ITER_LIMIT) && !timeout) { |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1199 |
time.start(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1200 |
// Find fields which have unknown value. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1201 |
int fields_length = oop_fields_worklist.length(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1202 |
for (int next = 0; next < fields_length; next++) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1203 |
FieldNode* field = oop_fields_worklist.at(next); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1204 |
if (field->edge_count() == 0) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1205 |
new_edges += find_field_value(field); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1206 |
// 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
|
1207 |
// 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
|
1208 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1209 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1210 |
time.stop(); |
27424
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1211 |
if (time.seconds() >= EscapeAnalysisTimeout) { |
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1212 |
timeout = true; |
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1213 |
break; |
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1214 |
} |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1215 |
} else { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1216 |
new_edges = 0; // Bailout |
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 |
} while (new_edges > 0); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1219 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1220 |
// Bailout if passed limits. |
27424
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1221 |
if ((iterations >= CG_BUILD_ITER_LIMIT) || timeout) { |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1222 |
Compile* C = _compile; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1223 |
if (C->log() != NULL) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1224 |
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
|
1225 |
C->log()->text("%s", timeout ? "time" : "iterations"); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1226 |
C->log()->end_elem(" limit'"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1227 |
} |
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32581
diff
changeset
|
1228 |
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
|
1229 |
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
|
1230 |
// Possible infinite build_connection_graph loop, |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1231 |
// bailout (no changes to ideal graph were made). |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1232 |
return false; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1233 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1234 |
#ifdef ASSERT |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1235 |
if (Verbose && PrintEscapeAnalysis) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1236 |
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
|
1237 |
iterations, nodes_size(), ptnodes_worklist.length()); |
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 |
#endif |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1240 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1241 |
#undef CG_BUILD_ITER_LIMIT |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1242 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1243 |
// 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
|
1244 |
int non_escaped_length = non_escaped_worklist.length(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1245 |
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
|
1246 |
JavaObjectNode* ptn = non_escaped_worklist.at(next); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1247 |
PointsToNode::EscapeState es = ptn->escape_state(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1248 |
assert(es <= PointsToNode::ArgEscape, "sanity"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1249 |
if (es == PointsToNode::NoEscape) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1250 |
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
|
1251 |
// 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
|
1252 |
// 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
|
1253 |
add_java_object_edges(null_obj, false); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1254 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1255 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1256 |
Node* n = ptn->ideal_node(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1257 |
if (n->is_Allocate()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1258 |
// 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
|
1259 |
// 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
|
1260 |
// expanded no MemBarStoreStore is added. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1261 |
InitializeNode* ini = n->as_Allocate()->initialization(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1262 |
if (ini != NULL) |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1263 |
ini->set_does_not_escape(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1264 |
} |
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 |
return true; // Finished graph construction. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1267 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1268 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1269 |
// 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
|
1270 |
// 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
|
1271 |
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
|
1272 |
GrowableArray<JavaObjectNode*>& non_escaped_worklist) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1273 |
GrowableArray<PointsToNode*> escape_worklist; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1274 |
// 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
|
1275 |
int ptnodes_length = ptnodes_worklist.length(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1276 |
for (int next = 0; next < ptnodes_length; ++next) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1277 |
PointsToNode* ptn = ptnodes_worklist.at(next); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1278 |
if (ptn->escape_state() >= PointsToNode::ArgEscape || |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1279 |
ptn->fields_escape_state() >= PointsToNode::ArgEscape) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1280 |
escape_worklist.push(ptn); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1281 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1282 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1283 |
// Set escape states to referenced nodes (edges list). |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1284 |
while (escape_worklist.length() > 0) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1285 |
PointsToNode* ptn = escape_worklist.pop(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1286 |
PointsToNode::EscapeState es = ptn->escape_state(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1287 |
PointsToNode::EscapeState field_es = ptn->fields_escape_state(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1288 |
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
|
1289 |
es >= PointsToNode::ArgEscape) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1290 |
// 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
|
1291 |
if (add_edge(ptn, phantom_obj)) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1292 |
// New edge was added |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1293 |
add_field_uses_to_worklist(ptn->as_Field()); |
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 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1296 |
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
|
1297 |
PointsToNode* e = i.get(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1298 |
if (e->is_Arraycopy()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1299 |
assert(ptn->arraycopy_dst(), "sanity"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1300 |
// Propagate only fields escape state through arraycopy edge. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1301 |
if (e->fields_escape_state() < field_es) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1302 |
set_fields_escape_state(e, field_es); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1303 |
escape_worklist.push(e); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1304 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1305 |
} else if (es >= field_es) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1306 |
// 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
|
1307 |
if (e->escape_state() < es) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1308 |
set_escape_state(e, es); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1309 |
escape_worklist.push(e); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1310 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1311 |
} else { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1312 |
// Propagate field escape state. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1313 |
bool es_changed = false; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1314 |
if (e->fields_escape_state() < field_es) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1315 |
set_fields_escape_state(e, field_es); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1316 |
es_changed = true; |
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 |
if ((e->escape_state() < field_es) && |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1319 |
e->is_Field() && ptn->is_JavaObject() && |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1320 |
e->as_Field()->is_oop()) { |
30629
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
1321 |
// Change escape state of referenced fields. |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1322 |
set_escape_state(e, field_es); |
30629
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
1323 |
es_changed = true; |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1324 |
} else if (e->escape_state() < es) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1325 |
set_escape_state(e, es); |
30629
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
1326 |
es_changed = true; |
12158
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 |
if (es_changed) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1329 |
escape_worklist.push(e); |
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 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1333 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1334 |
// Remove escaped objects from non_escaped list. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1335 |
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
|
1336 |
JavaObjectNode* ptn = non_escaped_worklist.at(next); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1337 |
if (ptn->escape_state() >= PointsToNode::GlobalEscape) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1338 |
non_escaped_worklist.delete_at(next); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1339 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1340 |
if (ptn->escape_state() == PointsToNode::NoEscape) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1341 |
// 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
|
1342 |
find_init_values(ptn, phantom_obj, NULL); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1343 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1344 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1345 |
return (non_escaped_worklist.length() > 0); |
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 |
// 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
|
1349 |
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
|
1350 |
int new_edges = 0; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1351 |
if (populate_worklist) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1352 |
// Populate _worklist by uses of jobj's uses. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1353 |
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
|
1354 |
PointsToNode* use = i.get(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1355 |
if (use->is_Arraycopy()) |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1356 |
continue; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1357 |
add_uses_to_worklist(use); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1358 |
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
|
1359 |
// 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
|
1360 |
// related field nodes (same base and offset). |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1361 |
add_field_uses_to_worklist(use->as_Field()); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1362 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1363 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1364 |
} |
27424
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1365 |
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
|
1366 |
PointsToNode* use = _worklist.at(l); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1367 |
if (PointsToNode::is_base_use(use)) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1368 |
// 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
|
1369 |
use = PointsToNode::get_use_node(use)->as_Field(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1370 |
if (add_base(use->as_Field(), jobj)) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1371 |
new_edges++; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1372 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1373 |
continue; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1374 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1375 |
assert(!use->is_JavaObject(), "sanity"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1376 |
if (use->is_Arraycopy()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1377 |
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
|
1378 |
continue; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1379 |
// 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
|
1380 |
if (add_edge(use, jobj)) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1381 |
jobj->set_arraycopy_src(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1382 |
new_edges++; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1383 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1384 |
// and stop here. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1385 |
continue; |
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 |
if (!add_edge(use, jobj)) |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1388 |
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
|
1389 |
new_edges++; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1390 |
if (use->is_LocalVar()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1391 |
add_uses_to_worklist(use); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1392 |
if (use->arraycopy_dst()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1393 |
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
|
1394 |
PointsToNode* e = i.get(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1395 |
if (e->is_Arraycopy()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1396 |
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
|
1397 |
continue; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1398 |
// 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
|
1399 |
if (add_edge(jobj, e)) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1400 |
new_edges++; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1401 |
jobj->set_arraycopy_dst(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1402 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1403 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1404 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1405 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1406 |
} else { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1407 |
// Added new edge to stored in field values. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1408 |
// 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
|
1409 |
// related field nodes (same base and offset). |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1410 |
add_field_uses_to_worklist(use->as_Field()); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1411 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1412 |
} |
27424
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1413 |
_worklist.clear(); |
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
1414 |
_in_worklist.Reset(); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1415 |
return new_edges; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1416 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1417 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1418 |
// Put on worklist all related field nodes. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1419 |
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
|
1420 |
assert(field->is_oop(), "sanity"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1421 |
int offset = field->offset(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1422 |
add_uses_to_worklist(field); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1423 |
// 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
|
1424 |
// 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
|
1425 |
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
|
1426 |
PointsToNode* base = i.get(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1427 |
add_fields_to_worklist(field, base); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1428 |
// 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
|
1429 |
// 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
|
1430 |
// 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
|
1431 |
if (base->arraycopy_src()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1432 |
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
|
1433 |
PointsToNode* arycp = j.get(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1434 |
if (arycp->is_Arraycopy()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1435 |
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
|
1436 |
PointsToNode* abase = k.get(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1437 |
if (abase->arraycopy_dst() && abase != base) { |
30629
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
1438 |
// Look for the same arraycopy reference. |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1439 |
add_fields_to_worklist(field, abase); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1440 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1441 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1442 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1443 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1444 |
} |
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 |
// Put on worklist all related field nodes. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1449 |
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
|
1450 |
int offset = field->offset(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1451 |
if (base->is_LocalVar()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1452 |
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
|
1453 |
PointsToNode* f = j.get(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1454 |
if (PointsToNode::is_base_use(f)) { // Field |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1455 |
f = PointsToNode::get_use_node(f); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1456 |
if (f == field || !f->as_Field()->is_oop()) |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1457 |
continue; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1458 |
int offs = f->as_Field()->offset(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1459 |
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
|
1460 |
add_to_worklist(f); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1461 |
} |
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 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1464 |
} else { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1465 |
assert(base->is_JavaObject(), "sanity"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1466 |
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
|
1467 |
// this field's content globally escapes. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1468 |
(base != phantom_obj) && |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1469 |
// NULL object node does not have fields. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1470 |
(base != null_obj)) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1471 |
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
|
1472 |
PointsToNode* f = i.get(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1473 |
// 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
|
1474 |
// does not update value in source object field. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1475 |
if (f->is_Arraycopy()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1476 |
assert(base->arraycopy_dst(), "sanity"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1477 |
continue; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1478 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1479 |
if (f == field || !f->as_Field()->is_oop()) |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1480 |
continue; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1481 |
int offs = f->as_Field()->offset(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1482 |
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
|
1483 |
add_to_worklist(f); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1484 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1485 |
} |
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 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1489 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1490 |
// Find fields which have unknown value. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1491 |
int ConnectionGraph::find_field_value(FieldNode* field) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1492 |
// Escaped fields should have init value already. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1493 |
assert(field->escape_state() == PointsToNode::NoEscape, "sanity"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1494 |
int new_edges = 0; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1495 |
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
|
1496 |
PointsToNode* base = i.get(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1497 |
if (base->is_JavaObject()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1498 |
// 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
|
1499 |
if (base->ideal_node()->is_Allocate()) |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1500 |
return 0; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1501 |
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
|
1502 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1503 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1504 |
if (add_edge(field, phantom_obj)) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1505 |
// New edge was added |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1506 |
new_edges++; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1507 |
add_field_uses_to_worklist(field); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1508 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1509 |
return new_edges; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1510 |
} |
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 |
// Find fields initializing values for allocations. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1513 |
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
|
1514 |
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
|
1515 |
int new_edges = 0; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1516 |
Node* alloc = pta->ideal_node(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1517 |
if (init_val == phantom_obj) { |
30629
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
1518 |
// Do nothing for Allocate nodes since its fields values are |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
1519 |
// "known" unless they are initialized by arraycopy/clone. |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
1520 |
if (alloc->is_Allocate() && !pta->arraycopy_dst()) |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1521 |
return 0; |
30629
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
1522 |
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
|
1523 |
#ifdef ASSERT |
30629
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
1524 |
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
|
1525 |
const char* name = alloc->as_CallStaticJava()->_name; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1526 |
assert(strncmp(name, "_multianewarray", 15) == 0, "sanity"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1527 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1528 |
#endif |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1529 |
// 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
|
1530 |
// unknown values in fields. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1531 |
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
|
1532 |
PointsToNode* field = i.get(); |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1533 |
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
|
1534 |
if (add_edge(field, phantom_obj)) { |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1535 |
// New edge was added |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1536 |
new_edges++; |
14395
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1537 |
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
|
1538 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1539 |
} |
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 |
return new_edges; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1542 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1543 |
assert(init_val == null_obj, "sanity"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1544 |
// 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
|
1545 |
if (!alloc->is_Allocate()) |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1546 |
return 0; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1547 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1548 |
InitializeNode* ini = alloc->as_Allocate()->initialization(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1549 |
bool visited_bottom_offset = false; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1550 |
GrowableArray<int> offsets_worklist; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1551 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1552 |
// 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
|
1553 |
// 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
|
1554 |
// 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
|
1555 |
// captured by Initialize node. |
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 |
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
|
1558 |
PointsToNode* field = i.get(); // Field (AddP) |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1559 |
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
|
1560 |
continue; // Not oop field |
14395
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1561 |
int offset = field->as_Field()->offset(); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1562 |
if (offset == Type::OffsetBot) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1563 |
if (!visited_bottom_offset) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1564 |
// OffsetBot is used to reference array's element, |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1565 |
// 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
|
1566 |
// known which element is referenced. |
14395
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1567 |
if (add_edge(field, null_obj)) { |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1568 |
// New edge was added |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1569 |
new_edges++; |
14395
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1570 |
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
|
1571 |
visited_bottom_offset = true; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1572 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1573 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1574 |
} else { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1575 |
// Check only oop fields. |
14395
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1576 |
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
|
1577 |
if (adr_type->isa_rawptr()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1578 |
#ifdef ASSERT |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1579 |
// 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
|
1580 |
// 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
|
1581 |
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
|
1582 |
assert(adr_type->isa_rawptr() && base->is_Proj() && |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1583 |
(base->in(0) == alloc),"unexpected pointer type"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1584 |
#endif |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1585 |
continue; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1586 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1587 |
if (!offsets_worklist.contains(offset)) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1588 |
offsets_worklist.append(offset); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1589 |
Node* value = NULL; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1590 |
if (ini != NULL) { |
14395
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1591 |
// StoreP::memory_type() == T_ADDRESS |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1592 |
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
|
1593 |
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
|
1594 |
// 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
|
1595 |
// 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
|
1596 |
// 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
|
1597 |
if (store != NULL && store->is_Store() && |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1598 |
store->as_Store()->memory_type() == ft) { |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1599 |
value = store->in(MemNode::ValueIn); |
14395
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1600 |
#ifdef ASSERT |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1601 |
if (VerifyConnectionGraph) { |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1602 |
// 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
|
1603 |
PointsToNode* val = ptnode_adr(value->_idx); |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1604 |
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
|
1605 |
PointsToNode* missed_obj = NULL; |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1606 |
if (val->is_JavaObject()) { |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1607 |
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
|
1608 |
missed_obj = val; |
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 |
} else { |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1611 |
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
|
1612 |
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
|
1613 |
store->dump(); |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1614 |
val->dump(); |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1615 |
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
|
1616 |
} |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1617 |
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
|
1618 |
PointsToNode* obj = j.get(); |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1619 |
if (obj->is_JavaObject()) { |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1620 |
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
|
1621 |
missed_obj = obj; |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1622 |
break; |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1623 |
} |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1624 |
} |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1625 |
} |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1626 |
} |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1627 |
if (missed_obj != NULL) { |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1628 |
tty->print_cr("----------field---------------------------------"); |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1629 |
field->dump(); |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1630 |
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
|
1631 |
missed_obj->dump(); |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1632 |
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
|
1633 |
store->dump(); |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1634 |
val->dump(); |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1635 |
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
|
1636 |
} |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1637 |
} |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1638 |
#endif |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1639 |
} else { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1640 |
// There could be initializing stores which follow allocation. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1641 |
// 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
|
1642 |
// by Initialize node. |
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 |
// 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
|
1645 |
// 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
|
1646 |
// that compare pointers optimization works correctly. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1647 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1648 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1649 |
if (value == NULL) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1650 |
// 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
|
1651 |
if (add_edge(field, null_obj)) { |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1652 |
// New edge was added |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1653 |
new_edges++; |
14395
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1654 |
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
|
1655 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1656 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1657 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1658 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1659 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1660 |
return new_edges; |
1 | 1661 |
} |
1662 |
||
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1663 |
// 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
|
1664 |
void ConnectionGraph::adjust_scalar_replaceable_state(JavaObjectNode* jobj) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1665 |
// 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
|
1666 |
// 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
|
1667 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1668 |
// 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
|
1669 |
// 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
|
1670 |
// |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1671 |
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
|
1672 |
PointsToNode* use = i.get(); |
30629
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
1673 |
if (use->is_Arraycopy()) { |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
1674 |
continue; |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
1675 |
} |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1676 |
if (use->is_Field()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1677 |
FieldNode* field = use->as_Field(); |
30629
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
1678 |
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
|
1679 |
if (field->offset() == Type::OffsetBot) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1680 |
jobj->set_scalar_replaceable(false); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1681 |
return; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1682 |
} |
22213
8b6e8f6a38ab
8027388: JVM crashes with SIGSEGV (0xb) at pc=0x00000001077cbbf6
iveresov
parents:
20698
diff
changeset
|
1683 |
// 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
|
1684 |
// stored has multiple bases one of which is null. |
8b6e8f6a38ab
8027388: JVM crashes with SIGSEGV (0xb) at pc=0x00000001077cbbf6
iveresov
parents:
20698
diff
changeset
|
1685 |
if (field->base_count() > 1) { |
8b6e8f6a38ab
8027388: JVM crashes with SIGSEGV (0xb) at pc=0x00000001077cbbf6
iveresov
parents:
20698
diff
changeset
|
1686 |
for (BaseIterator i(field); i.has_next(); i.next()) { |
8b6e8f6a38ab
8027388: JVM crashes with SIGSEGV (0xb) at pc=0x00000001077cbbf6
iveresov
parents:
20698
diff
changeset
|
1687 |
PointsToNode* base = i.get(); |
8b6e8f6a38ab
8027388: JVM crashes with SIGSEGV (0xb) at pc=0x00000001077cbbf6
iveresov
parents:
20698
diff
changeset
|
1688 |
if (base == null_obj) { |
8b6e8f6a38ab
8027388: JVM crashes with SIGSEGV (0xb) at pc=0x00000001077cbbf6
iveresov
parents:
20698
diff
changeset
|
1689 |
jobj->set_scalar_replaceable(false); |
8b6e8f6a38ab
8027388: JVM crashes with SIGSEGV (0xb) at pc=0x00000001077cbbf6
iveresov
parents:
20698
diff
changeset
|
1690 |
return; |
8b6e8f6a38ab
8027388: JVM crashes with SIGSEGV (0xb) at pc=0x00000001077cbbf6
iveresov
parents:
20698
diff
changeset
|
1691 |
} |
8b6e8f6a38ab
8027388: JVM crashes with SIGSEGV (0xb) at pc=0x00000001077cbbf6
iveresov
parents:
20698
diff
changeset
|
1692 |
} |
8b6e8f6a38ab
8027388: JVM crashes with SIGSEGV (0xb) at pc=0x00000001077cbbf6
iveresov
parents:
20698
diff
changeset
|
1693 |
} |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1694 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1695 |
assert(use->is_Field() || use->is_LocalVar(), "sanity"); |
22213
8b6e8f6a38ab
8027388: JVM crashes with SIGSEGV (0xb) at pc=0x00000001077cbbf6
iveresov
parents:
20698
diff
changeset
|
1696 |
// 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
|
1697 |
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
|
1698 |
PointsToNode* ptn = j.get(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1699 |
if (ptn->is_JavaObject() && ptn != jobj) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1700 |
// Mark all objects. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1701 |
jobj->set_scalar_replaceable(false); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1702 |
ptn->set_scalar_replaceable(false); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1703 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1704 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1705 |
if (!jobj->scalar_replaceable()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1706 |
return; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1707 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1708 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1709 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1710 |
for (EdgeIterator j(jobj); j.has_next(); j.next()) { |
30629
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
1711 |
if (j.get()->is_Arraycopy()) { |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
1712 |
continue; |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
1713 |
} |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
1714 |
|
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1715 |
// 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
|
1716 |
FieldNode* field = j.get()->as_Field(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1717 |
int offset = field->as_Field()->offset(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1718 |
|
22213
8b6e8f6a38ab
8027388: JVM crashes with SIGSEGV (0xb) at pc=0x00000001077cbbf6
iveresov
parents:
20698
diff
changeset
|
1719 |
// 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
|
1720 |
// offset (array's element is accessed in loop). |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1721 |
if (offset == Type::OffsetBot) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1722 |
jobj->set_scalar_replaceable(false); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1723 |
return; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1724 |
} |
22213
8b6e8f6a38ab
8027388: JVM crashes with SIGSEGV (0xb) at pc=0x00000001077cbbf6
iveresov
parents:
20698
diff
changeset
|
1725 |
// 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
|
1726 |
// 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
|
1727 |
// |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1728 |
Node* n = field->ideal_node(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1729 |
for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) { |
53288
f0490430ef7a
8216549: Mismatched unsafe access to non escaping object fails
roland
parents:
52568
diff
changeset
|
1730 |
Node* u = n->fast_out(i); |
f0490430ef7a
8216549: Mismatched unsafe access to non escaping object fails
roland
parents:
52568
diff
changeset
|
1731 |
if (u->is_LoadStore() || (u->is_Mem() && u->as_Mem()->is_mismatched_access())) { |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1732 |
jobj->set_scalar_replaceable(false); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1733 |
return; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1734 |
} |
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 |
|
22213
8b6e8f6a38ab
8027388: JVM crashes with SIGSEGV (0xb) at pc=0x00000001077cbbf6
iveresov
parents:
20698
diff
changeset
|
1737 |
// 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
|
1738 |
// the false positive result (set not scalar replaceable) |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1739 |
// 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
|
1740 |
// 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
|
1741 |
// when stores happened on different control branches. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1742 |
// |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1743 |
// 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
|
1744 |
// |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1745 |
// Point p[] = new Point[1]; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1746 |
// 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
|
1747 |
// |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1748 |
// 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
|
1749 |
// |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1750 |
// Point p[] = new Point[1]; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1751 |
// 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
|
1752 |
// |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1753 |
if (field->base_count() > 1) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1754 |
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
|
1755 |
PointsToNode* base = i.get(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1756 |
// Don't take into account LocalVar nodes which |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1757 |
// 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
|
1758 |
// this field's base by now. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1759 |
if (base->is_JavaObject() && base != jobj) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1760 |
// Mark all bases. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1761 |
jobj->set_scalar_replaceable(false); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1762 |
base->set_scalar_replaceable(false); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1763 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1764 |
} |
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 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1767 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1768 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1769 |
#ifdef ASSERT |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1770 |
void ConnectionGraph::verify_connection_graph( |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1771 |
GrowableArray<PointsToNode*>& ptnodes_worklist, |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1772 |
GrowableArray<JavaObjectNode*>& non_escaped_worklist, |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1773 |
GrowableArray<JavaObjectNode*>& java_objects_worklist, |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1774 |
GrowableArray<Node*>& addp_worklist) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1775 |
// 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
|
1776 |
int java_objects_length = java_objects_worklist.length(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1777 |
int non_escaped_length = non_escaped_worklist.length(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1778 |
int new_edges = 0; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1779 |
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
|
1780 |
JavaObjectNode* ptn = java_objects_worklist.at(next); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1781 |
new_edges += add_java_object_edges(ptn, true); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1782 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1783 |
assert(new_edges == 0, "graph was not complete"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1784 |
// Verify that escape state is final. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1785 |
int length = non_escaped_worklist.length(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1786 |
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
|
1787 |
assert((non_escaped_length == non_escaped_worklist.length()) && |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1788 |
(non_escaped_length == length) && |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1789 |
(_worklist.length() == 0), "escape state was not final"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1790 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1791 |
// Verify fields information. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1792 |
int addp_length = addp_worklist.length(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1793 |
for (int next = 0; next < addp_length; ++next ) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1794 |
Node* n = addp_worklist.at(next); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1795 |
FieldNode* field = ptnode_adr(n->_idx)->as_Field(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1796 |
if (field->is_oop()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1797 |
// Verify that field has all bases |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1798 |
Node* base = get_addp_base(n); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1799 |
PointsToNode* ptn = ptnode_adr(base->_idx); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1800 |
if (ptn->is_JavaObject()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1801 |
assert(field->has_base(ptn->as_JavaObject()), "sanity"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1802 |
} else { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1803 |
assert(ptn->is_LocalVar(), "sanity"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1804 |
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
|
1805 |
PointsToNode* e = i.get(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1806 |
if (e->is_JavaObject()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1807 |
assert(field->has_base(e->as_JavaObject()), "sanity"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1808 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1809 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1810 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1811 |
// Verify that all fields have initializing values. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1812 |
if (field->edge_count() == 0) { |
14395
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1813 |
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
|
1814 |
field->dump(); |
14395
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1815 |
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
|
1816 |
PointsToNode* base = i.get(); |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1817 |
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
|
1818 |
base->dump(); |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1819 |
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
|
1820 |
tty->print_cr("----------base has fields-------------------------"); |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1821 |
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
|
1822 |
j.get()->dump(); |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1823 |
} |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1824 |
tty->print_cr("----------base has references---------------------"); |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1825 |
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
|
1826 |
j.get()->dump(); |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1827 |
} |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1828 |
} |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1829 |
} |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1830 |
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
|
1831 |
i.get()->dump(); |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
1832 |
} |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1833 |
assert(field->edge_count() > 0, "sanity"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1834 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1835 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1836 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1837 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1838 |
#endif |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1839 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1840 |
// Optimize ideal graph. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1841 |
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
|
1842 |
GrowableArray<Node*>& storestore_worklist) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1843 |
Compile* C = _compile; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1844 |
PhaseIterGVN* igvn = _igvn; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1845 |
if (EliminateLocks) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1846 |
// Mark locks before changing ideal graph. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1847 |
int cnt = C->macro_count(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1848 |
for( int i=0; i < cnt; i++ ) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1849 |
Node *n = C->macro_node(i); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1850 |
if (n->is_AbstractLock()) { // Lock and Unlock nodes |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1851 |
AbstractLockNode* alock = n->as_AbstractLock(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1852 |
if (!alock->is_non_esc_obj()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1853 |
if (not_global_escape(alock->obj_node())) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1854 |
assert(!alock->is_eliminated() || alock->is_coarsened(), "sanity"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1855 |
// 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
|
1856 |
// 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
|
1857 |
// to eliminate all associated locks/unlocks. |
29086
74100114a95a
8069412: Locks need better debug-printing support
drchase
parents:
28920
diff
changeset
|
1858 |
#ifdef ASSERT |
74100114a95a
8069412: Locks need better debug-printing support
drchase
parents:
28920
diff
changeset
|
1859 |
alock->log_lock_optimization(C, "eliminate_lock_set_non_esc3"); |
74100114a95a
8069412: Locks need better debug-printing support
drchase
parents:
28920
diff
changeset
|
1860 |
#endif |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1861 |
alock->set_non_esc_obj(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1862 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1863 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1864 |
} |
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 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1868 |
if (OptimizePtrCompare) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1869 |
// Add ConI(#CC_GT) and ConI(#CC_EQ). |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1870 |
_pcmp_neq = igvn->makecon(TypeInt::CC_GT); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1871 |
_pcmp_eq = igvn->makecon(TypeInt::CC_EQ); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1872 |
// Optimize objects compare. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1873 |
while (ptr_cmp_worklist.length() != 0) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1874 |
Node *n = ptr_cmp_worklist.pop(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1875 |
Node *res = optimize_ptr_compare(n); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1876 |
if (res != NULL) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1877 |
#ifndef PRODUCT |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1878 |
if (PrintOptimizePtrCompare) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1879 |
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
|
1880 |
if (Verbose) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1881 |
n->dump(1); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1882 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1883 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1884 |
#endif |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1885 |
igvn->replace_node(n, res); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1886 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1887 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1888 |
// cleanup |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1889 |
if (_pcmp_neq->outcnt() == 0) |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1890 |
igvn->hash_delete(_pcmp_neq); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1891 |
if (_pcmp_eq->outcnt() == 0) |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1892 |
igvn->hash_delete(_pcmp_eq); |
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 |
// 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
|
1896 |
// escape status of associated AllocateNode and optimize out |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1897 |
// MemBarStoreStore node if the allocated object never escapes. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1898 |
while (storestore_worklist.length() != 0) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1899 |
Node *n = storestore_worklist.pop(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1900 |
MemBarStoreStoreNode *storestore = n ->as_MemBarStoreStore(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1901 |
Node *alloc = storestore->in(MemBarNode::Precedent)->in(0); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1902 |
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
|
1903 |
if (not_global_escape(alloc)) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1904 |
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
|
1905 |
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
|
1906 |
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
|
1907 |
igvn->register_new_node_with_optimizer(mb); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1908 |
igvn->replace_node(storestore, mb); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1909 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1910 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1911 |
} |
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 |
// Optimize objects compare. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1914 |
Node* ConnectionGraph::optimize_ptr_compare(Node* n) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1915 |
assert(OptimizePtrCompare, "sanity"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1916 |
PointsToNode* ptn1 = ptnode_adr(n->in(1)->_idx); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1917 |
PointsToNode* ptn2 = ptnode_adr(n->in(2)->_idx); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1918 |
JavaObjectNode* jobj1 = unique_java_object(n->in(1)); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1919 |
JavaObjectNode* jobj2 = unique_java_object(n->in(2)); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1920 |
assert(ptn1->is_JavaObject() || ptn1->is_LocalVar(), "sanity"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1921 |
assert(ptn2->is_JavaObject() || ptn2->is_LocalVar(), "sanity"); |
1 | 1922 |
|
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1923 |
// Check simple cases first. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1924 |
if (jobj1 != NULL) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1925 |
if (jobj1->escape_state() == PointsToNode::NoEscape) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1926 |
if (jobj1 == jobj2) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1927 |
// Comparing the same not escaping object. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1928 |
return _pcmp_eq; |
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 |
Node* obj = jobj1->ideal_node(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1931 |
// Comparing not escaping allocation. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1932 |
if ((obj->is_Allocate() || obj->is_CallStaticJava()) && |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1933 |
!ptn2->points_to(jobj1)) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1934 |
return _pcmp_neq; // This includes nullness check. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1935 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1936 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1937 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1938 |
if (jobj2 != NULL) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1939 |
if (jobj2->escape_state() == PointsToNode::NoEscape) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1940 |
Node* obj = jobj2->ideal_node(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1941 |
// Comparing not escaping allocation. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1942 |
if ((obj->is_Allocate() || obj->is_CallStaticJava()) && |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1943 |
!ptn1->points_to(jobj2)) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1944 |
return _pcmp_neq; // This includes nullness check. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1945 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1946 |
} |
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 |
if (jobj1 != NULL && jobj1 != phantom_obj && |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1949 |
jobj2 != NULL && jobj2 != phantom_obj && |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1950 |
jobj1->ideal_node()->is_Con() && |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1951 |
jobj2->ideal_node()->is_Con()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1952 |
// 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
|
1953 |
// 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
|
1954 |
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
|
1955 |
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
|
1956 |
if (t1->make_ptr() == t2->make_ptr()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1957 |
return _pcmp_eq; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1958 |
} else { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1959 |
return _pcmp_neq; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1960 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1961 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1962 |
if (ptn1->meet(ptn2)) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1963 |
return NULL; // Sets are not disjoint |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1964 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1965 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1966 |
// Sets are disjoint. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1967 |
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
|
1968 |
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
|
1969 |
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
|
1970 |
bool set2_has_null_ptr = ptn2->points_to(null_obj); |
46630
75aa3e39d02c
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents:
46525
diff
changeset
|
1971 |
if ((set1_has_unknown_ptr && set2_has_null_ptr) || |
75aa3e39d02c
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents:
46525
diff
changeset
|
1972 |
(set2_has_unknown_ptr && set1_has_null_ptr)) { |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1973 |
// Check nullness of unknown object. |
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 |
// Disjointness by itself is not sufficient since |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1978 |
// alias analysis is not complete for escaped objects. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1979 |
// Disjoint sets are definitely unrelated only when |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1980 |
// 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
|
1981 |
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
|
1982 |
if (ptn1->non_escaping_allocation()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1983 |
return _pcmp_neq; |
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 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1986 |
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
|
1987 |
if (ptn2->non_escaping_allocation()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1988 |
return _pcmp_neq; |
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 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1991 |
return NULL; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1992 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1993 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1994 |
// Connection Graph constuction functions. |
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 |
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
|
1997 |
PointsToNode* ptadr = _nodes.at(n->_idx); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1998 |
if (ptadr != NULL) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
1999 |
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
|
2000 |
return; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2001 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2002 |
Compile* C = _compile; |
27424
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
2003 |
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
|
2004 |
_nodes.at_put(n->_idx, ptadr); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2005 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2006 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2007 |
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
|
2008 |
PointsToNode* ptadr = _nodes.at(n->_idx); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2009 |
if (ptadr != NULL) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2010 |
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
|
2011 |
return; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2012 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2013 |
Compile* C = _compile; |
27424
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
2014 |
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
|
2015 |
_nodes.at_put(n->_idx, ptadr); |
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 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2018 |
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
|
2019 |
PointsToNode* ptadr = _nodes.at(n->_idx); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2020 |
if (ptadr != NULL) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2021 |
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
|
2022 |
return; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2023 |
} |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12164
diff
changeset
|
2024 |
bool unsafe = false; |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12164
diff
changeset
|
2025 |
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
|
2026 |
if (unsafe) { |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12164
diff
changeset
|
2027 |
es = PointsToNode::GlobalEscape; |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12164
diff
changeset
|
2028 |
} |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2029 |
Compile* C = _compile; |
27424
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
2030 |
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
|
2031 |
_nodes.at_put(n->_idx, field); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2032 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2033 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2034 |
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
|
2035 |
PointsToNode* src, PointsToNode* dst) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2036 |
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
|
2037 |
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
|
2038 |
PointsToNode* ptadr = _nodes.at(n->_idx); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2039 |
if (ptadr != NULL) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2040 |
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
|
2041 |
return; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2042 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2043 |
Compile* C = _compile; |
27424
77a7f4a2463b
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
27142
diff
changeset
|
2044 |
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
|
2045 |
_nodes.at_put(n->_idx, ptadr); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2046 |
// Add edge from arraycopy node to source object. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2047 |
(void)add_edge(ptadr, src); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2048 |
src->set_arraycopy_src(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2049 |
// Add edge from destination object to arraycopy node. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2050 |
(void)add_edge(dst, ptadr); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2051 |
dst->set_arraycopy_dst(); |
1 | 2052 |
} |
2053 |
||
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12164
diff
changeset
|
2054 |
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
|
2055 |
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
|
2056 |
BasicType bt = T_INT; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2057 |
if (offset == Type::OffsetBot) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2058 |
// Check only oop fields. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2059 |
if (!adr_type->isa_aryptr() || |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2060 |
(adr_type->isa_aryptr()->klass() == NULL) || |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2061 |
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
|
2062 |
// 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
|
2063 |
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
|
2064 |
bt = T_OBJECT; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2065 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2066 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2067 |
} else if (offset != oopDesc::klass_offset_in_bytes()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2068 |
if (adr_type->isa_instptr()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2069 |
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
|
2070 |
if (field != NULL) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2071 |
bt = field->layout_type(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2072 |
} else { |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12164
diff
changeset
|
2073 |
// Check for unsafe oop field access |
40021
a7d6cce8c431
8162540: Crash in C2 escape analysis with assert: "node should be registered"
thartmann
parents:
38677
diff
changeset
|
2074 |
if (n->has_out_with(Op_StoreP, Op_LoadP, Op_StoreN, Op_LoadN) || |
a7d6cce8c431
8162540: Crash in C2 escape analysis with assert: "node should be registered"
thartmann
parents:
38677
diff
changeset
|
2075 |
n->has_out_with(Op_GetAndSetP, Op_GetAndSetN, Op_CompareAndExchangeP, Op_CompareAndExchangeN) || |
52568 | 2076 |
n->has_out_with(Op_CompareAndSwapP, Op_CompareAndSwapN, Op_WeakCompareAndSwapP, Op_WeakCompareAndSwapN) || |
2077 |
BarrierSet::barrier_set()->barrier_set_c2()->escape_has_out_with_unsafe_object(n)) { |
|
28643
a665e19ca007
8066312: Add new Node* Node::find_out(int opc) method.
zmajo
parents:
27919
diff
changeset
|
2078 |
bt = T_OBJECT; |
a665e19ca007
8066312: Add new Node* Node::find_out(int opc) method.
zmajo
parents:
27919
diff
changeset
|
2079 |
(*unsafe) = true; |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12164
diff
changeset
|
2080 |
} |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2081 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2082 |
} else if (adr_type->isa_aryptr()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2083 |
if (offset == arrayOopDesc::length_offset_in_bytes()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2084 |
// Ignore array length load. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2085 |
} 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
|
2086 |
// Ignore first AddP. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2087 |
} else { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2088 |
const Type* elemtype = adr_type->isa_aryptr()->elem(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2089 |
bt = elemtype->array_element_basic_type(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2090 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2091 |
} 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
|
2092 |
// Allocation initialization, ThreadLocal field access, unsafe access |
40021
a7d6cce8c431
8162540: Crash in C2 escape analysis with assert: "node should be registered"
thartmann
parents:
38677
diff
changeset
|
2093 |
if (n->has_out_with(Op_StoreP, Op_LoadP, Op_StoreN, Op_LoadN) || |
a7d6cce8c431
8162540: Crash in C2 escape analysis with assert: "node should be registered"
thartmann
parents:
38677
diff
changeset
|
2094 |
n->has_out_with(Op_GetAndSetP, Op_GetAndSetN, Op_CompareAndExchangeP, Op_CompareAndExchangeN) || |
52568 | 2095 |
n->has_out_with(Op_CompareAndSwapP, Op_CompareAndSwapN, Op_WeakCompareAndSwapP, Op_WeakCompareAndSwapN) || |
2096 |
BarrierSet::barrier_set()->barrier_set_c2()->escape_has_out_with_unsafe_object(n)) { |
|
28643
a665e19ca007
8066312: Add new Node* Node::find_out(int opc) method.
zmajo
parents:
27919
diff
changeset
|
2097 |
bt = T_OBJECT; |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2098 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2099 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2100 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2101 |
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
|
2102 |
} |
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 |
// Returns unique pointed java object or NULL. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2105 |
JavaObjectNode* ConnectionGraph::unique_java_object(Node *n) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2106 |
assert(!_collecting, "should not call when contructed graph"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2107 |
// 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
|
2108 |
uint idx = n->_idx; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2109 |
if (idx >= nodes_size()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2110 |
return NULL; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2111 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2112 |
PointsToNode* ptn = ptnode_adr(idx); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2113 |
if (ptn->is_JavaObject()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2114 |
return ptn->as_JavaObject(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2115 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2116 |
assert(ptn->is_LocalVar(), "sanity"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2117 |
// Check all java objects it points to. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2118 |
JavaObjectNode* jobj = NULL; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2119 |
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
|
2120 |
PointsToNode* e = i.get(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2121 |
if (e->is_JavaObject()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2122 |
if (jobj == NULL) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2123 |
jobj = e->as_JavaObject(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2124 |
} else if (jobj != e) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2125 |
return NULL; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2126 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2127 |
} |
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 |
return jobj; |
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 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2132 |
// 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
|
2133 |
bool PointsToNode::non_escaping_allocation() { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2134 |
if (is_JavaObject()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2135 |
Node* n = ideal_node(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2136 |
if (n->is_Allocate() || n->is_CallStaticJava()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2137 |
return (escape_state() == PointsToNode::NoEscape); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2138 |
} else { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2139 |
return false; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2140 |
} |
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 |
assert(is_LocalVar(), "sanity"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2143 |
// Check all java objects it points to. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2144 |
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
|
2145 |
PointsToNode* e = i.get(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2146 |
if (e->is_JavaObject()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2147 |
Node* n = e->ideal_node(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2148 |
if ((e->escape_state() != PointsToNode::NoEscape) || |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2149 |
!(n->is_Allocate() || n->is_CallStaticJava())) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2150 |
return false; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2151 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2152 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2153 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2154 |
return true; |
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 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2157 |
// 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
|
2158 |
bool ConnectionGraph::not_global_escape(Node *n) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2159 |
assert(!_collecting, "should not call during graph construction"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2160 |
// 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
|
2161 |
uint idx = n->_idx; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2162 |
if (idx >= nodes_size()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2163 |
return false; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2164 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2165 |
PointsToNode* ptn = ptnode_adr(idx); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2166 |
PointsToNode::EscapeState es = ptn->escape_state(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2167 |
// 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
|
2168 |
if (es >= PointsToNode::GlobalEscape) |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2169 |
return false; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2170 |
if (ptn->is_JavaObject()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2171 |
return true; // (es < PointsToNode::GlobalEscape); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2172 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2173 |
assert(ptn->is_LocalVar(), "sanity"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2174 |
// Check all java objects it points to. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2175 |
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
|
2176 |
if (i.get()->escape_state() >= PointsToNode::GlobalEscape) |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2177 |
return false; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2178 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2179 |
return true; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2180 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2181 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2182 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2183 |
// Helper functions |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2184 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2185 |
// 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
|
2186 |
bool PointsToNode::points_to(JavaObjectNode* ptn) const { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2187 |
if (is_JavaObject()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2188 |
return (this == ptn); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2189 |
} |
14395
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
2190 |
assert(is_LocalVar() || is_Field(), "sanity"); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2191 |
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
|
2192 |
if (i.get() == ptn) |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2193 |
return true; |
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 |
return false; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2196 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2197 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2198 |
// 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
|
2199 |
bool PointsToNode::meet(PointsToNode* ptn) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2200 |
if (this == ptn) { |
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 |
} else if (ptn->is_JavaObject()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2203 |
return this->points_to(ptn->as_JavaObject()); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2204 |
} else if (this->is_JavaObject()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2205 |
return ptn->points_to(this->as_JavaObject()); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2206 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2207 |
assert(this->is_LocalVar() && ptn->is_LocalVar(), "sanity"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2208 |
int ptn_count = ptn->edge_count(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2209 |
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
|
2210 |
PointsToNode* this_e = i.get(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2211 |
for (int j = 0; j < ptn_count; j++) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2212 |
if (this_e == ptn->edge(j)) |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2213 |
return true; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2214 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2215 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2216 |
return false; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2217 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2218 |
|
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2219 |
#ifdef ASSERT |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2220 |
// 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
|
2221 |
bool FieldNode::has_base(JavaObjectNode* jobj) const { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2222 |
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
|
2223 |
if (i.get() == jobj) |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2224 |
return true; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2225 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2226 |
return false; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2227 |
} |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2228 |
#endif |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2229 |
|
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2230 |
int ConnectionGraph::address_offset(Node* adr, PhaseTransform *phase) { |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2231 |
const Type *adr_type = phase->type(adr); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2232 |
if (adr->is_AddP() && adr_type->isa_oopptr() == NULL && |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2233 |
adr->in(AddPNode::Address)->is_Proj() && |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2234 |
adr->in(AddPNode::Address)->in(0)->is_Allocate()) { |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2235 |
// 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
|
2236 |
// 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
|
2237 |
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
|
2238 |
assert(offs != Type::OffsetBot || |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2239 |
adr->in(AddPNode::Address)->in(0)->is_AllocateArray(), |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2240 |
"offset must be a constant or it is initialization of array"); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2241 |
return offs; |
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 |
const TypePtr *t_ptr = adr_type->isa_ptr(); |
1 | 2244 |
assert(t_ptr != NULL, "must be a pointer type"); |
2245 |
return t_ptr->offset(); |
|
2246 |
} |
|
2247 |
||
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2248 |
Node* ConnectionGraph::get_addp_base(Node *addp) { |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2249 |
assert(addp->is_AddP(), "must be AddP"); |
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 cases for Base and Address inputs: |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2252 |
// case #1. Direct object's field reference: |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2253 |
// Allocate |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2254 |
// | |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2255 |
// Proj #5 ( oop result ) |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2256 |
// | |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2257 |
// CheckCastPP (cast to instance type) |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2258 |
// | | |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2259 |
// AddP ( base == address ) |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2260 |
// |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2261 |
// case #2. Indirect object's field reference: |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2262 |
// Phi |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2263 |
// | |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2264 |
// CastPP (cast to instance type) |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2265 |
// | | |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2266 |
// AddP ( base == address ) |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2267 |
// |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2268 |
// case #3. Raw object's field reference for Initialize node: |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2269 |
// Allocate |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2270 |
// | |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2271 |
// Proj #5 ( oop result ) |
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 |
// |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2276 |
// case #4. Array's element reference: |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2277 |
// {CheckCastPP | CastPP} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2278 |
// | | | |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2279 |
// | AddP ( array's element offset ) |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2280 |
// | | |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2281 |
// AddP ( array's offset ) |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2282 |
// |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2283 |
// case #5. Raw object's field reference for arraycopy stub call: |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2284 |
// The inline_native_clone() case when the arraycopy stub is called |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2285 |
// after the allocation before Initialize and CheckCastPP nodes. |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2286 |
// Allocate |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2287 |
// | |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2288 |
// Proj #5 ( oop result ) |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2289 |
// | | |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2290 |
// AddP ( base == address ) |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2291 |
// |
250 | 2292 |
// case #6. Constant Pool, ThreadLocal, CastX2P or |
2293 |
// Raw object's field reference: |
|
2294 |
// {ConP, ThreadLocal, CastX2P, raw Load} |
|
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2295 |
// top | |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2296 |
// \ | |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2297 |
// AddP ( base == top ) |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2298 |
// |
250 | 2299 |
// case #7. Klass's field reference. |
2300 |
// LoadKlass |
|
2301 |
// | | |
|
2302 |
// AddP ( base == address ) |
|
2303 |
// |
|
590
2954744d7bba
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
589
diff
changeset
|
2304 |
// 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
|
2305 |
// LoadNKlass |
2954744d7bba
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
589
diff
changeset
|
2306 |
// | |
2954744d7bba
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
589
diff
changeset
|
2307 |
// DecodeN |
2954744d7bba
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
589
diff
changeset
|
2308 |
// | | |
2954744d7bba
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
589
diff
changeset
|
2309 |
// AddP ( base == address ) |
2954744d7bba
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
589
diff
changeset
|
2310 |
// |
46525
3a5c833a43de
8176506: C2: loop unswitching and unsafe accesses cause crash
roland
parents:
40094
diff
changeset
|
2311 |
// case #9. Mixed unsafe access |
3a5c833a43de
8176506: C2: loop unswitching and unsafe accesses cause crash
roland
parents:
40094
diff
changeset
|
2312 |
// {instance} |
3a5c833a43de
8176506: C2: loop unswitching and unsafe accesses cause crash
roland
parents:
40094
diff
changeset
|
2313 |
// | |
3a5c833a43de
8176506: C2: loop unswitching and unsafe accesses cause crash
roland
parents:
40094
diff
changeset
|
2314 |
// CheckCastPP (raw) |
3a5c833a43de
8176506: C2: loop unswitching and unsafe accesses cause crash
roland
parents:
40094
diff
changeset
|
2315 |
// top | |
3a5c833a43de
8176506: C2: loop unswitching and unsafe accesses cause crash
roland
parents:
40094
diff
changeset
|
2316 |
// \ | |
3a5c833a43de
8176506: C2: loop unswitching and unsafe accesses cause crash
roland
parents:
40094
diff
changeset
|
2317 |
// AddP ( base == top ) |
3a5c833a43de
8176506: C2: loop unswitching and unsafe accesses cause crash
roland
parents:
40094
diff
changeset
|
2318 |
// |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2319 |
Node *base = addp->in(AddPNode::Base); |
46525
3a5c833a43de
8176506: C2: loop unswitching and unsafe accesses cause crash
roland
parents:
40094
diff
changeset
|
2320 |
if (base->uncast()->is_top()) { // The AddP case #3 and #6 and #9. |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2321 |
base = addp->in(AddPNode::Address); |
3804 | 2322 |
while (base->is_AddP()) { |
2323 |
// 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
|
2324 |
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
|
2325 |
base = base->in(AddPNode::Address); |
3804 | 2326 |
} |
46525
3a5c833a43de
8176506: C2: loop unswitching and unsafe accesses cause crash
roland
parents:
40094
diff
changeset
|
2327 |
if (base->Opcode() == Op_CheckCastPP && |
3a5c833a43de
8176506: C2: loop unswitching and unsafe accesses cause crash
roland
parents:
40094
diff
changeset
|
2328 |
base->bottom_type()->isa_rawptr() && |
3a5c833a43de
8176506: C2: loop unswitching and unsafe accesses cause crash
roland
parents:
40094
diff
changeset
|
2329 |
_igvn->type(base->in(1))->isa_oopptr()) { |
3a5c833a43de
8176506: C2: loop unswitching and unsafe accesses cause crash
roland
parents:
40094
diff
changeset
|
2330 |
base = base->in(1); // Case #9 |
3a5c833a43de
8176506: C2: loop unswitching and unsafe accesses cause crash
roland
parents:
40094
diff
changeset
|
2331 |
} else { |
3a5c833a43de
8176506: C2: loop unswitching and unsafe accesses cause crash
roland
parents:
40094
diff
changeset
|
2332 |
Node* uncast_base = base->uncast(); |
3a5c833a43de
8176506: C2: loop unswitching and unsafe accesses cause crash
roland
parents:
40094
diff
changeset
|
2333 |
int opcode = uncast_base->Opcode(); |
3a5c833a43de
8176506: C2: loop unswitching and unsafe accesses cause crash
roland
parents:
40094
diff
changeset
|
2334 |
assert(opcode == Op_ConP || opcode == Op_ThreadLocal || |
3a5c833a43de
8176506: C2: loop unswitching and unsafe accesses cause crash
roland
parents:
40094
diff
changeset
|
2335 |
opcode == Op_CastX2P || uncast_base->is_DecodeNarrowPtr() || |
3a5c833a43de
8176506: C2: loop unswitching and unsafe accesses cause crash
roland
parents:
40094
diff
changeset
|
2336 |
(uncast_base->is_Mem() && (uncast_base->bottom_type()->isa_rawptr() != NULL)) || |
52568 | 2337 |
(uncast_base->is_Proj() && uncast_base->in(0)->is_Allocate()) || |
2338 |
BarrierSet::barrier_set()->barrier_set_c2()->escape_is_barrier_node(uncast_base), "sanity"); |
|
46525
3a5c833a43de
8176506: C2: loop unswitching and unsafe accesses cause crash
roland
parents:
40094
diff
changeset
|
2339 |
} |
1 | 2340 |
} |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2341 |
return base; |
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 |
|
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2344 |
Node* ConnectionGraph::find_second_addp(Node* addp, Node* n) { |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2345 |
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
|
2346 |
Node* addp2 = addp->raw_out(0); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2347 |
if (addp->outcnt() == 1 && addp2->is_AddP() && |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2348 |
addp2->in(AddPNode::Base) == n && |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2349 |
addp2->in(AddPNode::Address) == addp) { |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2350 |
assert(addp->in(AddPNode::Base) == n, "expecting the same base"); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2351 |
// |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2352 |
// Find array's offset to push it on worklist first and |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2353 |
// as result process an array's element offset first (pushed second) |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2354 |
// to avoid CastPP for the array's offset. |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2355 |
// Otherwise the inserted CastPP (LocalVar) will point to what |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2356 |
// the AddP (Field) points to. Which would be wrong since |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2357 |
// the algorithm expects the CastPP has the same point as |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2358 |
// as AddP's base CheckCastPP (LocalVar). |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2359 |
// |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2360 |
// ArrayAllocation |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2361 |
// | |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2362 |
// CheckCastPP |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2363 |
// | |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2364 |
// memProj (from ArrayAllocation CheckCastPP) |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2365 |
// | || |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2366 |
// | || Int (element index) |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2367 |
// | || | ConI (log(element size)) |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2368 |
// | || | / |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2369 |
// | || LShift |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2370 |
// | || / |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2371 |
// | AddP (array's element offset) |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2372 |
// | | |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2373 |
// | | ConI (array's offset: #12(32-bits) or #24(64-bits)) |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2374 |
// | / / |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2375 |
// AddP (array's offset) |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2376 |
// | |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2377 |
// Load/Store (memory operation on array's element) |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2378 |
// |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2379 |
return addp2; |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2380 |
} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2381 |
return NULL; |
1 | 2382 |
} |
2383 |
||
2384 |
// |
|
2385 |
// Adjust the type and inputs of an AddP which computes the |
|
2386 |
// address of a field of an instance |
|
2387 |
// |
|
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2388 |
bool ConnectionGraph::split_AddP(Node *addp, Node *base) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2389 |
PhaseGVN* igvn = _igvn; |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2390 |
const TypeOopPtr *base_t = igvn->type(base)->isa_oopptr(); |
769 | 2391 |
assert(base_t != NULL && base_t->is_known_instance(), "expecting instance oopptr"); |
1 | 2392 |
const TypeOopPtr *t = igvn->type(addp)->isa_oopptr(); |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2393 |
if (t == NULL) { |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2394 |
// 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
|
2395 |
// compute an appropriate address type (cases #3 and #5). |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2396 |
assert(igvn->type(addp) == TypeRawPtr::NOTNULL, "must be raw pointer"); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2397 |
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
|
2398 |
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
|
2399 |
assert(offs != Type::OffsetBot, "offset must be a constant"); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2400 |
t = base_t->add_offset(offs)->is_oopptr(); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2401 |
} |
769 | 2402 |
int inst_id = base_t->instance_id(); |
2403 |
assert(!t->is_known_instance() || t->instance_id() == inst_id, |
|
1 | 2404 |
"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
|
2405 |
|
f4fb9fb08038
6731641: assert(m->adr_type() == mach->adr_type(),"matcher should not change adr type")
kvn
parents:
961
diff
changeset
|
2406 |
// 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
|
2407 |
// 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
|
2408 |
// 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
|
2409 |
// 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
|
2410 |
// |
2131 | 2411 |
// 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
|
2412 |
// 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
|
2413 |
// 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
|
2414 |
// |
3907
2a567f035d5c
6879362: assert(!klass_is_exact(),"only non-exact klass")
kvn
parents:
3804
diff
changeset
|
2415 |
// 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
|
2416 |
// 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
|
2417 |
// (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
|
2418 |
// |
1055
f4fb9fb08038
6731641: assert(m->adr_type() == mach->adr_type(),"matcher should not change adr type")
kvn
parents:
961
diff
changeset
|
2419 |
// 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
|
2420 |
// 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
|
2421 |
// |
f4fb9fb08038
6731641: assert(m->adr_type() == mach->adr_type(),"matcher should not change adr type")
kvn
parents:
961
diff
changeset
|
2422 |
if (!t->is_known_instance() && |
3907
2a567f035d5c
6879362: assert(!klass_is_exact(),"only non-exact klass")
kvn
parents:
3804
diff
changeset
|
2423 |
!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
|
2424 |
return false; // bail out |
f4fb9fb08038
6731641: assert(m->adr_type() == mach->adr_type(),"matcher should not change adr type")
kvn
parents:
961
diff
changeset
|
2425 |
} |
1 | 2426 |
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
|
2427 |
// 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
|
2428 |
// 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
|
2429 |
// has side effect. |
1 | 2430 |
int alias_idx = _compile->get_alias_index(tinst); |
2431 |
igvn->set_type(addp, tinst); |
|
2432 |
// record the allocation in the node map |
|
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2433 |
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
|
2434 |
// 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
|
2435 |
Node *abase = addp->in(AddPNode::Base); |
7fb3b13d4205
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
955
diff
changeset
|
2436 |
Node *adr = addp->in(AddPNode::Address); |
7fb3b13d4205
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
955
diff
changeset
|
2437 |
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
|
2438 |
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
|
2439 |
// Skip AddP cases #3 and #5. |
7fb3b13d4205
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
955
diff
changeset
|
2440 |
} else { |
7fb3b13d4205
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
955
diff
changeset
|
2441 |
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
|
2442 |
if (abase != base) { |
7fb3b13d4205
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
955
diff
changeset
|
2443 |
igvn->hash_delete(addp); |
7fb3b13d4205
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
955
diff
changeset
|
2444 |
addp->set_req(AddPNode::Base, base); |
7fb3b13d4205
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
955
diff
changeset
|
2445 |
if (abase == adr) { |
7fb3b13d4205
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
955
diff
changeset
|
2446 |
addp->set_req(AddPNode::Address, base); |
7fb3b13d4205
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
955
diff
changeset
|
2447 |
} else { |
7fb3b13d4205
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
955
diff
changeset
|
2448 |
// 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
|
2449 |
#ifdef ASSERT |
7fb3b13d4205
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
955
diff
changeset
|
2450 |
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
|
2451 |
assert(adr->is_AddP() && atype != NULL && |
7fb3b13d4205
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
955
diff
changeset
|
2452 |
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
|
2453 |
#endif |
7fb3b13d4205
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
955
diff
changeset
|
2454 |
} |
7fb3b13d4205
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
955
diff
changeset
|
2455 |
igvn->hash_insert(addp); |
1 | 2456 |
} |
2457 |
} |
|
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2458 |
// 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
|
2459 |
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
|
2460 |
return true; |
1 | 2461 |
} |
2462 |
||
2463 |
// |
|
2464 |
// 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
|
2465 |
// created phi or an existing phi. Sets create_new to indicate whether a new |
1 | 2466 |
// phi was created. Cache the last newly created phi in the node map. |
2467 |
// |
|
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2468 |
PhiNode *ConnectionGraph::create_split_phi(PhiNode *orig_phi, int alias_idx, GrowableArray<PhiNode *> &orig_phi_worklist, bool &new_created) { |
1 | 2469 |
Compile *C = _compile; |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2470 |
PhaseGVN* igvn = _igvn; |
1 | 2471 |
new_created = false; |
2472 |
int phi_alias_idx = C->get_alias_index(orig_phi->adr_type()); |
|
2473 |
// 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
|
2474 |
if (phi_alias_idx == alias_idx) { |
1 | 2475 |
return orig_phi; |
2476 |
} |
|
3268
f034e0c86895
6851742: (EA) allocation elimination doesn't work with UseG1GC
kvn
parents:
2871
diff
changeset
|
2477 |
// Have we recently created a Phi for this alias index? |
1 | 2478 |
PhiNode *result = get_map_phi(orig_phi->_idx); |
2479 |
if (result != NULL && C->get_alias_index(result->adr_type()) == alias_idx) { |
|
2480 |
return result; |
|
2481 |
} |
|
3268
f034e0c86895
6851742: (EA) allocation elimination doesn't work with UseG1GC
kvn
parents:
2871
diff
changeset
|
2482 |
// 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
|
2483 |
// 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
|
2484 |
if (result != NULL) { |
f034e0c86895
6851742: (EA) allocation elimination doesn't work with UseG1GC
kvn
parents:
2871
diff
changeset
|
2485 |
Node* region = orig_phi->in(0); |
f034e0c86895
6851742: (EA) allocation elimination doesn't work with UseG1GC
kvn
parents:
2871
diff
changeset
|
2486 |
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
|
2487 |
Node* phi = region->fast_out(i); |
f034e0c86895
6851742: (EA) allocation elimination doesn't work with UseG1GC
kvn
parents:
2871
diff
changeset
|
2488 |
if (phi->is_Phi() && |
f034e0c86895
6851742: (EA) allocation elimination doesn't work with UseG1GC
kvn
parents:
2871
diff
changeset
|
2489 |
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
|
2490 |
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
|
2491 |
return phi->as_Phi(); |
f034e0c86895
6851742: (EA) allocation elimination doesn't work with UseG1GC
kvn
parents:
2871
diff
changeset
|
2492 |
} |
f034e0c86895
6851742: (EA) allocation elimination doesn't work with UseG1GC
kvn
parents:
2871
diff
changeset
|
2493 |
} |
f034e0c86895
6851742: (EA) allocation elimination doesn't work with UseG1GC
kvn
parents:
2871
diff
changeset
|
2494 |
} |
27707
f7d26e5b8b5d
8058148: MaxNodeLimit and LiveNodeCountInliningCutoff
vlivanov
parents:
27424
diff
changeset
|
2495 |
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
|
2496 |
if (C->do_escape_analysis() == true && !C->failing()) { |
e2b60448c234
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
1
diff
changeset
|
2497 |
// Retry compilation without escape analysis. |
e2b60448c234
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
1
diff
changeset
|
2498 |
// 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
|
2499 |
// 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
|
2500 |
C->record_failure(C2Compiler::retry_no_escape_analysis()); |
e2b60448c234
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
1
diff
changeset
|
2501 |
} |
e2b60448c234
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
1
diff
changeset
|
2502 |
return NULL; |
e2b60448c234
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
1
diff
changeset
|
2503 |
} |
1 | 2504 |
orig_phi_worklist.append_if_missing(orig_phi); |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2505 |
const TypePtr *atype = C->get_adr_type(alias_idx); |
1 | 2506 |
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
|
2507 |
C->copy_node_notes_to(result, orig_phi); |
1 | 2508 |
igvn->set_type(result, result->bottom_type()); |
2509 |
record_for_optimizer(result); |
|
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2510 |
set_map(orig_phi, result); |
1 | 2511 |
new_created = true; |
2512 |
return result; |
|
2513 |
} |
|
2514 |
||
2515 |
// |
|
9115
5a28312aa393
6992789: assert(phi->_idx >= nodes_size()) failed: only new Phi per instance memory slice
kvn
parents:
8319
diff
changeset
|
2516 |
// Return a new version of Memory Phi "orig_phi" with the inputs having the |
1 | 2517 |
// specified alias index. |
2518 |
// |
|
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2519 |
PhiNode *ConnectionGraph::split_memory_phi(PhiNode *orig_phi, int alias_idx, GrowableArray<PhiNode *> &orig_phi_worklist) { |
1 | 2520 |
assert(alias_idx != Compile::AliasIdxBot, "can't split out bottom memory"); |
2521 |
Compile *C = _compile; |
|
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2522 |
PhaseGVN* igvn = _igvn; |
1 | 2523 |
bool new_phi_created; |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2524 |
PhiNode *result = create_split_phi(orig_phi, alias_idx, orig_phi_worklist, new_phi_created); |
1 | 2525 |
if (!new_phi_created) { |
2526 |
return result; |
|
2527 |
} |
|
2528 |
GrowableArray<PhiNode *> phi_list; |
|
2529 |
GrowableArray<uint> cur_input; |
|
2530 |
PhiNode *phi = orig_phi; |
|
2531 |
uint idx = 1; |
|
2532 |
bool finished = false; |
|
2533 |
while(!finished) { |
|
2534 |
while (idx < phi->req()) { |
|
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2535 |
Node *mem = find_inst_mem(phi->in(idx), alias_idx, orig_phi_worklist); |
1 | 2536 |
if (mem != NULL && mem->is_Phi()) { |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2537 |
PhiNode *newphi = create_split_phi(mem->as_Phi(), alias_idx, orig_phi_worklist, new_phi_created); |
1 | 2538 |
if (new_phi_created) { |
2539 |
// found an phi for which we created a new split, push current one on worklist and begin |
|
2540 |
// processing new one |
|
2541 |
phi_list.push(phi); |
|
2542 |
cur_input.push(idx); |
|
2543 |
phi = mem->as_Phi(); |
|
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2544 |
result = newphi; |
1 | 2545 |
idx = 1; |
2546 |
continue; |
|
2547 |
} else { |
|
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2548 |
mem = newphi; |
1 | 2549 |
} |
2550 |
} |
|
211
e2b60448c234
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
1
diff
changeset
|
2551 |
if (C->failing()) { |
e2b60448c234
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
1
diff
changeset
|
2552 |
return NULL; |
e2b60448c234
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
1
diff
changeset
|
2553 |
} |
1 | 2554 |
result->set_req(idx++, mem); |
2555 |
} |
|
2556 |
#ifdef ASSERT |
|
2557 |
// verify that the new Phi has an input for each input of the original |
|
2558 |
assert( phi->req() == result->req(), "must have same number of inputs."); |
|
2559 |
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
|
2560 |
#endif |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2561 |
// Check if all new phi's inputs have specified alias index. |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2562 |
// Otherwise use old phi. |
1 | 2563 |
for (uint i = 1; i < phi->req(); i++) { |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2564 |
Node* in = result->in(i); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2565 |
assert((phi->in(i) == NULL) == (in == NULL), "inputs must correspond."); |
1 | 2566 |
} |
2567 |
// we have finished processing a Phi, see if there are any more to do |
|
2568 |
finished = (phi_list.length() == 0 ); |
|
2569 |
if (!finished) { |
|
2570 |
phi = phi_list.pop(); |
|
2571 |
idx = cur_input.pop(); |
|
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2572 |
PhiNode *prev_result = get_map_phi(phi->_idx); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2573 |
prev_result->set_req(idx++, result); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2574 |
result = prev_result; |
1 | 2575 |
} |
2576 |
} |
|
2577 |
return result; |
|
2578 |
} |
|
2579 |
||
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2580 |
// |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2581 |
// The next methods are derived from methods in MemNode. |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2582 |
// |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2583 |
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
|
2584 |
Node *mem = mmem; |
6741 | 2585 |
// TypeOopPtr::NOTNULL+any is an OOP with unknown offset - generally |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2586 |
// 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
|
2587 |
// alias stuff with it any time soon. |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2588 |
if (toop->base() != Type::AnyPtr && |
6741 | 2589 |
!(toop->klass() != NULL && |
2590 |
toop->klass()->is_java_lang_Object() && |
|
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2591 |
toop->offset() == Type::OffsetBot)) { |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2592 |
mem = mmem->memory_at(alias_idx); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2593 |
// Update input if it is progress over what we have now |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2594 |
} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2595 |
return mem; |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2596 |
} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2597 |
|
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2598 |
// |
4471
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2599 |
// Move memory users to their memory slices. |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2600 |
// |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2601 |
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
|
2602 |
Compile* C = _compile; |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2603 |
PhaseGVN* igvn = _igvn; |
4471
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2604 |
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
|
2605 |
assert(tp != NULL, "ptr type"); |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2606 |
int alias_idx = C->get_alias_index(tp); |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2607 |
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
|
2608 |
|
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2609 |
// Move users first |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2610 |
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
|
2611 |
Node* use = n->fast_out(i); |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2612 |
if (use->is_MergeMem()) { |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2613 |
MergeMemNode* mmem = use->as_MergeMem(); |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2614 |
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
|
2615 |
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
|
2616 |
continue; // Nothing to do |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2617 |
} |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2618 |
// Replace previous general reference to mem node. |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2619 |
uint orig_uniq = C->unique(); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2620 |
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
|
2621 |
assert(orig_uniq == C->unique(), "no new nodes"); |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2622 |
mmem->set_memory_at(general_idx, m); |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2623 |
--imax; |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2624 |
--i; |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2625 |
} else if (use->is_MemBar()) { |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2626 |
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
|
2627 |
if (use->req() > MemBarNode::Precedent && |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2628 |
use->in(MemBarNode::Precedent) == n) { |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2629 |
// Don't move related membars. |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2630 |
record_for_optimizer(use); |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2631 |
continue; |
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 |
tp = use->as_MemBar()->adr_type()->isa_ptr(); |
46630
75aa3e39d02c
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents:
46525
diff
changeset
|
2634 |
if ((tp != NULL && C->get_alias_index(tp) == alias_idx) || |
4471
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2635 |
alias_idx == general_idx) { |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2636 |
continue; // Nothing to do |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2637 |
} |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2638 |
// Move to general memory slice. |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2639 |
uint orig_uniq = C->unique(); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2640 |
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
|
2641 |
assert(orig_uniq == C->unique(), "no new nodes"); |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2642 |
igvn->hash_delete(use); |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2643 |
imax -= use->replace_edge(n, m); |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2644 |
igvn->hash_insert(use); |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2645 |
record_for_optimizer(use); |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2646 |
--i; |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2647 |
#ifdef ASSERT |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2648 |
} else if (use->is_Mem()) { |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2649 |
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
|
2650 |
// Don't move related cardmark. |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2651 |
continue; |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2652 |
} |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2653 |
// Memory nodes should have new memory input. |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2654 |
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
|
2655 |
assert(tp != NULL, "ptr type"); |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2656 |
int idx = C->get_alias_index(tp); |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2657 |
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
|
2658 |
"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
|
2659 |
} else if (use->is_Phi()) { |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2660 |
// Phi nodes should be split and moved already. |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2661 |
tp = use->as_Phi()->adr_type()->isa_ptr(); |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2662 |
assert(tp != NULL, "ptr type"); |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2663 |
int idx = C->get_alias_index(tp); |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2664 |
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
|
2665 |
} else { |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2666 |
use->dump(); |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2667 |
assert(false, "should not be here"); |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2668 |
#endif |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2669 |
} |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2670 |
} |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2671 |
} |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2672 |
|
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2673 |
// |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2674 |
// Search memory chain of "mem" to find a MemNode whose address |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2675 |
// is the specified alias index. |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2676 |
// |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2677 |
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
|
2678 |
if (orig_mem == NULL) |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2679 |
return orig_mem; |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2680 |
Compile* C = _compile; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2681 |
PhaseGVN* igvn = _igvn; |
6741 | 2682 |
const TypeOopPtr *toop = C->get_adr_type(alias_idx)->isa_oopptr(); |
2683 |
bool is_instance = (toop != NULL) && toop->is_known_instance(); |
|
48595
5d699d81c10c
8194988: 8 Null pointer dereference defect groups related to MultiNode::proj_out()
dlong
parents:
47216
diff
changeset
|
2684 |
Node *start_mem = C->start()->proj_out_or_null(TypeFunc::Memory); |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2685 |
Node *prev = NULL; |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2686 |
Node *result = orig_mem; |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2687 |
while (prev != result) { |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2688 |
prev = result; |
961
7fb3b13d4205
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
955
diff
changeset
|
2689 |
if (result == start_mem) |
2131 | 2690 |
break; // hit one of our sentinels |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2691 |
if (result->is_Mem()) { |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2692 |
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
|
2693 |
if (at == Type::TOP) |
5a28312aa393
6992789: assert(phi->_idx >= nodes_size()) failed: only new Phi per instance memory slice
kvn
parents:
8319
diff
changeset
|
2694 |
break; // Dead |
5a28312aa393
6992789: assert(phi->_idx >= nodes_size()) failed: only new Phi per instance memory slice
kvn
parents:
8319
diff
changeset
|
2695 |
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
|
2696 |
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
|
2697 |
if (idx == alias_idx) |
5a28312aa393
6992789: assert(phi->_idx >= nodes_size()) failed: only new Phi per instance memory slice
kvn
parents:
8319
diff
changeset
|
2698 |
break; // Found |
5a28312aa393
6992789: assert(phi->_idx >= nodes_size()) failed: only new Phi per instance memory slice
kvn
parents:
8319
diff
changeset
|
2699 |
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
|
2700 |
!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
|
2701 |
break; // Do not skip store to general memory slice. |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2702 |
} |
961
7fb3b13d4205
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
955
diff
changeset
|
2703 |
result = result->in(MemNode::Memory); |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2704 |
} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2705 |
if (!is_instance) |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2706 |
continue; // don't search further for non-instance types |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2707 |
// skip over a call which does not affect this memory slice |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2708 |
if (result->is_Proj() && result->as_Proj()->_con == TypeFunc::Memory) { |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2709 |
Node *proj_in = result->in(0); |
6741 | 2710 |
if (proj_in->is_Allocate() && proj_in->_idx == (uint)toop->instance_id()) { |
2131 | 2711 |
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
|
2712 |
} else if (proj_in->is_Call()) { |
30629
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
2713 |
// ArrayCopy node processed here as well |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2714 |
CallNode *call = proj_in->as_Call(); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2715 |
if (!call->may_modify(toop, igvn)) { |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2716 |
result = call->in(TypeFunc::Memory); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2717 |
} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2718 |
} else if (proj_in->is_Initialize()) { |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2719 |
AllocateNode* alloc = proj_in->as_Initialize()->allocation(); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2720 |
// Stop if this is the initialization for the object instance which |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2721 |
// which contains this memory slice, otherwise skip over it. |
6741 | 2722 |
if (alloc == NULL || alloc->_idx != (uint)toop->instance_id()) { |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2723 |
result = proj_in->in(TypeFunc::Memory); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2724 |
} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2725 |
} else if (proj_in->is_MemBar()) { |
30629
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
2726 |
if (proj_in->in(TypeFunc::Memory)->is_MergeMem() && |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
2727 |
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
|
2728 |
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
|
2729 |
// clone |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
2730 |
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
|
2731 |
if (ac->may_modify(toop, igvn)) { |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
2732 |
break; |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
2733 |
} |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
2734 |
} |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2735 |
result = proj_in->in(TypeFunc::Memory); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2736 |
} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2737 |
} else if (result->is_MergeMem()) { |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2738 |
MergeMemNode *mmem = result->as_MergeMem(); |
6741 | 2739 |
result = step_through_mergemem(mmem, alias_idx, toop); |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2740 |
if (result == mmem->base_memory()) { |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2741 |
// Didn't find instance memory, search through general slice recursively. |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2742 |
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
|
2743 |
result = find_inst_mem(result, alias_idx, orig_phis); |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2744 |
if (C->failing()) { |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2745 |
return NULL; |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2746 |
} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2747 |
mmem->set_memory_at(alias_idx, result); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2748 |
} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2749 |
} else if (result->is_Phi() && |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2750 |
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
|
2751 |
Node *un = result->as_Phi()->unique_input(igvn); |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2752 |
if (un != NULL) { |
4471
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2753 |
orig_phis.append_if_missing(result->as_Phi()); |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2754 |
result = un; |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2755 |
} else { |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2756 |
break; |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2757 |
} |
4470
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
2758 |
} else if (result->is_ClearArray()) { |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2759 |
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
|
2760 |
// Can not bypass initialization of the instance |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
2761 |
// we are looking for. |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
2762 |
break; |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
2763 |
} |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
2764 |
// Otherwise skip it (the call updated 'result' value). |
2110
40e42c95ac39
6802499: EA: assert(false,"unknown node on this path")
kvn
parents:
1613
diff
changeset
|
2765 |
} 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
|
2766 |
Node* mem = result->in(0); |
695bb216be99
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
14623
diff
changeset
|
2767 |
Node* adr = NULL; |
695bb216be99
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
14623
diff
changeset
|
2768 |
if (mem->is_LoadStore()) { |
695bb216be99
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
14623
diff
changeset
|
2769 |
adr = mem->in(MemNode::Address); |
695bb216be99
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
14623
diff
changeset
|
2770 |
} else { |
33628 | 2771 |
assert(mem->Opcode() == Op_EncodeISOArray || |
2772 |
mem->Opcode() == Op_StrCompressedCopy, "sanity"); |
|
15242
695bb216be99
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
14623
diff
changeset
|
2773 |
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
|
2774 |
} |
695bb216be99
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
14623
diff
changeset
|
2775 |
const Type *at = igvn->type(adr); |
2110
40e42c95ac39
6802499: EA: assert(false,"unknown node on this path")
kvn
parents:
1613
diff
changeset
|
2776 |
if (at != Type::TOP) { |
33628 | 2777 |
assert(at->isa_ptr() != NULL, "pointer type required."); |
2110
40e42c95ac39
6802499: EA: assert(false,"unknown node on this path")
kvn
parents:
1613
diff
changeset
|
2778 |
int idx = C->get_alias_index(at->is_ptr()); |
33628 | 2779 |
if (idx == alias_idx) { |
2780 |
// Assert in debug mode |
|
2781 |
assert(false, "Object is not scalar replaceable if a LoadStore node accesses its field"); |
|
2782 |
break; // In product mode return SCMemProj node |
|
2783 |
} |
|
2110
40e42c95ac39
6802499: EA: assert(false,"unknown node on this path")
kvn
parents:
1613
diff
changeset
|
2784 |
} |
15242
695bb216be99
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
14623
diff
changeset
|
2785 |
result = mem->in(MemNode::Memory); |
33628 | 2786 |
} else if (result->Opcode() == Op_StrInflatedCopy) { |
2787 |
Node* adr = result->in(3); // Memory edge corresponds to destination array |
|
2788 |
const Type *at = igvn->type(adr); |
|
2789 |
if (at != Type::TOP) { |
|
2790 |
assert(at->isa_ptr() != NULL, "pointer type required."); |
|
2791 |
int idx = C->get_alias_index(at->is_ptr()); |
|
2792 |
if (idx == alias_idx) { |
|
2793 |
// Assert in debug mode |
|
2794 |
assert(false, "Object is not scalar replaceable if a StrInflatedCopy node accesses its field"); |
|
2795 |
break; // In product mode return SCMemProj node |
|
2796 |
} |
|
2797 |
} |
|
2798 |
result = result->in(MemNode::Memory); |
|
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2799 |
} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2800 |
} |
955 | 2801 |
if (result->is_Phi()) { |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2802 |
PhiNode *mphi = result->as_Phi(); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2803 |
assert(mphi->bottom_type() == Type::MEMORY, "memory phi required"); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2804 |
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
|
2805 |
if (!is_instance) { |
955 | 2806 |
// Push all non-instance Phis on the orig_phis worklist to update inputs |
2807 |
// during Phase 4 if needed. |
|
2808 |
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
|
2809 |
} 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
|
2810 |
// 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
|
2811 |
result = split_memory_phi(mphi, alias_idx, orig_phis); |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2812 |
} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2813 |
} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2814 |
// the result is either MemNode, PhiNode, InitializeNode. |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2815 |
return result; |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2816 |
} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2817 |
|
1 | 2818 |
// |
2819 |
// Convert the types of unescaped object to instance types where possible, |
|
2820 |
// propagate the new type information through the graph, and update memory |
|
2821 |
// edges and MergeMem inputs to reflect the new type. |
|
2822 |
// |
|
2823 |
// We start with allocations (and calls which may be allocations) on alloc_worklist. |
|
2824 |
// The processing is done in 4 phases: |
|
2825 |
// |
|
2826 |
// Phase 1: Process possible allocations from alloc_worklist. Create instance |
|
2827 |
// types for the CheckCastPP for allocations where possible. |
|
30629
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
2828 |
// Propagate the new types through users as follows: |
1 | 2829 |
// casts and Phi: push users on alloc_worklist |
2830 |
// AddP: cast Base and Address inputs to the instance type |
|
2831 |
// push any AddP users on alloc_worklist and push any memnode |
|
2832 |
// users onto memnode_worklist. |
|
2833 |
// Phase 2: Process MemNode's from memnode_worklist. compute new address type and |
|
2834 |
// search the Memory chain for a store with the appropriate type |
|
2835 |
// address type. If a Phi is found, create a new version with |
|
2131 | 2836 |
// the appropriate memory slices from each of the Phi inputs. |
1 | 2837 |
// For stores, process the users as follows: |
2838 |
// MemNode: push on memnode_worklist |
|
2839 |
// MergeMem: push on mergemem_worklist |
|
2840 |
// Phase 3: Process MergeMem nodes from mergemem_worklist. Walk each memory slice |
|
2841 |
// moving the first node encountered of each instance type to the |
|
2842 |
// the input corresponding to its alias index. |
|
2843 |
// appropriate memory slice. |
|
2844 |
// Phase 4: Update the inputs of non-instance memory Phis and the Memory input of memnodes. |
|
2845 |
// |
|
2846 |
// In the following example, the CheckCastPP nodes are the cast of allocation |
|
2847 |
// results and the allocation of node 29 is unescaped and eligible to be an |
|
2848 |
// instance type. |
|
2849 |
// |
|
2850 |
// We start with: |
|
2851 |
// |
|
2852 |
// 7 Parm #memory |
|
2853 |
// 10 ConI "12" |
|
2854 |
// 19 CheckCastPP "Foo" |
|
2855 |
// 20 AddP _ 19 19 10 Foo+12 alias_index=4 |
|
2856 |
// 29 CheckCastPP "Foo" |
|
2857 |
// 30 AddP _ 29 29 10 Foo+12 alias_index=4 |
|
2858 |
// |
|
2859 |
// 40 StoreP 25 7 20 ... alias_index=4 |
|
2860 |
// 50 StoreP 35 40 30 ... alias_index=4 |
|
2861 |
// 60 StoreP 45 50 20 ... alias_index=4 |
|
2862 |
// 70 LoadP _ 60 30 ... alias_index=4 |
|
2863 |
// 80 Phi 75 50 60 Memory alias_index=4 |
|
2864 |
// 90 LoadP _ 80 30 ... alias_index=4 |
|
2865 |
// 100 LoadP _ 80 20 ... alias_index=4 |
|
2866 |
// |
|
2867 |
// |
|
2868 |
// Phase 1 creates an instance type for node 29 assigning it an instance id of 24 |
|
2869 |
// and creating a new alias index for node 30. This gives: |
|
2870 |
// |
|
2871 |
// 7 Parm #memory |
|
2872 |
// 10 ConI "12" |
|
2873 |
// 19 CheckCastPP "Foo" |
|
2874 |
// 20 AddP _ 19 19 10 Foo+12 alias_index=4 |
|
2875 |
// 29 CheckCastPP "Foo" iid=24 |
|
2876 |
// 30 AddP _ 29 29 10 Foo+12 alias_index=6 iid=24 |
|
2877 |
// |
|
2878 |
// 40 StoreP 25 7 20 ... alias_index=4 |
|
2879 |
// 50 StoreP 35 40 30 ... alias_index=6 |
|
2880 |
// 60 StoreP 45 50 20 ... alias_index=4 |
|
2881 |
// 70 LoadP _ 60 30 ... alias_index=6 |
|
2882 |
// 80 Phi 75 50 60 Memory alias_index=4 |
|
2883 |
// 90 LoadP _ 80 30 ... alias_index=6 |
|
2884 |
// 100 LoadP _ 80 20 ... alias_index=4 |
|
2885 |
// |
|
2886 |
// In phase 2, new memory inputs are computed for the loads and stores, |
|
2887 |
// And a new version of the phi is created. In phase 4, the inputs to |
|
2888 |
// node 80 are updated and then the memory nodes are updated with the |
|
2889 |
// values computed in phase 2. This results in: |
|
2890 |
// |
|
2891 |
// 7 Parm #memory |
|
2892 |
// 10 ConI "12" |
|
2893 |
// 19 CheckCastPP "Foo" |
|
2894 |
// 20 AddP _ 19 19 10 Foo+12 alias_index=4 |
|
2895 |
// 29 CheckCastPP "Foo" iid=24 |
|
2896 |
// 30 AddP _ 29 29 10 Foo+12 alias_index=6 iid=24 |
|
2897 |
// |
|
2898 |
// 40 StoreP 25 7 20 ... alias_index=4 |
|
2899 |
// 50 StoreP 35 7 30 ... alias_index=6 |
|
2900 |
// 60 StoreP 45 40 20 ... alias_index=4 |
|
2901 |
// 70 LoadP _ 50 30 ... alias_index=6 |
|
2902 |
// 80 Phi 75 40 60 Memory alias_index=4 |
|
2903 |
// 120 Phi 75 50 50 Memory alias_index=6 |
|
2904 |
// 90 LoadP _ 120 30 ... alias_index=6 |
|
2905 |
// 100 LoadP _ 80 20 ... alias_index=4 |
|
2906 |
// |
|
30629
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
2907 |
void ConnectionGraph::split_unique_types(GrowableArray<Node *> &alloc_worklist, GrowableArray<ArrayCopyNode*> &arraycopy_worklist) { |
1 | 2908 |
GrowableArray<Node *> memnode_worklist; |
2909 |
GrowableArray<PhiNode *> orig_phis; |
|
7122 | 2910 |
PhaseIterGVN *igvn = _igvn; |
1 | 2911 |
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
|
2912 |
Arena* arena = Thread::current()->resource_area(); |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
2913 |
VectorSet visited(arena); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2914 |
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
|
2915 |
uint unique_old = _compile->unique(); |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2916 |
|
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2917 |
// Phase 1: Process possible allocations from alloc_worklist. |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2918 |
// Create instance types for the CheckCastPP for allocations where possible. |
952
38812d18eec0
6684714: Optimize EA Connection Graph build performance
kvn
parents:
769
diff
changeset
|
2919 |
// |
38812d18eec0
6684714: Optimize EA Connection Graph build performance
kvn
parents:
769
diff
changeset
|
2920 |
// (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
|
2921 |
// 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
|
2922 |
// see the comment in find_second_addp().) |
38812d18eec0
6684714: Optimize EA Connection Graph build performance
kvn
parents:
769
diff
changeset
|
2923 |
// |
1 | 2924 |
while (alloc_worklist.length() != 0) { |
2925 |
Node *n = alloc_worklist.pop(); |
|
2926 |
uint ni = n->_idx; |
|
2927 |
if (n->is_Call()) { |
|
2928 |
CallNode *alloc = n->as_Call(); |
|
2929 |
// copy escape information to call node |
|
952
38812d18eec0
6684714: Optimize EA Connection Graph build performance
kvn
parents:
769
diff
changeset
|
2930 |
PointsToNode* ptn = ptnode_adr(alloc->_idx); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2931 |
PointsToNode::EscapeState es = ptn->escape_state(); |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2932 |
// We have an allocation or call which returns a Java object, |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2933 |
// see if it is unescaped. |
10982
85bcf8ef9cc8
7059047: EA: can't find initializing store with several CheckCastPP
kvn
parents:
10970
diff
changeset
|
2934 |
if (es != PointsToNode::NoEscape || !ptn->scalar_replaceable()) |
1 | 2935 |
continue; |
2871
519e22b6900d
6836054: java/util/Arrays/CopyMethods.java fails on solaris-sparc with IllegalArgumentException
kvn
parents:
2131
diff
changeset
|
2936 |
// 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
|
2937 |
n = alloc->result_cast(); |
519e22b6900d
6836054: java/util/Arrays/CopyMethods.java fails on solaris-sparc with IllegalArgumentException
kvn
parents:
2131
diff
changeset
|
2938 |
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
|
2939 |
if (alloc->is_Allocate()) { |
519e22b6900d
6836054: java/util/Arrays/CopyMethods.java fails on solaris-sparc with IllegalArgumentException
kvn
parents:
2131
diff
changeset
|
2940 |
// 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
|
2941 |
// 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
|
2942 |
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
|
2943 |
} |
17383 | 2944 |
if (alloc->is_CallStaticJava()) { |
2945 |
// Set the scalar_replaceable flag for boxing method |
|
2946 |
// so it could be eliminated if it has no uses. |
|
2947 |
alloc->as_CallStaticJava()->_is_scalar_replaceable = true; |
|
2948 |
} |
|
2871
519e22b6900d
6836054: java/util/Arrays/CopyMethods.java fails on solaris-sparc with IllegalArgumentException
kvn
parents:
2131
diff
changeset
|
2949 |
continue; |
212
cd4963e67949
6667612: (Escape Analysis) disable loop cloning if it has a scalar replaceable allocation
kvn
parents:
211
diff
changeset
|
2950 |
} |
2871
519e22b6900d
6836054: java/util/Arrays/CopyMethods.java fails on solaris-sparc with IllegalArgumentException
kvn
parents:
2131
diff
changeset
|
2951 |
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
|
2952 |
assert(!alloc->is_Allocate(), "allocation should have unique type"); |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2953 |
continue; |
2871
519e22b6900d
6836054: java/util/Arrays/CopyMethods.java fails on solaris-sparc with IllegalArgumentException
kvn
parents:
2131
diff
changeset
|
2954 |
} |
519e22b6900d
6836054: java/util/Arrays/CopyMethods.java fails on solaris-sparc with IllegalArgumentException
kvn
parents:
2131
diff
changeset
|
2955 |
|
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2956 |
// The inline code for Object.clone() casts the allocation result to |
955 | 2957 |
// 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
|
2958 |
// object. Detect this case and use the second cast. |
955 | 2959 |
// Also detect j.l.reflect.Array.newInstance(jobject, jint) case when |
2960 |
// the allocation result is cast to java.lang.Object and then |
|
2961 |
// to the actual Array type. |
|
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2962 |
if (alloc->is_Allocate() && n->as_Type()->type() == TypeInstPtr::NOTNULL |
955 | 2963 |
&& (alloc->is_AllocateArray() || |
2964 |
igvn->type(alloc->in(AllocateNode::KlassNode)) != TypeKlassPtr::OBJECT)) { |
|
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2965 |
Node *cast2 = NULL; |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2966 |
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
|
2967 |
Node *use = n->fast_out(i); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2968 |
if (use->is_CheckCastPP()) { |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2969 |
cast2 = use; |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2970 |
break; |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2971 |
} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2972 |
} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2973 |
if (cast2 != NULL) { |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2974 |
n = cast2; |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2975 |
} else { |
2871
519e22b6900d
6836054: java/util/Arrays/CopyMethods.java fails on solaris-sparc with IllegalArgumentException
kvn
parents:
2131
diff
changeset
|
2976 |
// 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
|
2977 |
// (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
|
2978 |
// deoptimization without precise type. |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2979 |
continue; |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2980 |
} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
2981 |
} |
26917
c3574c0b2da0
8058825: EA: ConnectionGraph::split_unique_types does incorrect scalar replacement
vlivanov
parents:
26913
diff
changeset
|
2982 |
|
c3574c0b2da0
8058825: EA: ConnectionGraph::split_unique_types does incorrect scalar replacement
vlivanov
parents:
26913
diff
changeset
|
2983 |
const TypeOopPtr *t = igvn->type(n)->isa_oopptr(); |
c3574c0b2da0
8058825: EA: ConnectionGraph::split_unique_types does incorrect scalar replacement
vlivanov
parents:
26913
diff
changeset
|
2984 |
if (t == NULL) |
c3574c0b2da0
8058825: EA: ConnectionGraph::split_unique_types does incorrect scalar replacement
vlivanov
parents:
26913
diff
changeset
|
2985 |
continue; // not a TypeOopPtr |
c3574c0b2da0
8058825: EA: ConnectionGraph::split_unique_types does incorrect scalar replacement
vlivanov
parents:
26913
diff
changeset
|
2986 |
if (!t->klass_is_exact()) |
c3574c0b2da0
8058825: EA: ConnectionGraph::split_unique_types does incorrect scalar replacement
vlivanov
parents:
26913
diff
changeset
|
2987 |
continue; // not an unique type |
c3574c0b2da0
8058825: EA: ConnectionGraph::split_unique_types does incorrect scalar replacement
vlivanov
parents:
26913
diff
changeset
|
2988 |
|
2871
519e22b6900d
6836054: java/util/Arrays/CopyMethods.java fails on solaris-sparc with IllegalArgumentException
kvn
parents:
2131
diff
changeset
|
2989 |
if (alloc->is_Allocate()) { |
519e22b6900d
6836054: java/util/Arrays/CopyMethods.java fails on solaris-sparc with IllegalArgumentException
kvn
parents:
2131
diff
changeset
|
2990 |
// 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
|
2991 |
// so it could be eliminated. |
519e22b6900d
6836054: java/util/Arrays/CopyMethods.java fails on solaris-sparc with IllegalArgumentException
kvn
parents:
2131
diff
changeset
|
2992 |
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
|
2993 |
} |
17383 | 2994 |
if (alloc->is_CallStaticJava()) { |
2995 |
// Set the scalar_replaceable flag for boxing method |
|
2996 |
// so it could be eliminated. |
|
2997 |
alloc->as_CallStaticJava()->_is_scalar_replaceable = true; |
|
2998 |
} |
|
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
2999 |
set_escape_state(ptnode_adr(n->_idx), es); // CheckCastPP escape state |
955 | 3000 |
// 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
|
3001 |
// - a direct allocation (not a call returning an object) |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3002 |
// - non-escaping |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3003 |
// - eligible to be a unique type |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3004 |
// - 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
|
3005 |
set_map(alloc, n); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3006 |
set_map(n, alloc); |
26917
c3574c0b2da0
8058825: EA: ConnectionGraph::split_unique_types does incorrect scalar replacement
vlivanov
parents:
26913
diff
changeset
|
3007 |
const TypeOopPtr* tinst = t->cast_to_instance_id(ni); |
1 | 3008 |
igvn->hash_delete(n); |
3009 |
igvn->set_type(n, tinst); |
|
3010 |
n->raise_bottom_type(tinst); |
|
3011 |
igvn->hash_insert(n); |
|
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3012 |
record_for_optimizer(n); |
53706
b5b373bda814
8217990: C2 UseOptoBiasInlining: load of markword optimized to 0 if running with -XX:-EliminateLocks
roland
parents:
53288
diff
changeset
|
3013 |
// Allocate an alias index for the header fields. Accesses to |
b5b373bda814
8217990: C2 UseOptoBiasInlining: load of markword optimized to 0 if running with -XX:-EliminateLocks
roland
parents:
53288
diff
changeset
|
3014 |
// the header emitted during macro expansion wouldn't have |
b5b373bda814
8217990: C2 UseOptoBiasInlining: load of markword optimized to 0 if running with -XX:-EliminateLocks
roland
parents:
53288
diff
changeset
|
3015 |
// correct memory state otherwise. |
b5b373bda814
8217990: C2 UseOptoBiasInlining: load of markword optimized to 0 if running with -XX:-EliminateLocks
roland
parents:
53288
diff
changeset
|
3016 |
_compile->get_alias_index(tinst->add_offset(oopDesc::mark_offset_in_bytes())); |
b5b373bda814
8217990: C2 UseOptoBiasInlining: load of markword optimized to 0 if running with -XX:-EliminateLocks
roland
parents:
53288
diff
changeset
|
3017 |
_compile->get_alias_index(tinst->add_offset(oopDesc::klass_offset_in_bytes())); |
10982
85bcf8ef9cc8
7059047: EA: can't find initializing store with several CheckCastPP
kvn
parents:
10970
diff
changeset
|
3018 |
if (alloc->is_Allocate() && (t->isa_instptr() || t->isa_aryptr())) { |
589 | 3019 |
|
3020 |
// 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
|
3021 |
// 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
|
3022 |
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
|
3023 |
PointsToNode* tgt = e.get(); |
30629
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3024 |
if (tgt->is_Arraycopy()) { |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3025 |
continue; |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3026 |
} |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3027 |
Node* use = tgt->ideal_node(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3028 |
assert(tgt->is_Field() && use->is_AddP(), |
589 | 3029 |
"only AddP nodes are Field edges in CG"); |
3030 |
if (use->outcnt() > 0) { // Don't process dead nodes |
|
3031 |
Node* addp2 = find_second_addp(use, use->in(AddPNode::Base)); |
|
3032 |
if (addp2 != NULL) { |
|
3033 |
assert(alloc->is_AllocateArray(),"array allocation was expected"); |
|
3034 |
alloc_worklist.append_if_missing(addp2); |
|
3035 |
} |
|
3036 |
alloc_worklist.append_if_missing(use); |
|
3037 |
} |
|
3038 |
} |
|
3039 |
||
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3040 |
// An allocation may have an Initialize which has raw stores. Scan |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3041 |
// the users of the raw allocation result and push AddP users |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3042 |
// on alloc_worklist. |
48595
5d699d81c10c
8194988: 8 Null pointer dereference defect groups related to MultiNode::proj_out()
dlong
parents:
47216
diff
changeset
|
3043 |
Node *raw_result = alloc->proj_out_or_null(TypeFunc::Parms); |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3044 |
assert (raw_result != NULL, "must have an allocation result"); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3045 |
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
|
3046 |
Node *use = raw_result->fast_out(i); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3047 |
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
|
3048 |
Node* addp2 = find_second_addp(use, raw_result); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3049 |
if (addp2 != NULL) { |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3050 |
assert(alloc->is_AllocateArray(),"array allocation was expected"); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3051 |
alloc_worklist.append_if_missing(addp2); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3052 |
} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3053 |
alloc_worklist.append_if_missing(use); |
4470
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3054 |
} else if (use->is_MemBar()) { |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3055 |
memnode_worklist.append_if_missing(use); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3056 |
} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3057 |
} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3058 |
} |
1 | 3059 |
} else if (n->is_AddP()) { |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3060 |
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
|
3061 |
if (jobj == NULL || jobj == phantom_obj) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3062 |
#ifdef ASSERT |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3063 |
ptnode_adr(get_addp_base(n)->_idx)->dump(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3064 |
ptnode_adr(n->_idx)->dump(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3065 |
assert(jobj != NULL && jobj != phantom_obj, "escaped allocation"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3066 |
#endif |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3067 |
_compile->record_failure(C2Compiler::retry_no_escape_analysis()); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3068 |
return; |
4470
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3069 |
} |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3070 |
Node *base = get_map(jobj->idx()); // CheckCastPP node |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3071 |
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
|
3072 |
} else if (n->is_Phi() || |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3073 |
n->is_CheckCastPP() || |
594
9f4474e5dbaf
6705887: Compressed Oops: generate x64 addressing and implicit null checks with narrow oops
kvn
parents:
590
diff
changeset
|
3074 |
n->is_EncodeP() || |
9f4474e5dbaf
6705887: Compressed Oops: generate x64 addressing and implicit null checks with narrow oops
kvn
parents:
590
diff
changeset
|
3075 |
n->is_DecodeN() || |
52568 | 3076 |
BarrierSet::barrier_set()->barrier_set_c2()->escape_is_barrier_node(n) || |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3077 |
(n->is_ConstraintCast() && n->Opcode() == Op_CastPP)) { |
1 | 3078 |
if (visited.test_set(n->_idx)) { |
3079 |
assert(n->is_Phi(), "loops only through Phi's"); |
|
3080 |
continue; // already processed |
|
3081 |
} |
|
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3082 |
JavaObjectNode* jobj = unique_java_object(n); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3083 |
if (jobj == NULL || jobj == phantom_obj) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3084 |
#ifdef ASSERT |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3085 |
ptnode_adr(n->_idx)->dump(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3086 |
assert(jobj != NULL && jobj != phantom_obj, "escaped allocation"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3087 |
#endif |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3088 |
_compile->record_failure(C2Compiler::retry_no_escape_analysis()); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3089 |
return; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3090 |
} else { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3091 |
Node *val = get_map(jobj->idx()); // CheckCastPP node |
1 | 3092 |
TypeNode *tn = n->as_Type(); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3093 |
const TypeOopPtr* tinst = igvn->type(val)->isa_oopptr(); |
769 | 3094 |
assert(tinst != NULL && tinst->is_known_instance() && |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3095 |
tinst->instance_id() == jobj->idx() , "instance type expected."); |
589 | 3096 |
|
3097 |
const Type *tn_type = igvn->type(tn); |
|
769 | 3098 |
const TypeOopPtr *tn_t; |
3099 |
if (tn_type->isa_narrowoop()) { |
|
3100 |
tn_t = tn_type->make_ptr()->isa_oopptr(); |
|
3101 |
} else { |
|
3102 |
tn_t = tn_type->isa_oopptr(); |
|
3103 |
} |
|
4470
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3104 |
if (tn_t != NULL && tinst->klass()->is_subtype_of(tn_t->klass())) { |
589 | 3105 |
if (tn_type->isa_narrowoop()) { |
3106 |
tn_type = tinst->make_narrowoop(); |
|
3107 |
} else { |
|
3108 |
tn_type = tinst; |
|
3109 |
} |
|
1 | 3110 |
igvn->hash_delete(tn); |
589 | 3111 |
igvn->set_type(tn, tn_type); |
3112 |
tn->set_type(tn_type); |
|
1 | 3113 |
igvn->hash_insert(tn); |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3114 |
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
|
3115 |
} else { |
4470
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3116 |
assert(tn_type == TypePtr::NULL_PTR || |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3117 |
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
|
3118 |
"unexpected type"); |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3119 |
continue; // Skip dead path with different type |
1 | 3120 |
} |
3121 |
} |
|
3122 |
} else { |
|
4470
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3123 |
debug_only(n->dump();) |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3124 |
assert(false, "EA: unexpected node"); |
1 | 3125 |
continue; |
3126 |
} |
|
4470
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3127 |
// push allocation's users on appropriate worklist |
1 | 3128 |
for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) { |
3129 |
Node *use = n->fast_out(i); |
|
3130 |
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
|
3131 |
// Load/store to instance's field |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3132 |
memnode_worklist.append_if_missing(use); |
4470
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3133 |
} else if (use->is_MemBar()) { |
17383 | 3134 |
if (use->in(TypeFunc::Memory) == n) { // Ignore precedent edge |
3135 |
memnode_worklist.append_if_missing(use); |
|
3136 |
} |
|
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3137 |
} else if (use->is_AddP() && use->outcnt() > 0) { // No dead nodes |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3138 |
Node* addp2 = find_second_addp(use, n); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3139 |
if (addp2 != NULL) { |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3140 |
alloc_worklist.append_if_missing(addp2); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3141 |
} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3142 |
alloc_worklist.append_if_missing(use); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3143 |
} else if (use->is_Phi() || |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3144 |
use->is_CheckCastPP() || |
13969
d2a189b83b87
7054512: Compress class pointers after perm gen removal
roland
parents:
13886
diff
changeset
|
3145 |
use->is_EncodeNarrowPtr() || |
d2a189b83b87
7054512: Compress class pointers after perm gen removal
roland
parents:
13886
diff
changeset
|
3146 |
use->is_DecodeNarrowPtr() || |
52568 | 3147 |
BarrierSet::barrier_set()->barrier_set_c2()->escape_is_barrier_node(use) || |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3148 |
(use->is_ConstraintCast() && use->Opcode() == Op_CastPP)) { |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3149 |
alloc_worklist.append_if_missing(use); |
4470
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3150 |
#ifdef ASSERT |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3151 |
} else if (use->is_Mem()) { |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3152 |
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
|
3153 |
} else if (use->is_MergeMem()) { |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3154 |
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
|
3155 |
} else if (use->is_SafePoint()) { |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3156 |
// 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
|
3157 |
// (through CheckCastPP nodes) even for debug info. |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3158 |
Node* m = use->in(TypeFunc::Memory); |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3159 |
if (m->is_MergeMem()) { |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3160 |
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
|
3161 |
} |
15242
695bb216be99
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
14623
diff
changeset
|
3162 |
} else if (use->Opcode() == Op_EncodeISOArray) { |
695bb216be99
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
14623
diff
changeset
|
3163 |
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
|
3164 |
// EncodeISOArray overwrites destination array |
695bb216be99
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
14623
diff
changeset
|
3165 |
memnode_worklist.append_if_missing(use); |
695bb216be99
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
14623
diff
changeset
|
3166 |
} |
4470
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3167 |
} else { |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3168 |
uint op = use->Opcode(); |
40083
17565e6c55a0
8161651: Logic in ConnectionGraph::split_unique_types() wrongly assumes node always have memory input
roland
parents:
38677
diff
changeset
|
3169 |
if ((op == Op_StrCompressedCopy || op == Op_StrInflatedCopy) && |
17565e6c55a0
8161651: Logic in ConnectionGraph::split_unique_types() wrongly assumes node always have memory input
roland
parents:
38677
diff
changeset
|
3170 |
(use->in(MemNode::Memory) == n)) { |
33628 | 3171 |
// They overwrite memory edge corresponding to destination array, |
3172 |
memnode_worklist.append_if_missing(use); |
|
3173 |
} 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
|
3174 |
op == Op_CastP2X || op == Op_StoreCM || |
33628 | 3175 |
op == Op_FastLock || op == Op_AryEq || op == Op_StrComp || op == Op_HasNegatives || |
3176 |
op == Op_StrCompressedCopy || op == Op_StrInflatedCopy || |
|
50525
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
50180
diff
changeset
|
3177 |
op == Op_StrEquals || op == Op_StrIndexOf || op == Op_StrIndexOfChar || |
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
50180
diff
changeset
|
3178 |
BarrierSet::barrier_set()->barrier_set_c2()->is_gc_barrier_node(use))) { |
4470
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3179 |
n->dump(); |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3180 |
use->dump(); |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3181 |
assert(false, "EA: missing allocation reference path"); |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3182 |
} |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3183 |
#endif |
1 | 3184 |
} |
3185 |
} |
|
3186 |
||
3187 |
} |
|
30629
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3188 |
|
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3189 |
// 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
|
3190 |
// 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
|
3191 |
// node uses/modified. |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3192 |
for (int next = 0; next < arraycopy_worklist.length(); next++) { |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3193 |
ArrayCopyNode* ac = arraycopy_worklist.at(next); |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3194 |
Node* dest = ac->in(ArrayCopyNode::Dest); |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3195 |
if (dest->is_AddP()) { |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3196 |
dest = get_addp_base(dest); |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3197 |
} |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3198 |
JavaObjectNode* jobj = unique_java_object(dest); |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3199 |
if (jobj != NULL) { |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3200 |
Node *base = get_map(jobj->idx()); |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3201 |
if (base != NULL) { |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3202 |
const TypeOopPtr *base_t = _igvn->type(base)->isa_oopptr(); |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3203 |
ac->_dest_type = base_t; |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3204 |
} |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3205 |
} |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3206 |
Node* src = ac->in(ArrayCopyNode::Src); |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3207 |
if (src->is_AddP()) { |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3208 |
src = get_addp_base(src); |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3209 |
} |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3210 |
jobj = unique_java_object(src); |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3211 |
if (jobj != NULL) { |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3212 |
Node* base = get_map(jobj->idx()); |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3213 |
if (base != NULL) { |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3214 |
const TypeOopPtr *base_t = _igvn->type(base)->isa_oopptr(); |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3215 |
ac->_src_type = base_t; |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3216 |
} |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3217 |
} |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3218 |
} |
b6e5ad2f18d5
8076188: Optimize arraycopy out for non escaping destination
roland
parents:
29086
diff
changeset
|
3219 |
|
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3220 |
// New alias types were created in split_AddP(). |
1 | 3221 |
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
|
3222 |
assert(unique_old == _compile->unique(), "there should be no new ideal nodes after Phase 1"); |
1 | 3223 |
|
3224 |
// Phase 2: Process MemNode's from memnode_worklist. compute new address type and |
|
3225 |
// compute new values for Memory inputs (the Memory inputs are not |
|
3226 |
// actually updated until phase 4.) |
|
3227 |
if (memnode_worklist.length() == 0) |
|
3228 |
return; // nothing to do |
|
3229 |
while (memnode_worklist.length() != 0) { |
|
3230 |
Node *n = memnode_worklist.pop(); |
|
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3231 |
if (visited.test_set(n->_idx)) |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3232 |
continue; |
4470
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3233 |
if (n->is_Phi() || n->is_ClearArray()) { |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3234 |
// 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
|
3235 |
} 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
|
3236 |
// we don't need to do anything, but the users must be pushed |
48595
5d699d81c10c
8194988: 8 Null pointer dereference defect groups related to MultiNode::proj_out()
dlong
parents:
47216
diff
changeset
|
3237 |
n = n->as_MemBar()->proj_out_or_null(TypeFunc::Memory); |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3238 |
if (n == NULL) |
1 | 3239 |
continue; |
33628 | 3240 |
} else if (n->Opcode() == Op_StrCompressedCopy || |
3241 |
n->Opcode() == Op_EncodeISOArray) { |
|
15242
695bb216be99
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
14623
diff
changeset
|
3242 |
// get the memory projection |
28643
a665e19ca007
8066312: Add new Node* Node::find_out(int opc) method.
zmajo
parents:
27919
diff
changeset
|
3243 |
n = n->find_out_with(Op_SCMemProj); |
48857
23a07b0cf8a6
8194987: Null pointer dereference in escape.cpp related to Node::find_out_with()
dlong
parents:
48595
diff
changeset
|
3244 |
assert(n != NULL && n->Opcode() == Op_SCMemProj, "memory projection required"); |
1 | 3245 |
} else { |
3246 |
assert(n->is_Mem(), "memory node required."); |
|
3247 |
Node *addr = n->in(MemNode::Address); |
|
3248 |
const Type *addr_t = igvn->type(addr); |
|
3249 |
if (addr_t == Type::TOP) |
|
3250 |
continue; |
|
3251 |
assert (addr_t->isa_ptr() != NULL, "pointer type required."); |
|
3252 |
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
|
3253 |
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
|
3254 |
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
|
3255 |
if (_compile->failing()) { |
e2b60448c234
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
1
diff
changeset
|
3256 |
return; |
e2b60448c234
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
1
diff
changeset
|
3257 |
} |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3258 |
if (mem != n->in(MemNode::Memory)) { |
4471
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
3259 |
// 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
|
3260 |
// 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
|
3261 |
set_map(n, mem); |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3262 |
} |
1 | 3263 |
if (n->is_Load()) { |
3264 |
continue; // don't push users |
|
3265 |
} else if (n->is_LoadStore()) { |
|
3266 |
// get the memory projection |
|
28643
a665e19ca007
8066312: Add new Node* Node::find_out(int opc) method.
zmajo
parents:
27919
diff
changeset
|
3267 |
n = n->find_out_with(Op_SCMemProj); |
48857
23a07b0cf8a6
8194987: Null pointer dereference in escape.cpp related to Node::find_out_with()
dlong
parents:
48595
diff
changeset
|
3268 |
assert(n != NULL && n->Opcode() == Op_SCMemProj, "memory projection required"); |
1 | 3269 |
} |
3270 |
} |
|
3271 |
// push user on appropriate worklist |
|
3272 |
for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) { |
|
3273 |
Node *use = n->fast_out(i); |
|
4470
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3274 |
if (use->is_Phi() || use->is_ClearArray()) { |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3275 |
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
|
3276 |
} 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
|
3277 |
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
|
3278 |
continue; |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3279 |
memnode_worklist.append_if_missing(use); |
4470
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3280 |
} else if (use->is_MemBar()) { |
17383 | 3281 |
if (use->in(TypeFunc::Memory) == n) { // Ignore precedent edge |
3282 |
memnode_worklist.append_if_missing(use); |
|
3283 |
} |
|
4470
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3284 |
#ifdef ASSERT |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3285 |
} else if(use->is_Mem()) { |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3286 |
assert(use->in(MemNode::Memory) != n, "EA: missing memory path"); |
1 | 3287 |
} else if (use->is_MergeMem()) { |
4470
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3288 |
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
|
3289 |
} else if (use->Opcode() == Op_EncodeISOArray) { |
695bb216be99
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
14623
diff
changeset
|
3290 |
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
|
3291 |
// EncodeISOArray overwrites destination array |
695bb216be99
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
14623
diff
changeset
|
3292 |
memnode_worklist.append_if_missing(use); |
695bb216be99
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
14623
diff
changeset
|
3293 |
} |
4470
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3294 |
} else { |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3295 |
uint op = use->Opcode(); |
33628 | 3296 |
if ((use->in(MemNode::Memory) == n) && |
3297 |
(op == Op_StrCompressedCopy || op == Op_StrInflatedCopy)) { |
|
3298 |
// They overwrite memory edge corresponding to destination array, |
|
3299 |
memnode_worklist.append_if_missing(use); |
|
50180 | 3300 |
} else if (!(BarrierSet::barrier_set()->barrier_set_c2()->is_gc_barrier_node(use) || |
33628 | 3301 |
op == Op_AryEq || op == Op_StrComp || op == Op_HasNegatives || |
3302 |
op == Op_StrCompressedCopy || op == Op_StrInflatedCopy || |
|
3303 |
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
|
3304 |
n->dump(); |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3305 |
use->dump(); |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3306 |
assert(false, "EA: missing memory path"); |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3307 |
} |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3308 |
#endif |
1 | 3309 |
} |
3310 |
} |
|
3311 |
} |
|
3312 |
||
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3313 |
// 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
|
3314 |
// 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
|
3315 |
// 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
|
3316 |
uint length = _mergemem_worklist.length(); |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3317 |
for( uint next = 0; next < length; ++next ) { |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3318 |
MergeMemNode* nmm = _mergemem_worklist.at(next); |
1e6edcab3109
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
4442
diff
changeset
|
3319 |
assert(!visited.test_set(nmm->_idx), "should not be visited before"); |
1 | 3320 |
// 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
|
3321 |
// 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
|
3322 |
// 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
|
3323 |
// 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
|
3324 |
igvn->hash_delete(nmm); |
32579
268acc7bc111
8134031: Incorrect JIT compilation of complex code with inlining and escape analysis
roland
parents:
31866
diff
changeset
|
3325 |
uint nslices = MIN2(nmm->req(), new_index_start); |
1 | 3326 |
for (uint i = Compile::AliasIdxRaw+1; i < nslices; i++) { |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3327 |
Node* mem = nmm->in(i); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3328 |
Node* cur = NULL; |
1 | 3329 |
if (mem == NULL || mem->is_top()) |
3330 |
continue; |
|
4471
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
3331 |
// 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
|
3332 |
// if their type became more precise since this mergemem was created. |
1 | 3333 |
while (mem->is_Mem()) { |
3334 |
const Type *at = igvn->type(mem->in(MemNode::Address)); |
|
3335 |
if (at != Type::TOP) { |
|
3336 |
assert (at->isa_ptr() != NULL, "pointer type required."); |
|
3337 |
uint idx = (uint)_compile->get_alias_index(at->is_ptr()); |
|
3338 |
if (idx == i) { |
|
3339 |
if (cur == NULL) |
|
3340 |
cur = mem; |
|
3341 |
} else { |
|
3342 |
if (idx >= nmm->req() || nmm->is_empty_memory(nmm->in(idx))) { |
|
3343 |
nmm->set_memory_at(idx, mem); |
|
3344 |
} |
|
3345 |
} |
|
3346 |
} |
|
3347 |
mem = mem->in(MemNode::Memory); |
|
3348 |
} |
|
3349 |
nmm->set_memory_at(i, (cur != NULL) ? cur : mem); |
|
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3350 |
// 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
|
3351 |
// 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
|
3352 |
for (uint ni = new_index_start; ni < new_index_end; ni++) { |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3353 |
if((uint)_compile->get_general_index(ni) == i) { |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3354 |
Node *m = (ni >= nmm->req()) ? nmm->empty_memory() : nmm->in(ni); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3355 |
if (nmm->is_empty_memory(m)) { |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3356 |
Node* result = find_inst_mem(mem, ni, orig_phis); |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3357 |
if (_compile->failing()) { |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3358 |
return; |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3359 |
} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3360 |
nmm->set_memory_at(ni, result); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3361 |
} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3362 |
} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3363 |
} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3364 |
} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3365 |
// Find the rest of instances values |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3366 |
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
|
3367 |
const TypeOopPtr *tinst = _compile->get_adr_type(ni)->isa_oopptr(); |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3368 |
Node* result = step_through_mergemem(nmm, ni, tinst); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3369 |
if (result == nmm->base_memory()) { |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3370 |
// 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
|
3371 |
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
|
3372 |
result = find_inst_mem(result, ni, orig_phis); |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3373 |
if (_compile->failing()) { |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3374 |
return; |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3375 |
} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3376 |
nmm->set_memory_at(ni, result); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3377 |
} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3378 |
} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3379 |
igvn->hash_insert(nmm); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3380 |
record_for_optimizer(nmm); |
1 | 3381 |
} |
3382 |
||
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3383 |
// Phase 4: Update the inputs of non-instance memory Phis and |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3384 |
// the Memory input of memnodes |
1 | 3385 |
// First update the inputs of any non-instance Phi's from |
3386 |
// which we split out an instance Phi. Note we don't have |
|
3387 |
// to recursively process Phi's encounted on the input memory |
|
3388 |
// chains as is done in split_memory_phi() since they will |
|
3389 |
// also be processed here. |
|
955 | 3390 |
for (int j = 0; j < orig_phis.length(); j++) { |
3391 |
PhiNode *phi = orig_phis.at(j); |
|
1 | 3392 |
int alias_idx = _compile->get_alias_index(phi->adr_type()); |
3393 |
igvn->hash_delete(phi); |
|
3394 |
for (uint i = 1; i < phi->req(); i++) { |
|
3395 |
Node *mem = phi->in(i); |
|
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3396 |
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
|
3397 |
if (_compile->failing()) { |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3398 |
return; |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3399 |
} |
1 | 3400 |
if (mem != new_mem) { |
3401 |
phi->set_req(i, new_mem); |
|
3402 |
} |
|
3403 |
} |
|
3404 |
igvn->hash_insert(phi); |
|
3405 |
record_for_optimizer(phi); |
|
3406 |
} |
|
3407 |
||
3408 |
// 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
|
3409 |
// 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
|
3410 |
// 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
|
3411 |
// 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
|
3412 |
#if 0 // ifdef ASSERT |
8319 | 3413 |
visited.Reset(); |
4471
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
3414 |
Node_Stack old_mems(arena, _compile->unique() >> 2); |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
3415 |
#endif |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3416 |
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
|
3417 |
Node* n = ideal_nodes.at(i); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3418 |
Node* nmem = get_map(n->_idx); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3419 |
assert(nmem != NULL, "sanity"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3420 |
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
|
3421 |
#if 0 // ifdef ASSERT |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3422 |
Node* old_mem = n->in(MemNode::Memory); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3423 |
if (!visited.test_set(old_mem->_idx)) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3424 |
old_mems.push(old_mem, old_mem->outcnt()); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3425 |
} |
4471
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
3426 |
#endif |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3427 |
assert(n->in(MemNode::Memory) != nmem, "sanity"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3428 |
if (!n->is_Load()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3429 |
// Move memory users of a store first. |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3430 |
move_inst_mem(n, orig_phis); |
1 | 3431 |
} |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3432 |
// Now update memory input |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3433 |
igvn->hash_delete(n); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3434 |
n->set_req(MemNode::Memory, nmem); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3435 |
igvn->hash_insert(n); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3436 |
record_for_optimizer(n); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3437 |
} else { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3438 |
assert(n->is_Allocate() || n->is_CheckCastPP() || |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3439 |
n->is_AddP() || n->is_Phi(), "unknown node used for set_map()"); |
1 | 3440 |
} |
3441 |
} |
|
9327
23532ae85295
7026700: regression in 6u24-rev-b23: Crash in C2 compiler in PhaseIdealLoop::build_loop_late_post
kvn
parents:
9115
diff
changeset
|
3442 |
#if 0 // ifdef ASSERT |
4471
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
3443 |
// Verify that memory was split correctly |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
3444 |
while (old_mems.is_nonempty()) { |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
3445 |
Node* old_mem = old_mems.node(); |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
3446 |
uint old_cnt = old_mems.index(); |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
3447 |
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
|
3448 |
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
|
3449 |
} |
78c7cc2ae5dd
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
4470
diff
changeset
|
3450 |
#endif |
1 | 3451 |
} |
3452 |
||
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3453 |
#ifndef PRODUCT |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3454 |
static const char *node_type_names[] = { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3455 |
"UnknownType", |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3456 |
"JavaObject", |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3457 |
"LocalVar", |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3458 |
"Field", |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3459 |
"Arraycopy" |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3460 |
}; |
11781
f99a70966575
7129284: +DoEscapeAnalysis regression w/ early build of 7u4 (HotSpot 23) on Linux
kvn
parents:
11445
diff
changeset
|
3461 |
|
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3462 |
static const char *esc_names[] = { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3463 |
"UnknownEscape", |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3464 |
"NoEscape", |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3465 |
"ArgEscape", |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3466 |
"GlobalEscape" |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3467 |
}; |
1 | 3468 |
|
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3469 |
void PointsToNode::dump(bool print_state) const { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3470 |
NodeType nt = node_type(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3471 |
tty->print("%s ", node_type_names[(int) nt]); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3472 |
if (print_state) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3473 |
EscapeState es = escape_state(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3474 |
EscapeState fields_es = fields_escape_state(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3475 |
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
|
3476 |
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
|
3477 |
tty->print("NSR "); |
11189 | 3478 |
} |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3479 |
if (is_Field()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3480 |
FieldNode* f = (FieldNode*)this; |
14395
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
3481 |
if (f->is_oop()) |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
3482 |
tty->print("oop "); |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
3483 |
if (f->offset() > 0) |
2395da512d6b
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
14133
diff
changeset
|
3484 |
tty->print("+%d ", f->offset()); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3485 |
tty->print("("); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3486 |
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
|
3487 |
PointsToNode* b = i.get(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3488 |
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
|
3489 |
} |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3490 |
tty->print(" )"); |
1 | 3491 |
} |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3492 |
tty->print("["); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3493 |
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
|
3494 |
PointsToNode* e = i.get(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3495 |
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
|
3496 |
} |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3497 |
tty->print(" ["); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3498 |
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
|
3499 |
PointsToNode* u = i.get(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3500 |
bool is_base = false; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3501 |
if (PointsToNode::is_base_use(u)) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3502 |
is_base = true; |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3503 |
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
|
3504 |
} |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3505 |
tty->print(" %d%s%s", u->idx(), is_base ? "b" : "", u->is_Arraycopy() ? "cp" : ""); |
11189 | 3506 |
} |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3507 |
tty->print(" ]] "); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3508 |
if (_node == NULL) |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3509 |
tty->print_cr("<null>"); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3510 |
else |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3511 |
_node->dump(); |
11189 | 3512 |
} |
3513 |
||
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3514 |
void ConnectionGraph::dump(GrowableArray<PointsToNode*>& ptnodes_worklist) { |
1 | 3515 |
bool first = true; |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3516 |
int ptnodes_length = ptnodes_worklist.length(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3517 |
for (int i = 0; i < ptnodes_length; i++) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3518 |
PointsToNode *ptn = ptnodes_worklist.at(i); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3519 |
if (ptn == NULL || !ptn->is_JavaObject()) |
1 | 3520 |
continue; |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3521 |
PointsToNode::EscapeState es = ptn->escape_state(); |
17383 | 3522 |
if ((es != PointsToNode::NoEscape) && !Verbose) { |
3523 |
continue; |
|
3524 |
} |
|
3525 |
Node* n = ptn->ideal_node(); |
|
3526 |
if (n->is_Allocate() || (n->is_CallStaticJava() && |
|
3527 |
n->as_CallStaticJava()->is_boxing_method())) { |
|
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3528 |
if (first) { |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3529 |
tty->cr(); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3530 |
tty->print("======== Connection graph for "); |
952
38812d18eec0
6684714: Optimize EA Connection Graph build performance
kvn
parents:
769
diff
changeset
|
3531 |
_compile->method()->print_short_name(); |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3532 |
tty->cr(); |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3533 |
first = false; |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3534 |
} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3535 |
ptn->dump(); |
12158
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3536 |
// 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
|
3537 |
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
|
3538 |
PointsToNode* use = j.get(); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3539 |
if (use->is_LocalVar()) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3540 |
use->dump(Verbose); |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3541 |
} else if (Verbose) { |
f24f2560da32
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
11959
diff
changeset
|
3542 |
use->dump(); |
238
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3543 |
} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3544 |
} |
803c80713999
6674588: (Escape Analysis) Improve Escape Analysis code
kvn
parents:
212
diff
changeset
|
3545 |
tty->cr(); |
1 | 3546 |
} |
3547 |
} |
|
3548 |
} |
|
3549 |
#endif |
|
52568 | 3550 |
|
3551 |
void ConnectionGraph::record_for_optimizer(Node *n) { |
|
3552 |
_igvn->_worklist.push(n); |
|
3553 |
_igvn->add_users_to_worklist(n); |
|
3554 |
} |