134
135 ResourceMark rm;
136 Unique_Node_List work;
137 // Go over all the uses of the node that is considered for replacement...
138 for (DUIterator j = initial->outs(); initial->has_out(j); j++) {
139 Node* use = initial->out(j);
140
141 if (use == improved || use->outcnt() == 0) {
142 continue;
143 }
144 work.clear();
145 enqueue_use(initial, use, work);
146 bool replace = true;
147 // Check that this use is dominated by ctl. Go ahead with the
148 // replacement if it is.
149 while (work.size() != 0 && replace) {
150 Node* n = work.pop();
151 if (use->outcnt() == 0) {
152 continue;
153 }
154 if (n->is_CFG() || (n->in(0) != NULL && !n->in(0)->is_top())) {
155 int depth = 0;
156 Node *m = n;
157 if (!n->is_CFG()) {
158 n = n->in(0);
159 }
160 assert(n->is_CFG(), "should be CFG now");
161 while(n != ctl) {
162 n = IfNode::up_one_dom(n);
163 depth++;
164 // limit search depth
165 if (depth >= 100 || n == NULL) {
166 replace = false;
167 break;
168 }
169 }
170 } else {
171 for (DUIterator k = n->outs(); n->has_out(k); k++) {
172 enqueue_use(n, n->out(k), work);
173 }
174 }
|
134
135 ResourceMark rm;
136 Unique_Node_List work;
137 // Go over all the uses of the node that is considered for replacement...
138 for (DUIterator j = initial->outs(); initial->has_out(j); j++) {
139 Node* use = initial->out(j);
140
141 if (use == improved || use->outcnt() == 0) {
142 continue;
143 }
144 work.clear();
145 enqueue_use(initial, use, work);
146 bool replace = true;
147 // Check that this use is dominated by ctl. Go ahead with the
148 // replacement if it is.
149 while (work.size() != 0 && replace) {
150 Node* n = work.pop();
151 if (use->outcnt() == 0) {
152 continue;
153 }
154 if (n->is_CFG() || (n->in(0) != NULL && !n->in(0)->is_top()) && n->Opcode() != Op_ShenandoahWBMemProj) {
155 int depth = 0;
156 Node *m = n;
157 if (!n->is_CFG()) {
158 n = n->in(0);
159 }
160 assert(n->is_CFG(), "should be CFG now");
161 while(n != ctl) {
162 n = IfNode::up_one_dom(n);
163 depth++;
164 // limit search depth
165 if (depth >= 100 || n == NULL) {
166 replace = false;
167 break;
168 }
169 }
170 } else {
171 for (DUIterator k = n->outs(); n->has_out(k); k++) {
172 enqueue_use(n, n->out(k), work);
173 }
174 }
|