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