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