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