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