Mercurial > hg > truffle
annotate src/share/vm/opto/escape.cpp @ 21201:5b913e452629
AMD64SpillMoveFactory: implement #createStackMove.
author | Josef Eisl <josef.eisl@jku.at> |
---|---|
date | Wed, 29 Apr 2015 13:19:43 +0200 |
parents | 7848fc12602b |
children |
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:
14202
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(); |
20688
f913964f3fde
8066199: C2 escape analysis prevents VM from exiting quickly
kvn
parents:
20671
diff
changeset
|
1109 // Poll for requests from shutdown mechanism to quiesce compiler |
f913964f3fde
8066199: C2 escape analysis prevents VM from exiting quickly
kvn
parents:
20671
diff
changeset
|
1110 // because Connection graph construction may take long time. |
f913964f3fde
8066199: C2 escape analysis prevents VM from exiting quickly
kvn
parents:
20671
diff
changeset
|
1111 CompileBroker::maybe_block(); |
20585
90297adbda9d
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
20572
diff
changeset
|
1112 double stop_time = time.seconds(); |
90297adbda9d
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
20572
diff
changeset
|
1113 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
|
1114 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
|
1115 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
|
1116 timeout = true; |
90297adbda9d
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
20572
diff
changeset
|
1117 break; // Timeout |
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 start_time = stop_time; |
90297adbda9d
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
20572
diff
changeset
|
1120 time.start(); |
90297adbda9d
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
20572
diff
changeset
|
1121 } |
90297adbda9d
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
20572
diff
changeset
|
1122 #undef SAMPLE_SIZE |
90297adbda9d
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
20572
diff
changeset
|
1123 |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1124 } |
20585
90297adbda9d
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
20572
diff
changeset
|
1125 if (timeout) break; |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1126 if (new_edges > 0) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1127 // 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
|
1128 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
|
1129 return false; // Nothing to do. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1130 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1131 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1132 time.stop(); |
20585
90297adbda9d
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
20572
diff
changeset
|
1133 if (time.seconds() >= EscapeAnalysisTimeout) { |
90297adbda9d
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
20572
diff
changeset
|
1134 timeout = true; |
90297adbda9d
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
20572
diff
changeset
|
1135 break; |
90297adbda9d
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
20572
diff
changeset
|
1136 } |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1137 } |
20585
90297adbda9d
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
20572
diff
changeset
|
1138 if ((iterations < CG_BUILD_ITER_LIMIT) && !timeout) { |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1139 time.start(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1140 // Find fields which have unknown value. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1141 int fields_length = oop_fields_worklist.length(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1142 for (int next = 0; next < fields_length; next++) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1143 FieldNode* field = oop_fields_worklist.at(next); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1144 if (field->edge_count() == 0) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1145 new_edges += find_field_value(field); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1146 // 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
|
1147 // 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
|
1148 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1149 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1150 time.stop(); |
20585
90297adbda9d
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
20572
diff
changeset
|
1151 if (time.seconds() >= EscapeAnalysisTimeout) { |
90297adbda9d
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
20572
diff
changeset
|
1152 timeout = true; |
90297adbda9d
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
20572
diff
changeset
|
1153 break; |
90297adbda9d
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
20572
diff
changeset
|
1154 } |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1155 } else { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1156 new_edges = 0; // Bailout |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1157 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1158 } while (new_edges > 0); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1159 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1160 // Bailout if passed limits. |
20585
90297adbda9d
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
20572
diff
changeset
|
1161 if ((iterations >= CG_BUILD_ITER_LIMIT) || timeout) { |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1162 Compile* C = _compile; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1163 if (C->log() != NULL) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1164 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
|
1165 C->log()->text("%s", timeout ? "time" : "iterations"); |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1166 C->log()->end_elem(" limit'"); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1167 } |
6895
006174cfe979
7163534: VM could crashes assert(false) failed: infinite EA connection graph build
kvn
parents:
6894
diff
changeset
|
1168 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
|
1169 time.seconds(), iterations, nodes_size(), ptnodes_worklist.length())); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1170 // Possible infinite build_connection_graph loop, |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1171 // bailout (no changes to ideal graph were made). |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1172 return false; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1173 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1174 #ifdef ASSERT |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1175 if (Verbose && PrintEscapeAnalysis) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1176 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
|
1177 iterations, nodes_size(), ptnodes_worklist.length()); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1178 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1179 #endif |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1180 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1181 #undef CG_BUILD_ITER_LIMIT |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1182 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1183 // 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
|
1184 int non_escaped_length = non_escaped_worklist.length(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1185 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
|
1186 JavaObjectNode* ptn = non_escaped_worklist.at(next); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1187 PointsToNode::EscapeState es = ptn->escape_state(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1188 assert(es <= PointsToNode::ArgEscape, "sanity"); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1189 if (es == PointsToNode::NoEscape) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1190 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
|
1191 // 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
|
1192 // 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
|
1193 add_java_object_edges(null_obj, false); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1194 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1195 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1196 Node* n = ptn->ideal_node(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1197 if (n->is_Allocate()) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1198 // 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
|
1199 // 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
|
1200 // expanded no MemBarStoreStore is added. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1201 InitializeNode* ini = n->as_Allocate()->initialization(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1202 if (ini != NULL) |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1203 ini->set_does_not_escape(); |
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 return true; // Finished graph construction. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1207 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1208 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1209 // 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
|
1210 // 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
|
1211 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
|
1212 GrowableArray<JavaObjectNode*>& non_escaped_worklist) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1213 GrowableArray<PointsToNode*> escape_worklist; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1214 // 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
|
1215 int ptnodes_length = ptnodes_worklist.length(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1216 for (int next = 0; next < ptnodes_length; ++next) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1217 PointsToNode* ptn = ptnodes_worklist.at(next); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1218 if (ptn->escape_state() >= PointsToNode::ArgEscape || |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1219 ptn->fields_escape_state() >= PointsToNode::ArgEscape) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1220 escape_worklist.push(ptn); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1221 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1222 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1223 // Set escape states to referenced nodes (edges list). |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1224 while (escape_worklist.length() > 0) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1225 PointsToNode* ptn = escape_worklist.pop(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1226 PointsToNode::EscapeState es = ptn->escape_state(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1227 PointsToNode::EscapeState field_es = ptn->fields_escape_state(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1228 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
|
1229 es >= PointsToNode::ArgEscape) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1230 // 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
|
1231 if (add_edge(ptn, phantom_obj)) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1232 // New edge was added |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1233 add_field_uses_to_worklist(ptn->as_Field()); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1234 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1235 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1236 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
|
1237 PointsToNode* e = i.get(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1238 if (e->is_Arraycopy()) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1239 assert(ptn->arraycopy_dst(), "sanity"); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1240 // Propagate only fields escape state through arraycopy edge. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1241 if (e->fields_escape_state() < field_es) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1242 set_fields_escape_state(e, field_es); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1243 escape_worklist.push(e); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1244 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1245 } else if (es >= field_es) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1246 // 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
|
1247 if (e->escape_state() < es) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1248 set_escape_state(e, es); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1249 escape_worklist.push(e); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1250 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1251 } else { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1252 // Propagate field escape state. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1253 bool es_changed = false; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1254 if (e->fields_escape_state() < field_es) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1255 set_fields_escape_state(e, field_es); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1256 es_changed = true; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1257 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1258 if ((e->escape_state() < field_es) && |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1259 e->is_Field() && ptn->is_JavaObject() && |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1260 e->as_Field()->is_oop()) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1261 // Change escape state of referenced fileds. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1262 set_escape_state(e, field_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 } else if (e->escape_state() < es) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1265 set_escape_state(e, es); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1266 es_changed = true;; |
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 if (es_changed) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1269 escape_worklist.push(e); |
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 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1272 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1273 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1274 // Remove escaped objects from non_escaped list. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1275 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
|
1276 JavaObjectNode* ptn = non_escaped_worklist.at(next); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1277 if (ptn->escape_state() >= PointsToNode::GlobalEscape) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1278 non_escaped_worklist.delete_at(next); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1279 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1280 if (ptn->escape_state() == PointsToNode::NoEscape) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1281 // 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
|
1282 find_init_values(ptn, phantom_obj, NULL); |
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 return (non_escaped_worklist.length() > 0); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1286 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1287 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1288 // 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
|
1289 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
|
1290 int new_edges = 0; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1291 if (populate_worklist) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1292 // Populate _worklist by uses of jobj's uses. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1293 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
|
1294 PointsToNode* use = i.get(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1295 if (use->is_Arraycopy()) |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1296 continue; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1297 add_uses_to_worklist(use); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1298 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
|
1299 // 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
|
1300 // related field nodes (same base and offset). |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1301 add_field_uses_to_worklist(use->as_Field()); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1302 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1303 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1304 } |
20585
90297adbda9d
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
20572
diff
changeset
|
1305 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
|
1306 PointsToNode* use = _worklist.at(l); |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1307 if (PointsToNode::is_base_use(use)) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1308 // 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
|
1309 use = PointsToNode::get_use_node(use)->as_Field(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1310 if (add_base(use->as_Field(), jobj)) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1311 new_edges++; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1312 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1313 continue; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1314 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1315 assert(!use->is_JavaObject(), "sanity"); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1316 if (use->is_Arraycopy()) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1317 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
|
1318 continue; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1319 // 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
|
1320 if (add_edge(use, jobj)) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1321 jobj->set_arraycopy_src(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1322 new_edges++; |
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 // and stop here. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1325 continue; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1326 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1327 if (!add_edge(use, jobj)) |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1328 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
|
1329 new_edges++; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1330 if (use->is_LocalVar()) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1331 add_uses_to_worklist(use); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1332 if (use->arraycopy_dst()) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1333 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
|
1334 PointsToNode* e = i.get(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1335 if (e->is_Arraycopy()) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1336 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
|
1337 continue; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1338 // 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
|
1339 if (add_edge(jobj, e)) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1340 new_edges++; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1341 jobj->set_arraycopy_dst(); |
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 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1344 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1345 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1346 } else { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1347 // Added new edge to stored in field values. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1348 // 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
|
1349 // related field nodes (same base and offset). |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1350 add_field_uses_to_worklist(use->as_Field()); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1351 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1352 } |
20585
90297adbda9d
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
20572
diff
changeset
|
1353 _worklist.clear(); |
90297adbda9d
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
20572
diff
changeset
|
1354 _in_worklist.Reset(); |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1355 return new_edges; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1356 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1357 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1358 // Put on worklist all related field nodes. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1359 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
|
1360 assert(field->is_oop(), "sanity"); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1361 int offset = field->offset(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1362 add_uses_to_worklist(field); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1363 // 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
|
1364 // 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
|
1365 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
|
1366 PointsToNode* base = i.get(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1367 add_fields_to_worklist(field, base); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1368 // 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
|
1369 // 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
|
1370 // 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
|
1371 if (base->arraycopy_src()) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1372 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
|
1373 PointsToNode* arycp = j.get(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1374 if (arycp->is_Arraycopy()) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1375 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
|
1376 PointsToNode* abase = k.get(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1377 if (abase->arraycopy_dst() && abase != base) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1378 // Look for the same arracopy reference. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1379 add_fields_to_worklist(field, abase); |
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 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1386 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1387 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1388 // Put on worklist all related field nodes. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1389 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
|
1390 int offset = field->offset(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1391 if (base->is_LocalVar()) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1392 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
|
1393 PointsToNode* f = j.get(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1394 if (PointsToNode::is_base_use(f)) { // Field |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1395 f = PointsToNode::get_use_node(f); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1396 if (f == field || !f->as_Field()->is_oop()) |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1397 continue; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1398 int offs = f->as_Field()->offset(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1399 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
|
1400 add_to_worklist(f); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1401 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1402 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1403 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1404 } else { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1405 assert(base->is_JavaObject(), "sanity"); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1406 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
|
1407 // this field's content globally escapes. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1408 (base != phantom_obj) && |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1409 // NULL object node does not have fields. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1410 (base != null_obj)) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1411 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
|
1412 PointsToNode* f = i.get(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1413 // 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
|
1414 // does not update value in source object field. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1415 if (f->is_Arraycopy()) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1416 assert(base->arraycopy_dst(), "sanity"); |
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 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1419 if (f == field || !f->as_Field()->is_oop()) |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1420 continue; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1421 int offs = f->as_Field()->offset(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1422 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
|
1423 add_to_worklist(f); |
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 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1428 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1429 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1430 // Find fields which have unknown value. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1431 int ConnectionGraph::find_field_value(FieldNode* field) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1432 // Escaped fields should have init value already. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1433 assert(field->escape_state() == PointsToNode::NoEscape, "sanity"); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1434 int new_edges = 0; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1435 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
|
1436 PointsToNode* base = i.get(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1437 if (base->is_JavaObject()) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1438 // 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
|
1439 if (base->ideal_node()->is_Allocate()) |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1440 return 0; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1441 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
|
1442 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1443 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1444 if (add_edge(field, phantom_obj)) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1445 // New edge was added |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1446 new_edges++; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1447 add_field_uses_to_worklist(field); |
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 return new_edges; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1450 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1451 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1452 // Find fields initializing values for allocations. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1453 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
|
1454 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
|
1455 int new_edges = 0; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1456 Node* alloc = pta->ideal_node(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1457 if (init_val == phantom_obj) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1458 // 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
|
1459 if (alloc->is_Allocate()) |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1460 return 0; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1461 assert(alloc->as_CallStaticJava(), "sanity"); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1462 #ifdef ASSERT |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1463 if (alloc->as_CallStaticJava()->method() == NULL) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1464 const char* name = alloc->as_CallStaticJava()->_name; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1465 assert(strncmp(name, "_multianewarray", 15) == 0, "sanity"); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1466 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1467 #endif |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1468 // 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
|
1469 // unknown values in fields. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1470 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
|
1471 PointsToNode* field = i.get(); |
f3da5ff1514c
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
6895
diff
changeset
|
1472 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
|
1473 if (add_edge(field, phantom_obj)) { |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1474 // New edge was added |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1475 new_edges++; |
6944
f3da5ff1514c
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
6895
diff
changeset
|
1476 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
|
1477 } |
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 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1480 return new_edges; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1481 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1482 assert(init_val == null_obj, "sanity"); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1483 // 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
|
1484 if (!alloc->is_Allocate()) |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1485 return 0; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1486 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1487 InitializeNode* ini = alloc->as_Allocate()->initialization(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1488 Compile* C = _compile; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1489 bool visited_bottom_offset = false; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1490 GrowableArray<int> offsets_worklist; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1491 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1492 // 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
|
1493 // 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
|
1494 // 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
|
1495 // captured by Initialize node. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1496 // |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1497 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
|
1498 PointsToNode* field = i.get(); // Field (AddP) |
f3da5ff1514c
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
6895
diff
changeset
|
1499 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
|
1500 continue; // Not oop field |
6944
f3da5ff1514c
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
6895
diff
changeset
|
1501 int offset = field->as_Field()->offset(); |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1502 if (offset == Type::OffsetBot) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1503 if (!visited_bottom_offset) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1504 // OffsetBot is used to reference array's element, |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1505 // 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
|
1506 // known which element is referenced. |
6944
f3da5ff1514c
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
6895
diff
changeset
|
1507 if (add_edge(field, null_obj)) { |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1508 // New edge was added |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1509 new_edges++; |
6944
f3da5ff1514c
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
6895
diff
changeset
|
1510 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
|
1511 visited_bottom_offset = true; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1512 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1513 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1514 } else { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1515 // Check only oop fields. |
6944
f3da5ff1514c
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
6895
diff
changeset
|
1516 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
|
1517 if (adr_type->isa_rawptr()) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1518 #ifdef ASSERT |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1519 // 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
|
1520 // 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
|
1521 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
|
1522 assert(adr_type->isa_rawptr() && base->is_Proj() && |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1523 (base->in(0) == alloc),"unexpected pointer type"); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1524 #endif |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1525 continue; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1526 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1527 if (!offsets_worklist.contains(offset)) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1528 offsets_worklist.append(offset); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1529 Node* value = NULL; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1530 if (ini != NULL) { |
6944
f3da5ff1514c
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
6895
diff
changeset
|
1531 // StoreP::memory_type() == T_ADDRESS |
f3da5ff1514c
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
6895
diff
changeset
|
1532 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
|
1533 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
|
1534 // 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
|
1535 // 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
|
1536 // 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
|
1537 if (store != NULL && store->is_Store() && |
f3da5ff1514c
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
6895
diff
changeset
|
1538 store->as_Store()->memory_type() == ft) { |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1539 value = store->in(MemNode::ValueIn); |
6944
f3da5ff1514c
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
6895
diff
changeset
|
1540 #ifdef ASSERT |
f3da5ff1514c
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
6895
diff
changeset
|
1541 if (VerifyConnectionGraph) { |
f3da5ff1514c
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
6895
diff
changeset
|
1542 // 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
|
1543 PointsToNode* val = ptnode_adr(value->_idx); |
f3da5ff1514c
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
6895
diff
changeset
|
1544 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
|
1545 PointsToNode* missed_obj = NULL; |
f3da5ff1514c
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
6895
diff
changeset
|
1546 if (val->is_JavaObject()) { |
f3da5ff1514c
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
6895
diff
changeset
|
1547 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
|
1548 missed_obj = val; |
f3da5ff1514c
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
6895
diff
changeset
|
1549 } |
f3da5ff1514c
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
6895
diff
changeset
|
1550 } else { |
f3da5ff1514c
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
6895
diff
changeset
|
1551 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
|
1552 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
|
1553 store->dump(); |
f3da5ff1514c
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
6895
diff
changeset
|
1554 val->dump(); |
f3da5ff1514c
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
6895
diff
changeset
|
1555 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
|
1556 } |
f3da5ff1514c
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
6895
diff
changeset
|
1557 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
|
1558 PointsToNode* obj = j.get(); |
f3da5ff1514c
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
6895
diff
changeset
|
1559 if (obj->is_JavaObject()) { |
f3da5ff1514c
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
6895
diff
changeset
|
1560 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
|
1561 missed_obj = obj; |
f3da5ff1514c
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
6895
diff
changeset
|
1562 break; |
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 } |
f3da5ff1514c
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
6895
diff
changeset
|
1565 } |
f3da5ff1514c
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
6895
diff
changeset
|
1566 } |
f3da5ff1514c
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
6895
diff
changeset
|
1567 if (missed_obj != NULL) { |
f3da5ff1514c
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
6895
diff
changeset
|
1568 tty->print_cr("----------field---------------------------------"); |
f3da5ff1514c
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
6895
diff
changeset
|
1569 field->dump(); |
f3da5ff1514c
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
6895
diff
changeset
|
1570 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
|
1571 missed_obj->dump(); |
f3da5ff1514c
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
6895
diff
changeset
|
1572 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
|
1573 store->dump(); |
f3da5ff1514c
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
6895
diff
changeset
|
1574 val->dump(); |
f3da5ff1514c
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
6895
diff
changeset
|
1575 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
|
1576 } |
f3da5ff1514c
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
6895
diff
changeset
|
1577 } |
f3da5ff1514c
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
6895
diff
changeset
|
1578 #endif |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1579 } else { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1580 // There could be initializing stores which follow allocation. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1581 // 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
|
1582 // by Initialize node. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1583 // |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1584 // 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
|
1585 // 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
|
1586 // that compare pointers optimization works correctly. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1587 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1588 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1589 if (value == NULL) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1590 // 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
|
1591 if (add_edge(field, null_obj)) { |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1592 // New edge was added |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1593 new_edges++; |
6944
f3da5ff1514c
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
6895
diff
changeset
|
1594 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
|
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 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1598 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1599 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1600 return new_edges; |
0 | 1601 } |
1602 | |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1603 // 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
|
1604 void ConnectionGraph::adjust_scalar_replaceable_state(JavaObjectNode* jobj) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1605 // 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
|
1606 // 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
|
1607 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1608 // 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
|
1609 // 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
|
1610 // |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1611 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
|
1612 PointsToNode* use = i.get(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1613 assert(!use->is_Arraycopy(), "sanity"); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1614 if (use->is_Field()) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1615 FieldNode* field = use->as_Field(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1616 assert(field->is_oop() && field->scalar_replaceable() && |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1617 field->fields_escape_state() == PointsToNode::NoEscape, "sanity"); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1618 if (field->offset() == Type::OffsetBot) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1619 jobj->set_scalar_replaceable(false); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1620 return; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1621 } |
14202
3e98456aab94
8027388: JVM crashes with SIGSEGV (0xb) at pc=0x00000001077cbbf6
iveresov
parents:
12871
diff
changeset
|
1622 // 2. An object is not scalar replaceable if the field into which it is |
3e98456aab94
8027388: JVM crashes with SIGSEGV (0xb) at pc=0x00000001077cbbf6
iveresov
parents:
12871
diff
changeset
|
1623 // stored has multiple bases one of which is null. |
3e98456aab94
8027388: JVM crashes with SIGSEGV (0xb) at pc=0x00000001077cbbf6
iveresov
parents:
12871
diff
changeset
|
1624 if (field->base_count() > 1) { |
3e98456aab94
8027388: JVM crashes with SIGSEGV (0xb) at pc=0x00000001077cbbf6
iveresov
parents:
12871
diff
changeset
|
1625 for (BaseIterator i(field); i.has_next(); i.next()) { |
3e98456aab94
8027388: JVM crashes with SIGSEGV (0xb) at pc=0x00000001077cbbf6
iveresov
parents:
12871
diff
changeset
|
1626 PointsToNode* base = i.get(); |
3e98456aab94
8027388: JVM crashes with SIGSEGV (0xb) at pc=0x00000001077cbbf6
iveresov
parents:
12871
diff
changeset
|
1627 if (base == null_obj) { |
3e98456aab94
8027388: JVM crashes with SIGSEGV (0xb) at pc=0x00000001077cbbf6
iveresov
parents:
12871
diff
changeset
|
1628 jobj->set_scalar_replaceable(false); |
3e98456aab94
8027388: JVM crashes with SIGSEGV (0xb) at pc=0x00000001077cbbf6
iveresov
parents:
12871
diff
changeset
|
1629 return; |
3e98456aab94
8027388: JVM crashes with SIGSEGV (0xb) at pc=0x00000001077cbbf6
iveresov
parents:
12871
diff
changeset
|
1630 } |
3e98456aab94
8027388: JVM crashes with SIGSEGV (0xb) at pc=0x00000001077cbbf6
iveresov
parents:
12871
diff
changeset
|
1631 } |
3e98456aab94
8027388: JVM crashes with SIGSEGV (0xb) at pc=0x00000001077cbbf6
iveresov
parents:
12871
diff
changeset
|
1632 } |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1633 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1634 assert(use->is_Field() || use->is_LocalVar(), "sanity"); |
14202
3e98456aab94
8027388: JVM crashes with SIGSEGV (0xb) at pc=0x00000001077cbbf6
iveresov
parents:
12871
diff
changeset
|
1635 // 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
|
1636 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
|
1637 PointsToNode* ptn = j.get(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1638 if (ptn->is_JavaObject() && ptn != jobj) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1639 // Mark all objects. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1640 jobj->set_scalar_replaceable(false); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1641 ptn->set_scalar_replaceable(false); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1642 } |
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 if (!jobj->scalar_replaceable()) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1645 return; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1646 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1647 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1648 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1649 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
|
1650 // 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
|
1651 FieldNode* field = j.get()->as_Field(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1652 int offset = field->as_Field()->offset(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1653 |
14202
3e98456aab94
8027388: JVM crashes with SIGSEGV (0xb) at pc=0x00000001077cbbf6
iveresov
parents:
12871
diff
changeset
|
1654 // 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
|
1655 // offset (array's element is accessed in loop). |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1656 if (offset == Type::OffsetBot) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1657 jobj->set_scalar_replaceable(false); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1658 return; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1659 } |
14202
3e98456aab94
8027388: JVM crashes with SIGSEGV (0xb) at pc=0x00000001077cbbf6
iveresov
parents:
12871
diff
changeset
|
1660 // 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
|
1661 // 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
|
1662 // |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1663 Node* n = field->ideal_node(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1664 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
|
1665 if (n->fast_out(i)->is_LoadStore()) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1666 jobj->set_scalar_replaceable(false); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1667 return; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1668 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1669 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1670 |
14202
3e98456aab94
8027388: JVM crashes with SIGSEGV (0xb) at pc=0x00000001077cbbf6
iveresov
parents:
12871
diff
changeset
|
1671 // 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
|
1672 // the false positive result (set not scalar replaceable) |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1673 // 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
|
1674 // 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
|
1675 // when stores happened on different control branches. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1676 // |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1677 // 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
|
1678 // |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1679 // Point p[] = new Point[1]; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1680 // 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
|
1681 // |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1682 // 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
|
1683 // |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1684 // Point p[] = new Point[1]; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1685 // 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
|
1686 // |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1687 if (field->base_count() > 1) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1688 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
|
1689 PointsToNode* base = i.get(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1690 // Don't take into account LocalVar nodes which |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1691 // 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
|
1692 // this field's base by now. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1693 if (base->is_JavaObject() && base != jobj) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1694 // Mark all bases. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1695 jobj->set_scalar_replaceable(false); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1696 base->set_scalar_replaceable(false); |
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 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1701 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1702 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1703 #ifdef ASSERT |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1704 void ConnectionGraph::verify_connection_graph( |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1705 GrowableArray<PointsToNode*>& ptnodes_worklist, |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1706 GrowableArray<JavaObjectNode*>& non_escaped_worklist, |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1707 GrowableArray<JavaObjectNode*>& java_objects_worklist, |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1708 GrowableArray<Node*>& addp_worklist) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1709 // 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
|
1710 int java_objects_length = java_objects_worklist.length(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1711 int non_escaped_length = non_escaped_worklist.length(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1712 int new_edges = 0; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1713 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
|
1714 JavaObjectNode* ptn = java_objects_worklist.at(next); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1715 new_edges += add_java_object_edges(ptn, true); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1716 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1717 assert(new_edges == 0, "graph was not complete"); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1718 // Verify that escape state is final. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1719 int length = non_escaped_worklist.length(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1720 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
|
1721 assert((non_escaped_length == non_escaped_worklist.length()) && |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1722 (non_escaped_length == length) && |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1723 (_worklist.length() == 0), "escape state was not final"); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1724 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1725 // Verify fields information. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1726 int addp_length = addp_worklist.length(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1727 for (int next = 0; next < addp_length; ++next ) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1728 Node* n = addp_worklist.at(next); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1729 FieldNode* field = ptnode_adr(n->_idx)->as_Field(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1730 if (field->is_oop()) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1731 // Verify that field has all bases |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1732 Node* base = get_addp_base(n); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1733 PointsToNode* ptn = ptnode_adr(base->_idx); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1734 if (ptn->is_JavaObject()) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1735 assert(field->has_base(ptn->as_JavaObject()), "sanity"); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1736 } else { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1737 assert(ptn->is_LocalVar(), "sanity"); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1738 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
|
1739 PointsToNode* e = i.get(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1740 if (e->is_JavaObject()) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1741 assert(field->has_base(e->as_JavaObject()), "sanity"); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1742 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1743 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1744 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1745 // Verify that all fields have initializing values. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1746 if (field->edge_count() == 0) { |
6944
f3da5ff1514c
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
6895
diff
changeset
|
1747 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
|
1748 field->dump(); |
6944
f3da5ff1514c
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
6895
diff
changeset
|
1749 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
|
1750 PointsToNode* base = i.get(); |
f3da5ff1514c
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
6895
diff
changeset
|
1751 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
|
1752 base->dump(); |
f3da5ff1514c
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
6895
diff
changeset
|
1753 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
|
1754 tty->print_cr("----------base has fields-------------------------"); |
f3da5ff1514c
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
6895
diff
changeset
|
1755 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
|
1756 j.get()->dump(); |
f3da5ff1514c
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
6895
diff
changeset
|
1757 } |
f3da5ff1514c
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
6895
diff
changeset
|
1758 tty->print_cr("----------base has references---------------------"); |
f3da5ff1514c
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
6895
diff
changeset
|
1759 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
|
1760 j.get()->dump(); |
f3da5ff1514c
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
6895
diff
changeset
|
1761 } |
f3da5ff1514c
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
6895
diff
changeset
|
1762 } |
f3da5ff1514c
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
6895
diff
changeset
|
1763 } |
f3da5ff1514c
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
6895
diff
changeset
|
1764 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
|
1765 i.get()->dump(); |
f3da5ff1514c
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
6895
diff
changeset
|
1766 } |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1767 assert(field->edge_count() > 0, "sanity"); |
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 } |
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 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1772 #endif |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1773 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1774 // Optimize ideal graph. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1775 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
|
1776 GrowableArray<Node*>& storestore_worklist) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1777 Compile* C = _compile; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1778 PhaseIterGVN* igvn = _igvn; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1779 if (EliminateLocks) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1780 // Mark locks before changing ideal graph. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1781 int cnt = C->macro_count(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1782 for( int i=0; i < cnt; i++ ) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1783 Node *n = C->macro_node(i); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1784 if (n->is_AbstractLock()) { // Lock and Unlock nodes |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1785 AbstractLockNode* alock = n->as_AbstractLock(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1786 if (!alock->is_non_esc_obj()) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1787 if (not_global_escape(alock->obj_node())) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1788 assert(!alock->is_eliminated() || alock->is_coarsened(), "sanity"); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1789 // 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
|
1790 // 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
|
1791 // to eliminate all associated locks/unlocks. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1792 alock->set_non_esc_obj(); |
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 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1797 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1798 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1799 if (OptimizePtrCompare) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1800 // Add ConI(#CC_GT) and ConI(#CC_EQ). |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1801 _pcmp_neq = igvn->makecon(TypeInt::CC_GT); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1802 _pcmp_eq = igvn->makecon(TypeInt::CC_EQ); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1803 // Optimize objects compare. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1804 while (ptr_cmp_worklist.length() != 0) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1805 Node *n = ptr_cmp_worklist.pop(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1806 Node *res = optimize_ptr_compare(n); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1807 if (res != NULL) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1808 #ifndef PRODUCT |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1809 if (PrintOptimizePtrCompare) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1810 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
|
1811 if (Verbose) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1812 n->dump(1); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1813 } |
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 #endif |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1816 igvn->replace_node(n, res); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1817 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1818 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1819 // cleanup |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1820 if (_pcmp_neq->outcnt() == 0) |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1821 igvn->hash_delete(_pcmp_neq); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1822 if (_pcmp_eq->outcnt() == 0) |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1823 igvn->hash_delete(_pcmp_eq); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1824 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1825 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1826 // 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
|
1827 // escape status of associated AllocateNode and optimize out |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1828 // MemBarStoreStore node if the allocated object never escapes. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1829 while (storestore_worklist.length() != 0) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1830 Node *n = storestore_worklist.pop(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1831 MemBarStoreStoreNode *storestore = n ->as_MemBarStoreStore(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1832 Node *alloc = storestore->in(MemBarNode::Precedent)->in(0); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1833 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
|
1834 if (not_global_escape(alloc)) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1835 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
|
1836 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
|
1837 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
|
1838 igvn->register_new_node_with_optimizer(mb); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1839 igvn->replace_node(storestore, mb); |
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 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1842 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1843 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1844 // Optimize objects compare. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1845 Node* ConnectionGraph::optimize_ptr_compare(Node* n) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1846 assert(OptimizePtrCompare, "sanity"); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1847 PointsToNode* ptn1 = ptnode_adr(n->in(1)->_idx); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1848 PointsToNode* ptn2 = ptnode_adr(n->in(2)->_idx); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1849 JavaObjectNode* jobj1 = unique_java_object(n->in(1)); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1850 JavaObjectNode* jobj2 = unique_java_object(n->in(2)); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1851 assert(ptn1->is_JavaObject() || ptn1->is_LocalVar(), "sanity"); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1852 assert(ptn2->is_JavaObject() || ptn2->is_LocalVar(), "sanity"); |
0 | 1853 |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1854 // Check simple cases first. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1855 if (jobj1 != NULL) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1856 if (jobj1->escape_state() == PointsToNode::NoEscape) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1857 if (jobj1 == jobj2) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1858 // Comparing the same not escaping object. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1859 return _pcmp_eq; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1860 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1861 Node* obj = jobj1->ideal_node(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1862 // Comparing not escaping allocation. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1863 if ((obj->is_Allocate() || obj->is_CallStaticJava()) && |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1864 !ptn2->points_to(jobj1)) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1865 return _pcmp_neq; // This includes nullness check. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1866 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1867 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1868 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1869 if (jobj2 != NULL) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1870 if (jobj2->escape_state() == PointsToNode::NoEscape) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1871 Node* obj = jobj2->ideal_node(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1872 // Comparing not escaping allocation. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1873 if ((obj->is_Allocate() || obj->is_CallStaticJava()) && |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1874 !ptn1->points_to(jobj2)) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1875 return _pcmp_neq; // This includes nullness check. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1876 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1877 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1878 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1879 if (jobj1 != NULL && jobj1 != phantom_obj && |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1880 jobj2 != NULL && jobj2 != phantom_obj && |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1881 jobj1->ideal_node()->is_Con() && |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1882 jobj2->ideal_node()->is_Con()) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1883 // 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
|
1884 // 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
|
1885 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
|
1886 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
|
1887 if (t1->make_ptr() == t2->make_ptr()) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1888 return _pcmp_eq; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1889 } else { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1890 return _pcmp_neq; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1891 } |
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 if (ptn1->meet(ptn2)) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1894 return NULL; // Sets are not disjoint |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1895 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1896 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1897 // Sets are disjoint. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1898 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
|
1899 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
|
1900 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
|
1901 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
|
1902 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
|
1903 set2_has_unknown_ptr && set1_has_null_ptr) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1904 // Check nullness of unknown object. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1905 return NULL; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1906 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1907 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1908 // Disjointness by itself is not sufficient since |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1909 // alias analysis is not complete for escaped objects. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1910 // Disjoint sets are definitely unrelated only when |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1911 // 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
|
1912 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
|
1913 if (ptn1->non_escaping_allocation()) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1914 return _pcmp_neq; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1915 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1916 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1917 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
|
1918 if (ptn2->non_escaping_allocation()) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1919 return _pcmp_neq; |
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 return NULL; |
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 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1925 // Connection Graph constuction functions. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1926 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1927 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
|
1928 PointsToNode* ptadr = _nodes.at(n->_idx); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1929 if (ptadr != NULL) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1930 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
|
1931 return; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1932 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1933 Compile* C = _compile; |
20585
90297adbda9d
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
20572
diff
changeset
|
1934 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
|
1935 _nodes.at_put(n->_idx, ptadr); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1936 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1937 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1938 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
|
1939 PointsToNode* ptadr = _nodes.at(n->_idx); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1940 if (ptadr != NULL) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1941 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
|
1942 return; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1943 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1944 Compile* C = _compile; |
20585
90297adbda9d
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
20572
diff
changeset
|
1945 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
|
1946 _nodes.at_put(n->_idx, ptadr); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1947 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1948 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1949 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
|
1950 PointsToNode* ptadr = _nodes.at(n->_idx); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1951 if (ptadr != NULL) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1952 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
|
1953 return; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1954 } |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
5954
diff
changeset
|
1955 bool unsafe = false; |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
5954
diff
changeset
|
1956 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
|
1957 if (unsafe) { |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
5954
diff
changeset
|
1958 es = PointsToNode::GlobalEscape; |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
5954
diff
changeset
|
1959 } |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1960 Compile* C = _compile; |
20585
90297adbda9d
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
20572
diff
changeset
|
1961 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
|
1962 _nodes.at_put(n->_idx, field); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1963 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1964 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1965 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
|
1966 PointsToNode* src, PointsToNode* dst) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1967 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
|
1968 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
|
1969 PointsToNode* ptadr = _nodes.at(n->_idx); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1970 if (ptadr != NULL) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1971 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
|
1972 return; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1973 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1974 Compile* C = _compile; |
20585
90297adbda9d
8041984: CompilerThread seems to occupy all CPU in a very rare situation
kvn
parents:
20572
diff
changeset
|
1975 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
|
1976 _nodes.at_put(n->_idx, ptadr); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1977 // Add edge from arraycopy node to source object. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1978 (void)add_edge(ptadr, src); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1979 src->set_arraycopy_src(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1980 // Add edge from destination object to arraycopy node. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1981 (void)add_edge(dst, ptadr); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1982 dst->set_arraycopy_dst(); |
0 | 1983 } |
1984 | |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
5954
diff
changeset
|
1985 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
|
1986 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
|
1987 BasicType bt = T_INT; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1988 if (offset == Type::OffsetBot) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1989 // Check only oop fields. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1990 if (!adr_type->isa_aryptr() || |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1991 (adr_type->isa_aryptr()->klass() == NULL) || |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1992 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
|
1993 // 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
|
1994 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
|
1995 bt = T_OBJECT; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1996 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1997 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1998 } else if (offset != oopDesc::klass_offset_in_bytes()) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
1999 if (adr_type->isa_instptr()) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2000 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
|
2001 if (field != NULL) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2002 bt = field->layout_type(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2003 } else { |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
5954
diff
changeset
|
2004 // 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
|
2005 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
|
2006 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
|
2007 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
|
2008 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
|
2009 bt = T_OBJECT; |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
5954
diff
changeset
|
2010 (*unsafe) = true; |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
5954
diff
changeset
|
2011 break; |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
5954
diff
changeset
|
2012 } |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
5954
diff
changeset
|
2013 } |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2014 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2015 } else if (adr_type->isa_aryptr()) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2016 if (offset == arrayOopDesc::length_offset_in_bytes()) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2017 // Ignore array length load. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2018 } 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
|
2019 // Ignore first AddP. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2020 } else { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2021 const Type* elemtype = adr_type->isa_aryptr()->elem(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2022 bt = elemtype->array_element_basic_type(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2023 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2024 } 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
|
2025 // Allocation initialization, ThreadLocal field access, unsafe access |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2026 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
|
2027 int opcode = n->fast_out(i)->Opcode(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2028 if (opcode == Op_StoreP || opcode == Op_LoadP || |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2029 opcode == Op_StoreN || opcode == Op_LoadN) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2030 bt = T_OBJECT; |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
5954
diff
changeset
|
2031 break; |
5948
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 } |
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 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
|
2037 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2038 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2039 // Returns unique pointed java object or NULL. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2040 JavaObjectNode* ConnectionGraph::unique_java_object(Node *n) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2041 assert(!_collecting, "should not call when contructed graph"); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2042 // 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
|
2043 uint idx = n->_idx; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2044 if (idx >= nodes_size()) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2045 return NULL; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2046 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2047 PointsToNode* ptn = ptnode_adr(idx); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2048 if (ptn->is_JavaObject()) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2049 return ptn->as_JavaObject(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2050 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2051 assert(ptn->is_LocalVar(), "sanity"); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2052 // Check all java objects it points to. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2053 JavaObjectNode* jobj = NULL; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2054 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
|
2055 PointsToNode* e = i.get(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2056 if (e->is_JavaObject()) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2057 if (jobj == NULL) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2058 jobj = e->as_JavaObject(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2059 } else if (jobj != e) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2060 return NULL; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2061 } |
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 jobj; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2065 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2066 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2067 // 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
|
2068 bool PointsToNode::non_escaping_allocation() { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2069 if (is_JavaObject()) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2070 Node* n = ideal_node(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2071 if (n->is_Allocate() || n->is_CallStaticJava()) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2072 return (escape_state() == PointsToNode::NoEscape); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2073 } else { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2074 return false; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2075 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2076 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2077 assert(is_LocalVar(), "sanity"); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2078 // Check all java objects it points to. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2079 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
|
2080 PointsToNode* e = i.get(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2081 if (e->is_JavaObject()) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2082 Node* n = e->ideal_node(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2083 if ((e->escape_state() != PointsToNode::NoEscape) || |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2084 !(n->is_Allocate() || n->is_CallStaticJava())) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2085 return false; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2086 } |
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; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2090 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2091 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2092 // 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
|
2093 bool ConnectionGraph::not_global_escape(Node *n) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2094 assert(!_collecting, "should not call during graph construction"); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2095 // 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
|
2096 uint idx = n->_idx; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2097 if (idx >= nodes_size()) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2098 return false; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2099 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2100 PointsToNode* ptn = ptnode_adr(idx); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2101 PointsToNode::EscapeState es = ptn->escape_state(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2102 // 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
|
2103 if (es >= PointsToNode::GlobalEscape) |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2104 return false; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2105 if (ptn->is_JavaObject()) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2106 return true; // (es < PointsToNode::GlobalEscape); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2107 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2108 assert(ptn->is_LocalVar(), "sanity"); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2109 // Check all java objects it points to. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2110 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
|
2111 if (i.get()->escape_state() >= PointsToNode::GlobalEscape) |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2112 return false; |
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 return true; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2115 } |
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 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2118 // Helper functions |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2119 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2120 // 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
|
2121 bool PointsToNode::points_to(JavaObjectNode* ptn) const { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2122 if (is_JavaObject()) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2123 return (this == ptn); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2124 } |
6944
f3da5ff1514c
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
6895
diff
changeset
|
2125 assert(is_LocalVar() || is_Field(), "sanity"); |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2126 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
|
2127 if (i.get() == ptn) |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2128 return true; |
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 false; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2131 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2132 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2133 // 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
|
2134 bool PointsToNode::meet(PointsToNode* ptn) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2135 if (this == ptn) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2136 return true; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2137 } else if (ptn->is_JavaObject()) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2138 return this->points_to(ptn->as_JavaObject()); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2139 } else if (this->is_JavaObject()) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2140 return ptn->points_to(this->as_JavaObject()); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2141 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2142 assert(this->is_LocalVar() && ptn->is_LocalVar(), "sanity"); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2143 int ptn_count = ptn->edge_count(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2144 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
|
2145 PointsToNode* this_e = i.get(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2146 for (int j = 0; j < ptn_count; j++) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2147 if (this_e == ptn->edge(j)) |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2148 return true; |
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 return false; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2152 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2153 |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2154 #ifdef ASSERT |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2155 // 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
|
2156 bool FieldNode::has_base(JavaObjectNode* jobj) const { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2157 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
|
2158 if (i.get() == jobj) |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2159 return true; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2160 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2161 return false; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2162 } |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2163 #endif |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2164 |
65 | 2165 int ConnectionGraph::address_offset(Node* adr, PhaseTransform *phase) { |
2166 const Type *adr_type = phase->type(adr); | |
2167 if (adr->is_AddP() && adr_type->isa_oopptr() == NULL && | |
2168 adr->in(AddPNode::Address)->is_Proj() && | |
2169 adr->in(AddPNode::Address)->in(0)->is_Allocate()) { | |
2170 // We are computing a raw address for a store captured by an Initialize | |
2171 // compute an appropriate address type. AddP cases #3 and #5 (see below). | |
2172 int offs = (int)phase->find_intptr_t_con(adr->in(AddPNode::Offset), Type::OffsetBot); | |
2173 assert(offs != Type::OffsetBot || | |
2174 adr->in(AddPNode::Address)->in(0)->is_AllocateArray(), | |
2175 "offset must be a constant or it is initialization of array"); | |
2176 return offs; | |
2177 } | |
2178 const TypePtr *t_ptr = adr_type->isa_ptr(); | |
0 | 2179 assert(t_ptr != NULL, "must be a pointer type"); |
2180 return t_ptr->offset(); | |
2181 } | |
2182 | |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2183 Node* ConnectionGraph::get_addp_base(Node *addp) { |
65 | 2184 assert(addp->is_AddP(), "must be AddP"); |
2185 // | |
2186 // AddP cases for Base and Address inputs: | |
2187 // case #1. Direct object's field reference: | |
2188 // Allocate | |
2189 // | | |
2190 // Proj #5 ( oop result ) | |
2191 // | | |
2192 // CheckCastPP (cast to instance type) | |
2193 // | | | |
2194 // AddP ( base == address ) | |
2195 // | |
2196 // case #2. Indirect object's field reference: | |
2197 // Phi | |
2198 // | | |
2199 // CastPP (cast to instance type) | |
2200 // | | | |
2201 // AddP ( base == address ) | |
2202 // | |
2203 // case #3. Raw object's field reference for Initialize node: | |
2204 // Allocate | |
2205 // | | |
2206 // Proj #5 ( oop result ) | |
2207 // top | | |
2208 // \ | | |
2209 // AddP ( base == top ) | |
2210 // | |
2211 // case #4. Array's element reference: | |
2212 // {CheckCastPP | CastPP} | |
2213 // | | | | |
2214 // | AddP ( array's element offset ) | |
2215 // | | | |
2216 // AddP ( array's offset ) | |
2217 // | |
2218 // case #5. Raw object's field reference for arraycopy stub call: | |
2219 // The inline_native_clone() case when the arraycopy stub is called | |
2220 // after the allocation before Initialize and CheckCastPP nodes. | |
2221 // Allocate | |
2222 // | | |
2223 // Proj #5 ( oop result ) | |
2224 // | | | |
2225 // AddP ( base == address ) | |
2226 // | |
77 | 2227 // case #6. Constant Pool, ThreadLocal, CastX2P or |
2228 // Raw object's field reference: | |
2229 // {ConP, ThreadLocal, CastX2P, raw Load} | |
65 | 2230 // top | |
2231 // \ | | |
2232 // AddP ( base == top ) | |
2233 // | |
77 | 2234 // case #7. Klass's field reference. |
2235 // LoadKlass | |
2236 // | | | |
2237 // AddP ( base == address ) | |
2238 // | |
164
c436414a719e
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
163
diff
changeset
|
2239 // 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
|
2240 // LoadNKlass |
c436414a719e
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
163
diff
changeset
|
2241 // | |
c436414a719e
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
163
diff
changeset
|
2242 // DecodeN |
c436414a719e
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
163
diff
changeset
|
2243 // | | |
c436414a719e
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
163
diff
changeset
|
2244 // AddP ( base == address ) |
c436414a719e
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
163
diff
changeset
|
2245 // |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2246 Node *base = addp->in(AddPNode::Base); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2247 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
|
2248 base = addp->in(AddPNode::Address); |
957 | 2249 while (base->is_AddP()) { |
2250 // 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
|
2251 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
|
2252 base = base->in(AddPNode::Address); |
957 | 2253 } |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2254 Node* uncast_base = base->uncast(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2255 int opcode = uncast_base->Opcode(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2256 assert(opcode == Op_ConP || opcode == Op_ThreadLocal || |
6848
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6795
diff
changeset
|
2257 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
|
2258 (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
|
2259 (uncast_base->is_Proj() && uncast_base->in(0)->is_Allocate()), "sanity"); |
0 | 2260 } |
65 | 2261 return base; |
2262 } | |
2263 | |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2264 Node* ConnectionGraph::find_second_addp(Node* addp, Node* n) { |
65 | 2265 assert(addp->is_AddP() && addp->outcnt() > 0, "Don't process dead nodes"); |
2266 Node* addp2 = addp->raw_out(0); | |
2267 if (addp->outcnt() == 1 && addp2->is_AddP() && | |
2268 addp2->in(AddPNode::Base) == n && | |
2269 addp2->in(AddPNode::Address) == addp) { | |
2270 assert(addp->in(AddPNode::Base) == n, "expecting the same base"); | |
2271 // | |
2272 // Find array's offset to push it on worklist first and | |
2273 // as result process an array's element offset first (pushed second) | |
2274 // to avoid CastPP for the array's offset. | |
2275 // Otherwise the inserted CastPP (LocalVar) will point to what | |
2276 // the AddP (Field) points to. Which would be wrong since | |
2277 // the algorithm expects the CastPP has the same point as | |
2278 // as AddP's base CheckCastPP (LocalVar). | |
2279 // | |
2280 // ArrayAllocation | |
2281 // | | |
2282 // CheckCastPP | |
2283 // | | |
2284 // memProj (from ArrayAllocation CheckCastPP) | |
2285 // | || | |
2286 // | || Int (element index) | |
2287 // | || | ConI (log(element size)) | |
2288 // | || | / | |
2289 // | || LShift | |
2290 // | || / | |
2291 // | AddP (array's element offset) | |
2292 // | | | |
2293 // | | ConI (array's offset: #12(32-bits) or #24(64-bits)) | |
2294 // | / / | |
2295 // AddP (array's offset) | |
2296 // | | |
2297 // Load/Store (memory operation on array's element) | |
2298 // | |
2299 return addp2; | |
2300 } | |
2301 return NULL; | |
0 | 2302 } |
2303 | |
2304 // | |
2305 // Adjust the type and inputs of an AddP which computes the | |
2306 // address of a field of an instance | |
2307 // | |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2308 bool ConnectionGraph::split_AddP(Node *addp, Node *base) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2309 PhaseGVN* igvn = _igvn; |
65 | 2310 const TypeOopPtr *base_t = igvn->type(base)->isa_oopptr(); |
223 | 2311 assert(base_t != NULL && base_t->is_known_instance(), "expecting instance oopptr"); |
0 | 2312 const TypeOopPtr *t = igvn->type(addp)->isa_oopptr(); |
65 | 2313 if (t == NULL) { |
2314 // 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
|
2315 // compute an appropriate address type (cases #3 and #5). |
65 | 2316 assert(igvn->type(addp) == TypeRawPtr::NOTNULL, "must be raw pointer"); |
2317 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
|
2318 intptr_t offs = (int)igvn->find_intptr_t_con(addp->in(AddPNode::Offset), Type::OffsetBot); |
65 | 2319 assert(offs != Type::OffsetBot, "offset must be a constant"); |
2320 t = base_t->add_offset(offs)->is_oopptr(); | |
2321 } | |
223 | 2322 int inst_id = base_t->instance_id(); |
2323 assert(!t->is_known_instance() || t->instance_id() == inst_id, | |
0 | 2324 "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
|
2325 |
c3e045194476
6731641: assert(m->adr_type() == mach->adr_type(),"matcher should not change adr type")
kvn
parents:
253
diff
changeset
|
2326 // 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
|
2327 // 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
|
2328 // 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
|
2329 // 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
|
2330 // |
605 | 2331 // 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
|
2332 // 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
|
2333 // 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
|
2334 // |
988
7e309ecb83ce
6879362: assert(!klass_is_exact(),"only non-exact klass")
kvn
parents:
957
diff
changeset
|
2335 // 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
|
2336 // 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
|
2337 // (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
|
2338 // |
293
c3e045194476
6731641: assert(m->adr_type() == mach->adr_type(),"matcher should not change adr type")
kvn
parents:
253
diff
changeset
|
2339 // 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
|
2340 // 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
|
2341 // |
c3e045194476
6731641: assert(m->adr_type() == mach->adr_type(),"matcher should not change adr type")
kvn
parents:
253
diff
changeset
|
2342 if (!t->is_known_instance() && |
988
7e309ecb83ce
6879362: assert(!klass_is_exact(),"only non-exact klass")
kvn
parents:
957
diff
changeset
|
2343 !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
|
2344 return false; // bail out |
c3e045194476
6731641: assert(m->adr_type() == mach->adr_type(),"matcher should not change adr type")
kvn
parents:
253
diff
changeset
|
2345 } |
0 | 2346 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
|
2347 // 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
|
2348 // 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
|
2349 // has side effect. |
0 | 2350 int alias_idx = _compile->get_alias_index(tinst); |
2351 igvn->set_type(addp, tinst); | |
2352 // record the allocation in the node map | |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2353 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
|
2354 // 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
|
2355 Node *abase = addp->in(AddPNode::Base); |
b0fe4deeb9fb
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
247
diff
changeset
|
2356 Node *adr = addp->in(AddPNode::Address); |
b0fe4deeb9fb
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
247
diff
changeset
|
2357 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
|
2358 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
|
2359 // Skip AddP cases #3 and #5. |
b0fe4deeb9fb
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
247
diff
changeset
|
2360 } else { |
b0fe4deeb9fb
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
247
diff
changeset
|
2361 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
|
2362 if (abase != base) { |
b0fe4deeb9fb
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
247
diff
changeset
|
2363 igvn->hash_delete(addp); |
b0fe4deeb9fb
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
247
diff
changeset
|
2364 addp->set_req(AddPNode::Base, base); |
b0fe4deeb9fb
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
247
diff
changeset
|
2365 if (abase == adr) { |
b0fe4deeb9fb
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
247
diff
changeset
|
2366 addp->set_req(AddPNode::Address, base); |
b0fe4deeb9fb
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
247
diff
changeset
|
2367 } else { |
b0fe4deeb9fb
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
247
diff
changeset
|
2368 // 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
|
2369 #ifdef ASSERT |
b0fe4deeb9fb
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
247
diff
changeset
|
2370 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
|
2371 assert(adr->is_AddP() && atype != NULL && |
b0fe4deeb9fb
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
247
diff
changeset
|
2372 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
|
2373 #endif |
b0fe4deeb9fb
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
247
diff
changeset
|
2374 } |
b0fe4deeb9fb
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
247
diff
changeset
|
2375 igvn->hash_insert(addp); |
0 | 2376 } |
2377 } | |
65 | 2378 // Put on IGVN worklist since at least addp's type was changed above. |
2379 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
|
2380 return true; |
0 | 2381 } |
2382 | |
2383 // | |
2384 // 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
|
2385 // created phi or an existing phi. Sets create_new to indicate whether a new |
0 | 2386 // phi was created. Cache the last newly created phi in the node map. |
2387 // | |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2388 PhiNode *ConnectionGraph::create_split_phi(PhiNode *orig_phi, int alias_idx, GrowableArray<PhiNode *> &orig_phi_worklist, bool &new_created) { |
0 | 2389 Compile *C = _compile; |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2390 PhaseGVN* igvn = _igvn; |
0 | 2391 new_created = false; |
2392 int phi_alias_idx = C->get_alias_index(orig_phi->adr_type()); | |
2393 // nothing to do if orig_phi is bottom memory or matches alias_idx | |
65 | 2394 if (phi_alias_idx == alias_idx) { |
0 | 2395 return orig_phi; |
2396 } | |
851
fc4be448891f
6851742: (EA) allocation elimination doesn't work with UseG1GC
kvn
parents:
784
diff
changeset
|
2397 // Have we recently created a Phi for this alias index? |
0 | 2398 PhiNode *result = get_map_phi(orig_phi->_idx); |
2399 if (result != NULL && C->get_alias_index(result->adr_type()) == alias_idx) { | |
2400 return result; | |
2401 } | |
851
fc4be448891f
6851742: (EA) allocation elimination doesn't work with UseG1GC
kvn
parents:
784
diff
changeset
|
2402 // 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
|
2403 // 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
|
2404 if (result != NULL) { |
fc4be448891f
6851742: (EA) allocation elimination doesn't work with UseG1GC
kvn
parents:
784
diff
changeset
|
2405 Node* region = orig_phi->in(0); |
fc4be448891f
6851742: (EA) allocation elimination doesn't work with UseG1GC
kvn
parents:
784
diff
changeset
|
2406 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
|
2407 Node* phi = region->fast_out(i); |
fc4be448891f
6851742: (EA) allocation elimination doesn't work with UseG1GC
kvn
parents:
784
diff
changeset
|
2408 if (phi->is_Phi() && |
fc4be448891f
6851742: (EA) allocation elimination doesn't work with UseG1GC
kvn
parents:
784
diff
changeset
|
2409 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
|
2410 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
|
2411 return phi->as_Phi(); |
fc4be448891f
6851742: (EA) allocation elimination doesn't work with UseG1GC
kvn
parents:
784
diff
changeset
|
2412 } |
fc4be448891f
6851742: (EA) allocation elimination doesn't work with UseG1GC
kvn
parents:
784
diff
changeset
|
2413 } |
fc4be448891f
6851742: (EA) allocation elimination doesn't work with UseG1GC
kvn
parents:
784
diff
changeset
|
2414 } |
20671
9e69e8d1c900
8058148: MaxNodeLimit and LiveNodeCountInliningCutoff
vlivanov
parents:
20585
diff
changeset
|
2415 if (C->live_nodes() + 2*NodeLimitFudgeFactor > C->max_node_limit()) { |
38
b789bcaf2dd9
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
0
diff
changeset
|
2416 if (C->do_escape_analysis() == true && !C->failing()) { |
b789bcaf2dd9
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
0
diff
changeset
|
2417 // Retry compilation without escape analysis. |
b789bcaf2dd9
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
0
diff
changeset
|
2418 // 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
|
2419 // 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
|
2420 C->record_failure(C2Compiler::retry_no_escape_analysis()); |
b789bcaf2dd9
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
0
diff
changeset
|
2421 } |
b789bcaf2dd9
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
0
diff
changeset
|
2422 return NULL; |
b789bcaf2dd9
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
0
diff
changeset
|
2423 } |
0 | 2424 orig_phi_worklist.append_if_missing(orig_phi); |
65 | 2425 const TypePtr *atype = C->get_adr_type(alias_idx); |
0 | 2426 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
|
2427 C->copy_node_notes_to(result, orig_phi); |
0 | 2428 igvn->set_type(result, result->bottom_type()); |
2429 record_for_optimizer(result); | |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2430 set_map(orig_phi, result); |
0 | 2431 new_created = true; |
2432 return result; | |
2433 } | |
2434 | |
2435 // | |
2459
55973726c600
6992789: assert(phi->_idx >= nodes_size()) failed: only new Phi per instance memory slice
kvn
parents:
2249
diff
changeset
|
2436 // Return a new version of Memory Phi "orig_phi" with the inputs having the |
0 | 2437 // specified alias index. |
2438 // | |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2439 PhiNode *ConnectionGraph::split_memory_phi(PhiNode *orig_phi, int alias_idx, GrowableArray<PhiNode *> &orig_phi_worklist) { |
0 | 2440 assert(alias_idx != Compile::AliasIdxBot, "can't split out bottom memory"); |
2441 Compile *C = _compile; | |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2442 PhaseGVN* igvn = _igvn; |
0 | 2443 bool new_phi_created; |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2444 PhiNode *result = create_split_phi(orig_phi, alias_idx, orig_phi_worklist, new_phi_created); |
0 | 2445 if (!new_phi_created) { |
2446 return result; | |
2447 } | |
2448 GrowableArray<PhiNode *> phi_list; | |
2449 GrowableArray<uint> cur_input; | |
2450 PhiNode *phi = orig_phi; | |
2451 uint idx = 1; | |
2452 bool finished = false; | |
2453 while(!finished) { | |
2454 while (idx < phi->req()) { | |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2455 Node *mem = find_inst_mem(phi->in(idx), alias_idx, orig_phi_worklist); |
0 | 2456 if (mem != NULL && mem->is_Phi()) { |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2457 PhiNode *newphi = create_split_phi(mem->as_Phi(), alias_idx, orig_phi_worklist, new_phi_created); |
0 | 2458 if (new_phi_created) { |
2459 // found an phi for which we created a new split, push current one on worklist and begin | |
2460 // processing new one | |
2461 phi_list.push(phi); | |
2462 cur_input.push(idx); | |
2463 phi = mem->as_Phi(); | |
65 | 2464 result = newphi; |
0 | 2465 idx = 1; |
2466 continue; | |
2467 } else { | |
65 | 2468 mem = newphi; |
0 | 2469 } |
2470 } | |
38
b789bcaf2dd9
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
0
diff
changeset
|
2471 if (C->failing()) { |
b789bcaf2dd9
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
0
diff
changeset
|
2472 return NULL; |
b789bcaf2dd9
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
0
diff
changeset
|
2473 } |
0 | 2474 result->set_req(idx++, mem); |
2475 } | |
2476 #ifdef ASSERT | |
2477 // verify that the new Phi has an input for each input of the original | |
2478 assert( phi->req() == result->req(), "must have same number of inputs."); | |
2479 assert( result->in(0) != NULL && result->in(0) == phi->in(0), "regions must match"); | |
65 | 2480 #endif |
2481 // Check if all new phi's inputs have specified alias index. | |
2482 // Otherwise use old phi. | |
0 | 2483 for (uint i = 1; i < phi->req(); i++) { |
65 | 2484 Node* in = result->in(i); |
2485 assert((phi->in(i) == NULL) == (in == NULL), "inputs must correspond."); | |
0 | 2486 } |
2487 // we have finished processing a Phi, see if there are any more to do | |
2488 finished = (phi_list.length() == 0 ); | |
2489 if (!finished) { | |
2490 phi = phi_list.pop(); | |
2491 idx = cur_input.pop(); | |
65 | 2492 PhiNode *prev_result = get_map_phi(phi->_idx); |
2493 prev_result->set_req(idx++, result); | |
2494 result = prev_result; | |
0 | 2495 } |
2496 } | |
2497 return result; | |
2498 } | |
2499 | |
65 | 2500 // |
2501 // The next methods are derived from methods in MemNode. | |
2502 // | |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2503 Node* ConnectionGraph::step_through_mergemem(MergeMemNode *mmem, int alias_idx, const TypeOopPtr *toop) { |
65 | 2504 Node *mem = mmem; |
1815 | 2505 // TypeOopPtr::NOTNULL+any is an OOP with unknown offset - generally |
65 | 2506 // means an array I have not precisely typed yet. Do not do any |
2507 // alias stuff with it any time soon. | |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2508 if (toop->base() != Type::AnyPtr && |
1815 | 2509 !(toop->klass() != NULL && |
2510 toop->klass()->is_java_lang_Object() && | |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2511 toop->offset() == Type::OffsetBot)) { |
65 | 2512 mem = mmem->memory_at(alias_idx); |
2513 // Update input if it is progress over what we have now | |
2514 } | |
2515 return mem; | |
2516 } | |
2517 | |
2518 // | |
1101
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
2519 // Move memory users to their memory slices. |
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
2520 // |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2521 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
|
2522 Compile* C = _compile; |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2523 PhaseGVN* igvn = _igvn; |
1101
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
2524 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
|
2525 assert(tp != NULL, "ptr type"); |
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
2526 int alias_idx = C->get_alias_index(tp); |
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
2527 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
|
2528 |
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
2529 // Move users first |
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
2530 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
|
2531 Node* use = n->fast_out(i); |
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
2532 if (use->is_MergeMem()) { |
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
2533 MergeMemNode* mmem = use->as_MergeMem(); |
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
2534 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
|
2535 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
|
2536 continue; // Nothing to do |
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
2537 } |
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
2538 // Replace previous general reference to mem node. |
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
2539 uint orig_uniq = C->unique(); |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2540 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
|
2541 assert(orig_uniq == C->unique(), "no new nodes"); |
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
2542 mmem->set_memory_at(general_idx, m); |
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
2543 --imax; |
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
2544 --i; |
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
2545 } else if (use->is_MemBar()) { |
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
2546 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
|
2547 if (use->req() > MemBarNode::Precedent && |
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
2548 use->in(MemBarNode::Precedent) == n) { |
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
2549 // Don't move related membars. |
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
2550 record_for_optimizer(use); |
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
2551 continue; |
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
2552 } |
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
2553 tp = use->as_MemBar()->adr_type()->isa_ptr(); |
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
2554 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
|
2555 alias_idx == general_idx) { |
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
2556 continue; // Nothing to do |
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
2557 } |
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
2558 // Move to general memory slice. |
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
2559 uint orig_uniq = C->unique(); |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2560 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
|
2561 assert(orig_uniq == C->unique(), "no new nodes"); |
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
2562 igvn->hash_delete(use); |
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
2563 imax -= use->replace_edge(n, m); |
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
2564 igvn->hash_insert(use); |
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
2565 record_for_optimizer(use); |
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
2566 --i; |
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
2567 #ifdef ASSERT |
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
2568 } else if (use->is_Mem()) { |
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
2569 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
|
2570 // Don't move related cardmark. |
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
2571 continue; |
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
2572 } |
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
2573 // Memory nodes should have new memory input. |
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
2574 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
|
2575 assert(tp != NULL, "ptr type"); |
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
2576 int idx = C->get_alias_index(tp); |
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
2577 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
|
2578 "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
|
2579 } else if (use->is_Phi()) { |
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
2580 // Phi nodes should be split and moved already. |
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
2581 tp = use->as_Phi()->adr_type()->isa_ptr(); |
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
2582 assert(tp != NULL, "ptr type"); |
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
2583 int idx = C->get_alias_index(tp); |
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
2584 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
|
2585 } else { |
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
2586 use->dump(); |
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
2587 assert(false, "should not be here"); |
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
2588 #endif |
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 } |
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
2591 } |
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
2592 |
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
2593 // |
65 | 2594 // Search memory chain of "mem" to find a MemNode whose address |
2595 // is the specified alias index. | |
2596 // | |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2597 Node* ConnectionGraph::find_inst_mem(Node *orig_mem, int alias_idx, GrowableArray<PhiNode *> &orig_phis) { |
65 | 2598 if (orig_mem == NULL) |
2599 return orig_mem; | |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2600 Compile* C = _compile; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2601 PhaseGVN* igvn = _igvn; |
1815 | 2602 const TypeOopPtr *toop = C->get_adr_type(alias_idx)->isa_oopptr(); |
2603 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
|
2604 Node *start_mem = C->start()->proj_out(TypeFunc::Memory); |
65 | 2605 Node *prev = NULL; |
2606 Node *result = orig_mem; | |
2607 while (prev != result) { | |
2608 prev = result; | |
253
b0fe4deeb9fb
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
247
diff
changeset
|
2609 if (result == start_mem) |
605 | 2610 break; // hit one of our sentinels |
65 | 2611 if (result->is_Mem()) { |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2612 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
|
2613 if (at == Type::TOP) |
55973726c600
6992789: assert(phi->_idx >= nodes_size()) failed: only new Phi per instance memory slice
kvn
parents:
2249
diff
changeset
|
2614 break; // Dead |
55973726c600
6992789: assert(phi->_idx >= nodes_size()) failed: only new Phi per instance memory slice
kvn
parents:
2249
diff
changeset
|
2615 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
|
2616 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
|
2617 if (idx == alias_idx) |
55973726c600
6992789: assert(phi->_idx >= nodes_size()) failed: only new Phi per instance memory slice
kvn
parents:
2249
diff
changeset
|
2618 break; // Found |
55973726c600
6992789: assert(phi->_idx >= nodes_size()) failed: only new Phi per instance memory slice
kvn
parents:
2249
diff
changeset
|
2619 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
|
2620 !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
|
2621 break; // Do not skip store to general memory slice. |
65 | 2622 } |
253
b0fe4deeb9fb
6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
kvn
parents:
247
diff
changeset
|
2623 result = result->in(MemNode::Memory); |
65 | 2624 } |
2625 if (!is_instance) | |
2626 continue; // don't search further for non-instance types | |
2627 // skip over a call which does not affect this memory slice | |
2628 if (result->is_Proj() && result->as_Proj()->_con == TypeFunc::Memory) { | |
2629 Node *proj_in = result->in(0); | |
1815 | 2630 if (proj_in->is_Allocate() && proj_in->_idx == (uint)toop->instance_id()) { |
605 | 2631 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
|
2632 } else if (proj_in->is_Call()) { |
65 | 2633 CallNode *call = proj_in->as_Call(); |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2634 if (!call->may_modify(toop, igvn)) { |
65 | 2635 result = call->in(TypeFunc::Memory); |
2636 } | |
2637 } else if (proj_in->is_Initialize()) { | |
2638 AllocateNode* alloc = proj_in->as_Initialize()->allocation(); | |
2639 // Stop if this is the initialization for the object instance which | |
2640 // which contains this memory slice, otherwise skip over it. | |
1815 | 2641 if (alloc == NULL || alloc->_idx != (uint)toop->instance_id()) { |
65 | 2642 result = proj_in->in(TypeFunc::Memory); |
2643 } | |
2644 } else if (proj_in->is_MemBar()) { | |
2645 result = proj_in->in(TypeFunc::Memory); | |
2646 } | |
2647 } else if (result->is_MergeMem()) { | |
2648 MergeMemNode *mmem = result->as_MergeMem(); | |
1815 | 2649 result = step_through_mergemem(mmem, alias_idx, toop); |
65 | 2650 if (result == mmem->base_memory()) { |
2651 // Didn't find instance memory, search through general slice recursively. | |
2652 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
|
2653 result = find_inst_mem(result, alias_idx, orig_phis); |
65 | 2654 if (C->failing()) { |
2655 return NULL; | |
2656 } | |
2657 mmem->set_memory_at(alias_idx, result); | |
2658 } | |
2659 } else if (result->is_Phi() && | |
2660 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
|
2661 Node *un = result->as_Phi()->unique_input(igvn); |
65 | 2662 if (un != NULL) { |
1101
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
2663 orig_phis.append_if_missing(result->as_Phi()); |
65 | 2664 result = un; |
2665 } else { | |
2666 break; | |
2667 } | |
1100
f96a1a986f7b
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
1072
diff
changeset
|
2668 } else if (result->is_ClearArray()) { |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2669 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
|
2670 // Can not bypass initialization of the instance |
f96a1a986f7b
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
1072
diff
changeset
|
2671 // we are looking for. |
f96a1a986f7b
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
1072
diff
changeset
|
2672 break; |
f96a1a986f7b
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
1072
diff
changeset
|
2673 } |
f96a1a986f7b
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
1072
diff
changeset
|
2674 // Otherwise skip it (the call updated 'result' value). |
584 | 2675 } 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
|
2676 Node* mem = result->in(0); |
b30b3c2a0cf2
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
7196
diff
changeset
|
2677 Node* adr = NULL; |
b30b3c2a0cf2
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
7196
diff
changeset
|
2678 if (mem->is_LoadStore()) { |
b30b3c2a0cf2
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
7196
diff
changeset
|
2679 adr = mem->in(MemNode::Address); |
b30b3c2a0cf2
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
7196
diff
changeset
|
2680 } else { |
b30b3c2a0cf2
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
7196
diff
changeset
|
2681 assert(mem->Opcode() == Op_EncodeISOArray, "sanity"); |
b30b3c2a0cf2
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
7196
diff
changeset
|
2682 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
|
2683 } |
b30b3c2a0cf2
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
7196
diff
changeset
|
2684 const Type *at = igvn->type(adr); |
584 | 2685 if (at != Type::TOP) { |
2686 assert (at->isa_ptr() != NULL, "pointer type required."); | |
2687 int idx = C->get_alias_index(at->is_ptr()); | |
2688 assert(idx != alias_idx, "Object is not scalar replaceable if a LoadStore node access its field"); | |
2689 break; | |
2690 } | |
7637
b30b3c2a0cf2
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
7196
diff
changeset
|
2691 result = mem->in(MemNode::Memory); |
65 | 2692 } |
2693 } | |
247 | 2694 if (result->is_Phi()) { |
65 | 2695 PhiNode *mphi = result->as_Phi(); |
2696 assert(mphi->bottom_type() == Type::MEMORY, "memory phi required"); | |
2697 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
|
2698 if (!is_instance) { |
247 | 2699 // Push all non-instance Phis on the orig_phis worklist to update inputs |
2700 // during Phase 4 if needed. | |
2701 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
|
2702 } 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
|
2703 // 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
|
2704 result = split_memory_phi(mphi, alias_idx, orig_phis); |
65 | 2705 } |
2706 } | |
2707 // the result is either MemNode, PhiNode, InitializeNode. | |
2708 return result; | |
2709 } | |
2710 | |
0 | 2711 // |
2712 // Convert the types of unescaped object to instance types where possible, | |
2713 // propagate the new type information through the graph, and update memory | |
2714 // edges and MergeMem inputs to reflect the new type. | |
2715 // | |
2716 // We start with allocations (and calls which may be allocations) on alloc_worklist. | |
2717 // The processing is done in 4 phases: | |
2718 // | |
2719 // Phase 1: Process possible allocations from alloc_worklist. Create instance | |
2720 // types for the CheckCastPP for allocations where possible. | |
2721 // Propagate the the new types through users as follows: | |
2722 // casts and Phi: push users on alloc_worklist | |
2723 // AddP: cast Base and Address inputs to the instance type | |
2724 // push any AddP users on alloc_worklist and push any memnode | |
2725 // users onto memnode_worklist. | |
2726 // Phase 2: Process MemNode's from memnode_worklist. compute new address type and | |
2727 // search the Memory chain for a store with the appropriate type | |
2728 // address type. If a Phi is found, create a new version with | |
605 | 2729 // the appropriate memory slices from each of the Phi inputs. |
0 | 2730 // For stores, process the users as follows: |
2731 // MemNode: push on memnode_worklist | |
2732 // MergeMem: push on mergemem_worklist | |
2733 // Phase 3: Process MergeMem nodes from mergemem_worklist. Walk each memory slice | |
2734 // moving the first node encountered of each instance type to the | |
2735 // the input corresponding to its alias index. | |
2736 // appropriate memory slice. | |
2737 // Phase 4: Update the inputs of non-instance memory Phis and the Memory input of memnodes. | |
2738 // | |
2739 // In the following example, the CheckCastPP nodes are the cast of allocation | |
2740 // results and the allocation of node 29 is unescaped and eligible to be an | |
2741 // instance type. | |
2742 // | |
2743 // We start with: | |
2744 // | |
2745 // 7 Parm #memory | |
2746 // 10 ConI "12" | |
2747 // 19 CheckCastPP "Foo" | |
2748 // 20 AddP _ 19 19 10 Foo+12 alias_index=4 | |
2749 // 29 CheckCastPP "Foo" | |
2750 // 30 AddP _ 29 29 10 Foo+12 alias_index=4 | |
2751 // | |
2752 // 40 StoreP 25 7 20 ... alias_index=4 | |
2753 // 50 StoreP 35 40 30 ... alias_index=4 | |
2754 // 60 StoreP 45 50 20 ... alias_index=4 | |
2755 // 70 LoadP _ 60 30 ... alias_index=4 | |
2756 // 80 Phi 75 50 60 Memory alias_index=4 | |
2757 // 90 LoadP _ 80 30 ... alias_index=4 | |
2758 // 100 LoadP _ 80 20 ... alias_index=4 | |
2759 // | |
2760 // | |
2761 // Phase 1 creates an instance type for node 29 assigning it an instance id of 24 | |
2762 // and creating a new alias index for node 30. This gives: | |
2763 // | |
2764 // 7 Parm #memory | |
2765 // 10 ConI "12" | |
2766 // 19 CheckCastPP "Foo" | |
2767 // 20 AddP _ 19 19 10 Foo+12 alias_index=4 | |
2768 // 29 CheckCastPP "Foo" iid=24 | |
2769 // 30 AddP _ 29 29 10 Foo+12 alias_index=6 iid=24 | |
2770 // | |
2771 // 40 StoreP 25 7 20 ... alias_index=4 | |
2772 // 50 StoreP 35 40 30 ... alias_index=6 | |
2773 // 60 StoreP 45 50 20 ... alias_index=4 | |
2774 // 70 LoadP _ 60 30 ... alias_index=6 | |
2775 // 80 Phi 75 50 60 Memory alias_index=4 | |
2776 // 90 LoadP _ 80 30 ... alias_index=6 | |
2777 // 100 LoadP _ 80 20 ... alias_index=4 | |
2778 // | |
2779 // In phase 2, new memory inputs are computed for the loads and stores, | |
2780 // And a new version of the phi is created. In phase 4, the inputs to | |
2781 // node 80 are updated and then the memory nodes are updated with the | |
2782 // values computed in phase 2. This results in: | |
2783 // | |
2784 // 7 Parm #memory | |
2785 // 10 ConI "12" | |
2786 // 19 CheckCastPP "Foo" | |
2787 // 20 AddP _ 19 19 10 Foo+12 alias_index=4 | |
2788 // 29 CheckCastPP "Foo" iid=24 | |
2789 // 30 AddP _ 29 29 10 Foo+12 alias_index=6 iid=24 | |
2790 // | |
2791 // 40 StoreP 25 7 20 ... alias_index=4 | |
2792 // 50 StoreP 35 7 30 ... alias_index=6 | |
2793 // 60 StoreP 45 40 20 ... alias_index=4 | |
2794 // 70 LoadP _ 50 30 ... alias_index=6 | |
2795 // 80 Phi 75 40 60 Memory alias_index=4 | |
2796 // 120 Phi 75 50 50 Memory alias_index=6 | |
2797 // 90 LoadP _ 120 30 ... alias_index=6 | |
2798 // 100 LoadP _ 80 20 ... alias_index=4 | |
2799 // | |
2800 void ConnectionGraph::split_unique_types(GrowableArray<Node *> &alloc_worklist) { | |
2801 GrowableArray<Node *> memnode_worklist; | |
2802 GrowableArray<PhiNode *> orig_phis; | |
1921 | 2803 PhaseIterGVN *igvn = _igvn; |
0 | 2804 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
|
2805 Arena* arena = Thread::current()->resource_area(); |
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
2806 VectorSet visited(arena); |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2807 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
|
2808 uint unique_old = _compile->unique(); |
65 | 2809 |
2810 // Phase 1: Process possible allocations from alloc_worklist. | |
2811 // Create instance types for the CheckCastPP for allocations where possible. | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
2812 // |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
2813 // (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
|
2814 // 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
|
2815 // see the comment in find_second_addp().) |
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
2816 // |
0 | 2817 while (alloc_worklist.length() != 0) { |
2818 Node *n = alloc_worklist.pop(); | |
2819 uint ni = n->_idx; | |
2820 if (n->is_Call()) { | |
2821 CallNode *alloc = n->as_Call(); | |
2822 // copy escape information to call node | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
2823 PointsToNode* ptn = ptnode_adr(alloc->_idx); |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2824 PointsToNode::EscapeState es = ptn->escape_state(); |
65 | 2825 // We have an allocation or call which returns a Java object, |
2826 // see if it is unescaped. | |
4058
59e515ee9354
7059047: EA: can't find initializing store with several CheckCastPP
kvn
parents:
4046
diff
changeset
|
2827 if (es != PointsToNode::NoEscape || !ptn->scalar_replaceable()) |
0 | 2828 continue; |
784
b2934faac289
6836054: java/util/Arrays/CopyMethods.java fails on solaris-sparc with IllegalArgumentException
kvn
parents:
605
diff
changeset
|
2829 // 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
|
2830 n = alloc->result_cast(); |
b2934faac289
6836054: java/util/Arrays/CopyMethods.java fails on solaris-sparc with IllegalArgumentException
kvn
parents:
605
diff
changeset
|
2831 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
|
2832 if (alloc->is_Allocate()) { |
b2934faac289
6836054: java/util/Arrays/CopyMethods.java fails on solaris-sparc with IllegalArgumentException
kvn
parents:
605
diff
changeset
|
2833 // 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
|
2834 // 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
|
2835 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
|
2836 } |
10278 | 2837 if (alloc->is_CallStaticJava()) { |
2838 // Set the scalar_replaceable flag for boxing method | |
2839 // so it could be eliminated if it has no uses. | |
2840 alloc->as_CallStaticJava()->_is_scalar_replaceable = true; | |
2841 } | |
784
b2934faac289
6836054: java/util/Arrays/CopyMethods.java fails on solaris-sparc with IllegalArgumentException
kvn
parents:
605
diff
changeset
|
2842 continue; |
39
76256d272075
6667612: (Escape Analysis) disable loop cloning if it has a scalar replaceable allocation
kvn
parents:
38
diff
changeset
|
2843 } |
784
b2934faac289
6836054: java/util/Arrays/CopyMethods.java fails on solaris-sparc with IllegalArgumentException
kvn
parents:
605
diff
changeset
|
2844 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
|
2845 assert(!alloc->is_Allocate(), "allocation should have unique type"); |
65 | 2846 continue; |
784
b2934faac289
6836054: java/util/Arrays/CopyMethods.java fails on solaris-sparc with IllegalArgumentException
kvn
parents:
605
diff
changeset
|
2847 } |
b2934faac289
6836054: java/util/Arrays/CopyMethods.java fails on solaris-sparc with IllegalArgumentException
kvn
parents:
605
diff
changeset
|
2848 |
65 | 2849 // The inline code for Object.clone() casts the allocation result to |
247 | 2850 // java.lang.Object and then to the actual type of the allocated |
65 | 2851 // object. Detect this case and use the second cast. |
247 | 2852 // Also detect j.l.reflect.Array.newInstance(jobject, jint) case when |
2853 // the allocation result is cast to java.lang.Object and then | |
2854 // to the actual Array type. | |
65 | 2855 if (alloc->is_Allocate() && n->as_Type()->type() == TypeInstPtr::NOTNULL |
247 | 2856 && (alloc->is_AllocateArray() || |
2857 igvn->type(alloc->in(AllocateNode::KlassNode)) != TypeKlassPtr::OBJECT)) { | |
65 | 2858 Node *cast2 = NULL; |
2859 for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) { | |
2860 Node *use = n->fast_out(i); | |
2861 if (use->is_CheckCastPP()) { | |
2862 cast2 = use; | |
2863 break; | |
2864 } | |
2865 } | |
2866 if (cast2 != NULL) { | |
2867 n = cast2; | |
2868 } else { | |
784
b2934faac289
6836054: java/util/Arrays/CopyMethods.java fails on solaris-sparc with IllegalArgumentException
kvn
parents:
605
diff
changeset
|
2869 // 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
|
2870 // (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
|
2871 // deoptimization without precise type. |
65 | 2872 continue; |
2873 } | |
2874 } | |
20572
87f199a9c1b1
8058825: EA: ConnectionGraph::split_unique_types does incorrect scalar replacement
vlivanov
parents:
20438
diff
changeset
|
2875 |
87f199a9c1b1
8058825: EA: ConnectionGraph::split_unique_types does incorrect scalar replacement
vlivanov
parents:
20438
diff
changeset
|
2876 const TypeOopPtr *t = igvn->type(n)->isa_oopptr(); |
87f199a9c1b1
8058825: EA: ConnectionGraph::split_unique_types does incorrect scalar replacement
vlivanov
parents:
20438
diff
changeset
|
2877 if (t == NULL) |
87f199a9c1b1
8058825: EA: ConnectionGraph::split_unique_types does incorrect scalar replacement
vlivanov
parents:
20438
diff
changeset
|
2878 continue; // not a TypeOopPtr |
87f199a9c1b1
8058825: EA: ConnectionGraph::split_unique_types does incorrect scalar replacement
vlivanov
parents:
20438
diff
changeset
|
2879 if (!t->klass_is_exact()) |
87f199a9c1b1
8058825: EA: ConnectionGraph::split_unique_types does incorrect scalar replacement
vlivanov
parents:
20438
diff
changeset
|
2880 continue; // not an unique type |
87f199a9c1b1
8058825: EA: ConnectionGraph::split_unique_types does incorrect scalar replacement
vlivanov
parents:
20438
diff
changeset
|
2881 |
784
b2934faac289
6836054: java/util/Arrays/CopyMethods.java fails on solaris-sparc with IllegalArgumentException
kvn
parents:
605
diff
changeset
|
2882 if (alloc->is_Allocate()) { |
b2934faac289
6836054: java/util/Arrays/CopyMethods.java fails on solaris-sparc with IllegalArgumentException
kvn
parents:
605
diff
changeset
|
2883 // 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
|
2884 // so it could be eliminated. |
b2934faac289
6836054: java/util/Arrays/CopyMethods.java fails on solaris-sparc with IllegalArgumentException
kvn
parents:
605
diff
changeset
|
2885 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
|
2886 } |
10278 | 2887 if (alloc->is_CallStaticJava()) { |
2888 // Set the scalar_replaceable flag for boxing method | |
2889 // so it could be eliminated. | |
2890 alloc->as_CallStaticJava()->_is_scalar_replaceable = true; | |
2891 } | |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2892 set_escape_state(ptnode_adr(n->_idx), es); // CheckCastPP escape state |
247 | 2893 // in order for an object to be scalar-replaceable, it must be: |
65 | 2894 // - a direct allocation (not a call returning an object) |
2895 // - non-escaping | |
2896 // - eligible to be a unique type | |
2897 // - 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
|
2898 set_map(alloc, n); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2899 set_map(n, alloc); |
20572
87f199a9c1b1
8058825: EA: ConnectionGraph::split_unique_types does incorrect scalar replacement
vlivanov
parents:
20438
diff
changeset
|
2900 const TypeOopPtr* tinst = t->cast_to_instance_id(ni); |
0 | 2901 igvn->hash_delete(n); |
2902 igvn->set_type(n, tinst); | |
2903 n->raise_bottom_type(tinst); | |
2904 igvn->hash_insert(n); | |
65 | 2905 record_for_optimizer(n); |
4058
59e515ee9354
7059047: EA: can't find initializing store with several CheckCastPP
kvn
parents:
4046
diff
changeset
|
2906 if (alloc->is_Allocate() && (t->isa_instptr() || t->isa_aryptr())) { |
163 | 2907 |
2908 // First, put on the worklist all Field edges from Connection Graph | |
2909 // 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
|
2910 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
|
2911 PointsToNode* tgt = e.get(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2912 Node* use = tgt->ideal_node(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2913 assert(tgt->is_Field() && use->is_AddP(), |
163 | 2914 "only AddP nodes are Field edges in CG"); |
2915 if (use->outcnt() > 0) { // Don't process dead nodes | |
2916 Node* addp2 = find_second_addp(use, use->in(AddPNode::Base)); | |
2917 if (addp2 != NULL) { | |
2918 assert(alloc->is_AllocateArray(),"array allocation was expected"); | |
2919 alloc_worklist.append_if_missing(addp2); | |
2920 } | |
2921 alloc_worklist.append_if_missing(use); | |
2922 } | |
2923 } | |
2924 | |
65 | 2925 // An allocation may have an Initialize which has raw stores. Scan |
2926 // the users of the raw allocation result and push AddP users | |
2927 // on alloc_worklist. | |
2928 Node *raw_result = alloc->proj_out(TypeFunc::Parms); | |
2929 assert (raw_result != NULL, "must have an allocation result"); | |
2930 for (DUIterator_Fast imax, i = raw_result->fast_outs(imax); i < imax; i++) { | |
2931 Node *use = raw_result->fast_out(i); | |
2932 if (use->is_AddP() && use->outcnt() > 0) { // Don't process dead nodes | |
2933 Node* addp2 = find_second_addp(use, raw_result); | |
2934 if (addp2 != NULL) { | |
2935 assert(alloc->is_AllocateArray(),"array allocation was expected"); | |
2936 alloc_worklist.append_if_missing(addp2); | |
2937 } | |
2938 alloc_worklist.append_if_missing(use); | |
1100
f96a1a986f7b
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
1072
diff
changeset
|
2939 } else if (use->is_MemBar()) { |
65 | 2940 memnode_worklist.append_if_missing(use); |
2941 } | |
2942 } | |
2943 } | |
0 | 2944 } else if (n->is_AddP()) { |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2945 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
|
2946 if (jobj == NULL || jobj == phantom_obj) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2947 #ifdef ASSERT |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2948 ptnode_adr(get_addp_base(n)->_idx)->dump(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2949 ptnode_adr(n->_idx)->dump(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2950 assert(jobj != NULL && jobj != phantom_obj, "escaped allocation"); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2951 #endif |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2952 _compile->record_failure(C2Compiler::retry_no_escape_analysis()); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2953 return; |
1100
f96a1a986f7b
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
1072
diff
changeset
|
2954 } |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2955 Node *base = get_map(jobj->idx()); // CheckCastPP node |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2956 if (!split_AddP(n, base)) continue; // wrong type from dead path |
65 | 2957 } else if (n->is_Phi() || |
2958 n->is_CheckCastPP() || | |
168
7793bd37a336
6705887: Compressed Oops: generate x64 addressing and implicit null checks with narrow oops
kvn
parents:
164
diff
changeset
|
2959 n->is_EncodeP() || |
7793bd37a336
6705887: Compressed Oops: generate x64 addressing and implicit null checks with narrow oops
kvn
parents:
164
diff
changeset
|
2960 n->is_DecodeN() || |
65 | 2961 (n->is_ConstraintCast() && n->Opcode() == Op_CastPP)) { |
0 | 2962 if (visited.test_set(n->_idx)) { |
2963 assert(n->is_Phi(), "loops only through Phi's"); | |
2964 continue; // already processed | |
2965 } | |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2966 JavaObjectNode* jobj = unique_java_object(n); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2967 if (jobj == NULL || jobj == phantom_obj) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2968 #ifdef ASSERT |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2969 ptnode_adr(n->_idx)->dump(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2970 assert(jobj != NULL && jobj != phantom_obj, "escaped allocation"); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2971 #endif |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2972 _compile->record_failure(C2Compiler::retry_no_escape_analysis()); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2973 return; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2974 } else { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2975 Node *val = get_map(jobj->idx()); // CheckCastPP node |
0 | 2976 TypeNode *tn = n->as_Type(); |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2977 const TypeOopPtr* tinst = igvn->type(val)->isa_oopptr(); |
223 | 2978 assert(tinst != NULL && tinst->is_known_instance() && |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
2979 tinst->instance_id() == jobj->idx() , "instance type expected."); |
163 | 2980 |
2981 const Type *tn_type = igvn->type(tn); | |
223 | 2982 const TypeOopPtr *tn_t; |
2983 if (tn_type->isa_narrowoop()) { | |
2984 tn_t = tn_type->make_ptr()->isa_oopptr(); | |
2985 } else { | |
2986 tn_t = tn_type->isa_oopptr(); | |
2987 } | |
1100
f96a1a986f7b
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
1072
diff
changeset
|
2988 if (tn_t != NULL && tinst->klass()->is_subtype_of(tn_t->klass())) { |
163 | 2989 if (tn_type->isa_narrowoop()) { |
2990 tn_type = tinst->make_narrowoop(); | |
2991 } else { | |
2992 tn_type = tinst; | |
2993 } | |
0 | 2994 igvn->hash_delete(tn); |
163 | 2995 igvn->set_type(tn, tn_type); |
2996 tn->set_type(tn_type); | |
0 | 2997 igvn->hash_insert(tn); |
65 | 2998 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
|
2999 } else { |
1100
f96a1a986f7b
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
1072
diff
changeset
|
3000 assert(tn_type == TypePtr::NULL_PTR || |
f96a1a986f7b
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
1072
diff
changeset
|
3001 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
|
3002 "unexpected type"); |
f96a1a986f7b
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
1072
diff
changeset
|
3003 continue; // Skip dead path with different type |
0 | 3004 } |
3005 } | |
3006 } else { | |
1100
f96a1a986f7b
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
1072
diff
changeset
|
3007 debug_only(n->dump();) |
f96a1a986f7b
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
1072
diff
changeset
|
3008 assert(false, "EA: unexpected node"); |
0 | 3009 continue; |
3010 } | |
1100
f96a1a986f7b
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
1072
diff
changeset
|
3011 // push allocation's users on appropriate worklist |
0 | 3012 for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) { |
3013 Node *use = n->fast_out(i); | |
3014 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
|
3015 // Load/store to instance's field |
65 | 3016 memnode_worklist.append_if_missing(use); |
1100
f96a1a986f7b
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
1072
diff
changeset
|
3017 } else if (use->is_MemBar()) { |
10278 | 3018 if (use->in(TypeFunc::Memory) == n) { // Ignore precedent edge |
3019 memnode_worklist.append_if_missing(use); | |
3020 } | |
65 | 3021 } else if (use->is_AddP() && use->outcnt() > 0) { // No dead nodes |
3022 Node* addp2 = find_second_addp(use, n); | |
3023 if (addp2 != NULL) { | |
3024 alloc_worklist.append_if_missing(addp2); | |
3025 } | |
3026 alloc_worklist.append_if_missing(use); | |
3027 } else if (use->is_Phi() || | |
3028 use->is_CheckCastPP() || | |
6848
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6795
diff
changeset
|
3029 use->is_EncodeNarrowPtr() || |
8e47bac5643a
7054512: Compress class pointers after perm gen removal
roland
parents:
6795
diff
changeset
|
3030 use->is_DecodeNarrowPtr() || |
65 | 3031 (use->is_ConstraintCast() && use->Opcode() == Op_CastPP)) { |
3032 alloc_worklist.append_if_missing(use); | |
1100
f96a1a986f7b
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
1072
diff
changeset
|
3033 #ifdef ASSERT |
f96a1a986f7b
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
1072
diff
changeset
|
3034 } else if (use->is_Mem()) { |
f96a1a986f7b
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
1072
diff
changeset
|
3035 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
|
3036 } else if (use->is_MergeMem()) { |
f96a1a986f7b
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
1072
diff
changeset
|
3037 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
|
3038 } else if (use->is_SafePoint()) { |
f96a1a986f7b
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
1072
diff
changeset
|
3039 // 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
|
3040 // (through CheckCastPP nodes) even for debug info. |
f96a1a986f7b
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
1072
diff
changeset
|
3041 Node* m = use->in(TypeFunc::Memory); |
f96a1a986f7b
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
1072
diff
changeset
|
3042 if (m->is_MergeMem()) { |
f96a1a986f7b
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
1072
diff
changeset
|
3043 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
|
3044 } |
7637
b30b3c2a0cf2
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
7196
diff
changeset
|
3045 } else if (use->Opcode() == Op_EncodeISOArray) { |
b30b3c2a0cf2
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
7196
diff
changeset
|
3046 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
|
3047 // EncodeISOArray overwrites destination array |
b30b3c2a0cf2
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
7196
diff
changeset
|
3048 memnode_worklist.append_if_missing(use); |
b30b3c2a0cf2
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
7196
diff
changeset
|
3049 } |
1100
f96a1a986f7b
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
1072
diff
changeset
|
3050 } else { |
f96a1a986f7b
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
1072
diff
changeset
|
3051 uint op = use->Opcode(); |
f96a1a986f7b
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
1072
diff
changeset
|
3052 if (!(op == Op_CmpP || op == Op_Conv2B || |
f96a1a986f7b
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
1072
diff
changeset
|
3053 op == Op_CastP2X || op == Op_StoreCM || |
f96a1a986f7b
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
1072
diff
changeset
|
3054 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
|
3055 op == Op_StrEquals || op == Op_StrIndexOf)) { |
f96a1a986f7b
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
1072
diff
changeset
|
3056 n->dump(); |
f96a1a986f7b
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
1072
diff
changeset
|
3057 use->dump(); |
f96a1a986f7b
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
1072
diff
changeset
|
3058 assert(false, "EA: missing allocation reference path"); |
f96a1a986f7b
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
1072
diff
changeset
|
3059 } |
f96a1a986f7b
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
1072
diff
changeset
|
3060 #endif |
0 | 3061 } |
3062 } | |
3063 | |
3064 } | |
65 | 3065 // New alias types were created in split_AddP(). |
0 | 3066 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
|
3067 assert(unique_old == _compile->unique(), "there should be no new ideal nodes after Phase 1"); |
0 | 3068 |
3069 // Phase 2: Process MemNode's from memnode_worklist. compute new address type and | |
3070 // compute new values for Memory inputs (the Memory inputs are not | |
3071 // actually updated until phase 4.) | |
3072 if (memnode_worklist.length() == 0) | |
3073 return; // nothing to do | |
3074 while (memnode_worklist.length() != 0) { | |
3075 Node *n = memnode_worklist.pop(); | |
65 | 3076 if (visited.test_set(n->_idx)) |
3077 continue; | |
1100
f96a1a986f7b
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
1072
diff
changeset
|
3078 if (n->is_Phi() || n->is_ClearArray()) { |
f96a1a986f7b
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
1072
diff
changeset
|
3079 // 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
|
3080 } 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
|
3081 // 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
|
3082 n = n->as_MemBar()->proj_out(TypeFunc::Memory); |
65 | 3083 if (n == NULL) |
0 | 3084 continue; |
7637
b30b3c2a0cf2
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
7196
diff
changeset
|
3085 } else if (n->Opcode() == Op_EncodeISOArray) { |
b30b3c2a0cf2
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
7196
diff
changeset
|
3086 // get the memory projection |
b30b3c2a0cf2
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
7196
diff
changeset
|
3087 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
|
3088 Node *use = n->fast_out(i); |
b30b3c2a0cf2
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
7196
diff
changeset
|
3089 if (use->Opcode() == Op_SCMemProj) { |
b30b3c2a0cf2
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
7196
diff
changeset
|
3090 n = use; |
b30b3c2a0cf2
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
7196
diff
changeset
|
3091 break; |
b30b3c2a0cf2
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
7196
diff
changeset
|
3092 } |
b30b3c2a0cf2
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
7196
diff
changeset
|
3093 } |
b30b3c2a0cf2
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
7196
diff
changeset
|
3094 assert(n->Opcode() == Op_SCMemProj, "memory projection required"); |
0 | 3095 } else { |
3096 assert(n->is_Mem(), "memory node required."); | |
3097 Node *addr = n->in(MemNode::Address); | |
3098 const Type *addr_t = igvn->type(addr); | |
3099 if (addr_t == Type::TOP) | |
3100 continue; | |
3101 assert (addr_t->isa_ptr() != NULL, "pointer type required."); | |
3102 int alias_idx = _compile->get_alias_index(addr_t->is_ptr()); | |
65 | 3103 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
|
3104 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
|
3105 if (_compile->failing()) { |
b789bcaf2dd9
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
0
diff
changeset
|
3106 return; |
b789bcaf2dd9
6667610: (Escape Analysis) retry compilation without EA if it fails
kvn
parents:
0
diff
changeset
|
3107 } |
65 | 3108 if (mem != n->in(MemNode::Memory)) { |
1101
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
3109 // 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
|
3110 // 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
|
3111 set_map(n, mem); |
65 | 3112 } |
0 | 3113 if (n->is_Load()) { |
3114 continue; // don't push users | |
3115 } else if (n->is_LoadStore()) { | |
3116 // get the memory projection | |
3117 for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) { | |
3118 Node *use = n->fast_out(i); | |
3119 if (use->Opcode() == Op_SCMemProj) { | |
3120 n = use; | |
3121 break; | |
3122 } | |
3123 } | |
3124 assert(n->Opcode() == Op_SCMemProj, "memory projection required"); | |
3125 } | |
3126 } | |
3127 // push user on appropriate worklist | |
3128 for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) { | |
3129 Node *use = n->fast_out(i); | |
1100
f96a1a986f7b
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
1072
diff
changeset
|
3130 if (use->is_Phi() || use->is_ClearArray()) { |
65 | 3131 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
|
3132 } 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
|
3133 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
|
3134 continue; |
65 | 3135 memnode_worklist.append_if_missing(use); |
1100
f96a1a986f7b
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
1072
diff
changeset
|
3136 } else if (use->is_MemBar()) { |
10278 | 3137 if (use->in(TypeFunc::Memory) == n) { // Ignore precedent edge |
3138 memnode_worklist.append_if_missing(use); | |
3139 } | |
1100
f96a1a986f7b
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
1072
diff
changeset
|
3140 #ifdef ASSERT |
f96a1a986f7b
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
1072
diff
changeset
|
3141 } else if(use->is_Mem()) { |
f96a1a986f7b
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
1072
diff
changeset
|
3142 assert(use->in(MemNode::Memory) != n, "EA: missing memory path"); |
0 | 3143 } else if (use->is_MergeMem()) { |
1100
f96a1a986f7b
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
1072
diff
changeset
|
3144 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
|
3145 } else if (use->Opcode() == Op_EncodeISOArray) { |
b30b3c2a0cf2
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
7196
diff
changeset
|
3146 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
|
3147 // EncodeISOArray overwrites destination array |
b30b3c2a0cf2
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
7196
diff
changeset
|
3148 memnode_worklist.append_if_missing(use); |
b30b3c2a0cf2
6896617: Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() on x86
kvn
parents:
7196
diff
changeset
|
3149 } |
1100
f96a1a986f7b
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
1072
diff
changeset
|
3150 } else { |
f96a1a986f7b
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
1072
diff
changeset
|
3151 uint op = use->Opcode(); |
f96a1a986f7b
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
1072
diff
changeset
|
3152 if (!(op == Op_StoreCM || |
f96a1a986f7b
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
1072
diff
changeset
|
3153 (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
|
3154 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
|
3155 op == Op_AryEq || op == Op_StrComp || |
f96a1a986f7b
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
1072
diff
changeset
|
3156 op == Op_StrEquals || op == Op_StrIndexOf)) { |
f96a1a986f7b
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
1072
diff
changeset
|
3157 n->dump(); |
f96a1a986f7b
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
1072
diff
changeset
|
3158 use->dump(); |
f96a1a986f7b
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
1072
diff
changeset
|
3159 assert(false, "EA: missing memory path"); |
f96a1a986f7b
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
1072
diff
changeset
|
3160 } |
f96a1a986f7b
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
1072
diff
changeset
|
3161 #endif |
0 | 3162 } |
3163 } | |
3164 } | |
3165 | |
65 | 3166 // 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
|
3167 // Walk each memory slice moving the first node encountered of each |
65 | 3168 // 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
|
3169 uint length = _mergemem_worklist.length(); |
f96a1a986f7b
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
1072
diff
changeset
|
3170 for( uint next = 0; next < length; ++next ) { |
f96a1a986f7b
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
1072
diff
changeset
|
3171 MergeMemNode* nmm = _mergemem_worklist.at(next); |
f96a1a986f7b
6895383: JCK test throws NPE for method compiled with Escape Analysis
kvn
parents:
1072
diff
changeset
|
3172 assert(!visited.test_set(nmm->_idx), "should not be visited before"); |
0 | 3173 // 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
|
3174 // 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
|
3175 // 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
|
3176 // 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
|
3177 igvn->hash_delete(nmm); |
0 | 3178 uint nslices = nmm->req(); |
3179 for (uint i = Compile::AliasIdxRaw+1; i < nslices; i++) { | |
65 | 3180 Node* mem = nmm->in(i); |
3181 Node* cur = NULL; | |
0 | 3182 if (mem == NULL || mem->is_top()) |
3183 continue; | |
1101
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
3184 // 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
|
3185 // if their type became more precise since this mergemem was created. |
0 | 3186 while (mem->is_Mem()) { |
3187 const Type *at = igvn->type(mem->in(MemNode::Address)); | |
3188 if (at != Type::TOP) { | |
3189 assert (at->isa_ptr() != NULL, "pointer type required."); | |
3190 uint idx = (uint)_compile->get_alias_index(at->is_ptr()); | |
3191 if (idx == i) { | |
3192 if (cur == NULL) | |
3193 cur = mem; | |
3194 } else { | |
3195 if (idx >= nmm->req() || nmm->is_empty_memory(nmm->in(idx))) { | |
3196 nmm->set_memory_at(idx, mem); | |
3197 } | |
3198 } | |
3199 } | |
3200 mem = mem->in(MemNode::Memory); | |
3201 } | |
3202 nmm->set_memory_at(i, (cur != NULL) ? cur : mem); | |
65 | 3203 // 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
|
3204 // already a memory slice of the instance along the memory chain. |
65 | 3205 for (uint ni = new_index_start; ni < new_index_end; ni++) { |
3206 if((uint)_compile->get_general_index(ni) == i) { | |
3207 Node *m = (ni >= nmm->req()) ? nmm->empty_memory() : nmm->in(ni); | |
3208 if (nmm->is_empty_memory(m)) { | |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3209 Node* result = find_inst_mem(mem, ni, orig_phis); |
65 | 3210 if (_compile->failing()) { |
3211 return; | |
3212 } | |
3213 nmm->set_memory_at(ni, result); | |
3214 } | |
3215 } | |
3216 } | |
3217 } | |
3218 // Find the rest of instances values | |
3219 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
|
3220 const TypeOopPtr *tinst = _compile->get_adr_type(ni)->isa_oopptr(); |
65 | 3221 Node* result = step_through_mergemem(nmm, ni, tinst); |
3222 if (result == nmm->base_memory()) { | |
3223 // 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
|
3224 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
|
3225 result = find_inst_mem(result, ni, orig_phis); |
65 | 3226 if (_compile->failing()) { |
3227 return; | |
3228 } | |
3229 nmm->set_memory_at(ni, result); | |
3230 } | |
3231 } | |
3232 igvn->hash_insert(nmm); | |
3233 record_for_optimizer(nmm); | |
0 | 3234 } |
3235 | |
65 | 3236 // Phase 4: Update the inputs of non-instance memory Phis and |
3237 // the Memory input of memnodes | |
0 | 3238 // First update the inputs of any non-instance Phi's from |
3239 // which we split out an instance Phi. Note we don't have | |
3240 // to recursively process Phi's encounted on the input memory | |
3241 // chains as is done in split_memory_phi() since they will | |
3242 // also be processed here. | |
247 | 3243 for (int j = 0; j < orig_phis.length(); j++) { |
3244 PhiNode *phi = orig_phis.at(j); | |
0 | 3245 int alias_idx = _compile->get_alias_index(phi->adr_type()); |
3246 igvn->hash_delete(phi); | |
3247 for (uint i = 1; i < phi->req(); i++) { | |
3248 Node *mem = phi->in(i); | |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3249 Node *new_mem = find_inst_mem(mem, alias_idx, orig_phis); |
65 | 3250 if (_compile->failing()) { |
3251 return; | |
3252 } | |
0 | 3253 if (mem != new_mem) { |
3254 phi->set_req(i, new_mem); | |
3255 } | |
3256 } | |
3257 igvn->hash_insert(phi); | |
3258 record_for_optimizer(phi); | |
3259 } | |
3260 | |
3261 // 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
|
3262 // 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
|
3263 // 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
|
3264 // 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
|
3265 #if 0 // ifdef ASSERT |
2249 | 3266 visited.Reset(); |
1101
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
3267 Node_Stack old_mems(arena, _compile->unique() >> 2); |
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
3268 #endif |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3269 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
|
3270 Node* n = ideal_nodes.at(i); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3271 Node* nmem = get_map(n->_idx); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3272 assert(nmem != NULL, "sanity"); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3273 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
|
3274 #if 0 // ifdef ASSERT |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3275 Node* old_mem = n->in(MemNode::Memory); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3276 if (!visited.test_set(old_mem->_idx)) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3277 old_mems.push(old_mem, old_mem->outcnt()); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3278 } |
1101
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
3279 #endif |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3280 assert(n->in(MemNode::Memory) != nmem, "sanity"); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3281 if (!n->is_Load()) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3282 // Move memory users of a store first. |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3283 move_inst_mem(n, orig_phis); |
0 | 3284 } |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3285 // Now update memory input |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3286 igvn->hash_delete(n); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3287 n->set_req(MemNode::Memory, nmem); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3288 igvn->hash_insert(n); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3289 record_for_optimizer(n); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3290 } else { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3291 assert(n->is_Allocate() || n->is_CheckCastPP() || |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3292 n->is_AddP() || n->is_Phi(), "unknown node used for set_map()"); |
0 | 3293 } |
3294 } | |
3278
66b0e2371912
7026700: regression in 6u24-rev-b23: Crash in C2 compiler in PhaseIdealLoop::build_loop_late_post
kvn
parents:
2459
diff
changeset
|
3295 #if 0 // ifdef ASSERT |
1101
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
3296 // Verify that memory was split correctly |
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
3297 while (old_mems.is_nonempty()) { |
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
3298 Node* old_mem = old_mems.node(); |
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
3299 uint old_cnt = old_mems.index(); |
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
3300 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
|
3301 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
|
3302 } |
7fee0a6cc6d4
6896727: nsk/logging/LoggingPermission/LoggingPermission/logperm002 fails with G1, EscapeAnalisys
kvn
parents:
1100
diff
changeset
|
3303 #endif |
0 | 3304 } |
3305 | |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3306 #ifndef PRODUCT |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3307 static const char *node_type_names[] = { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3308 "UnknownType", |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3309 "JavaObject", |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3310 "LocalVar", |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3311 "Field", |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3312 "Arraycopy" |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3313 }; |
4937
73df3733f2eb
7129284: +DoEscapeAnalysis regression w/ early build of 7u4 (HotSpot 23) on Linux
kvn
parents:
4777
diff
changeset
|
3314 |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3315 static const char *esc_names[] = { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3316 "UnknownEscape", |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3317 "NoEscape", |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3318 "ArgEscape", |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3319 "GlobalEscape" |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3320 }; |
0 | 3321 |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3322 void PointsToNode::dump(bool print_state) const { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3323 NodeType nt = node_type(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3324 tty->print("%s ", node_type_names[(int) nt]); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3325 if (print_state) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3326 EscapeState es = escape_state(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3327 EscapeState fields_es = fields_escape_state(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3328 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
|
3329 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
|
3330 tty->print("NSR "); |
4113 | 3331 } |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3332 if (is_Field()) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3333 FieldNode* f = (FieldNode*)this; |
6944
f3da5ff1514c
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
6895
diff
changeset
|
3334 if (f->is_oop()) |
f3da5ff1514c
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
6895
diff
changeset
|
3335 tty->print("oop "); |
f3da5ff1514c
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
6895
diff
changeset
|
3336 if (f->offset() > 0) |
f3da5ff1514c
8002069: Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
kvn
parents:
6895
diff
changeset
|
3337 tty->print("+%d ", f->offset()); |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3338 tty->print("("); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3339 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
|
3340 PointsToNode* b = i.get(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3341 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
|
3342 } |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3343 tty->print(" )"); |
0 | 3344 } |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3345 tty->print("["); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3346 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
|
3347 PointsToNode* e = i.get(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3348 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
|
3349 } |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3350 tty->print(" ["); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3351 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
|
3352 PointsToNode* u = i.get(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3353 bool is_base = false; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3354 if (PointsToNode::is_base_use(u)) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3355 is_base = true; |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3356 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
|
3357 } |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3358 tty->print(" %d%s%s", u->idx(), is_base ? "b" : "", u->is_Arraycopy() ? "cp" : ""); |
4113 | 3359 } |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3360 tty->print(" ]] "); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3361 if (_node == NULL) |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3362 tty->print_cr("<null>"); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3363 else |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3364 _node->dump(); |
4113 | 3365 } |
3366 | |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3367 void ConnectionGraph::dump(GrowableArray<PointsToNode*>& ptnodes_worklist) { |
0 | 3368 bool first = true; |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3369 int ptnodes_length = ptnodes_worklist.length(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3370 for (int i = 0; i < ptnodes_length; i++) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3371 PointsToNode *ptn = ptnodes_worklist.at(i); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3372 if (ptn == NULL || !ptn->is_JavaObject()) |
0 | 3373 continue; |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3374 PointsToNode::EscapeState es = ptn->escape_state(); |
10278 | 3375 if ((es != PointsToNode::NoEscape) && !Verbose) { |
3376 continue; | |
3377 } | |
3378 Node* n = ptn->ideal_node(); | |
3379 if (n->is_Allocate() || (n->is_CallStaticJava() && | |
3380 n->as_CallStaticJava()->is_boxing_method())) { | |
65 | 3381 if (first) { |
3382 tty->cr(); | |
3383 tty->print("======== Connection graph for "); | |
244
524eca34ea76
6684714: Optimize EA Connection Graph build performance
kvn
parents:
223
diff
changeset
|
3384 _compile->method()->print_short_name(); |
65 | 3385 tty->cr(); |
3386 first = false; | |
3387 } | |
3388 ptn->dump(); | |
5948
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3389 // 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
|
3390 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
|
3391 PointsToNode* use = j.get(); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3392 if (use->is_LocalVar()) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3393 use->dump(Verbose); |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3394 } else if (Verbose) { |
ee138854b3a6
7147744: CTW: assert(false) failed: infinite EA connection graph build
kvn
parents:
5901
diff
changeset
|
3395 use->dump(); |
65 | 3396 } |
3397 } | |
3398 tty->cr(); | |
0 | 3399 } |
3400 } | |
3401 } | |
3402 #endif |