src/share/vm/opto/node.cpp

changeset 6657
3636afd5ec1a
parent 6507
752ba2e5f6d0
child 6680
78bbf4d43a14
equal deleted inserted replaced
6656:1eba0601f0dd 6657:3636afd5ec1a
25 #include "precompiled.hpp" 25 #include "precompiled.hpp"
26 #include "libadt/vectset.hpp" 26 #include "libadt/vectset.hpp"
27 #include "memory/allocation.inline.hpp" 27 #include "memory/allocation.inline.hpp"
28 #include "opto/cfgnode.hpp" 28 #include "opto/cfgnode.hpp"
29 #include "opto/connode.hpp" 29 #include "opto/connode.hpp"
30 #include "opto/loopnode.hpp"
30 #include "opto/machnode.hpp" 31 #include "opto/machnode.hpp"
31 #include "opto/matcher.hpp" 32 #include "opto/matcher.hpp"
32 #include "opto/node.hpp" 33 #include "opto/node.hpp"
33 #include "opto/opcodes.hpp" 34 #include "opto/opcodes.hpp"
34 #include "opto/regmask.hpp" 35 #include "opto/regmask.hpp"
1253 // for verify pass with +VerifyOpto and we add/remove elements in it here. 1254 // for verify pass with +VerifyOpto and we add/remove elements in it here.
1254 Node_List nstack(Thread::current()->resource_area()); 1255 Node_List nstack(Thread::current()->resource_area());
1255 1256
1256 Node *top = igvn->C->top(); 1257 Node *top = igvn->C->top();
1257 nstack.push(dead); 1258 nstack.push(dead);
1259 bool has_irreducible_loop = igvn->C->has_irreducible_loop();
1258 1260
1259 while (nstack.size() > 0) { 1261 while (nstack.size() > 0) {
1260 dead = nstack.pop(); 1262 dead = nstack.pop();
1261 if (dead->outcnt() > 0) { 1263 if (dead->outcnt() > 0) {
1262 // Keep dead node on stack until all uses are processed. 1264 // Keep dead node on stack until all uses are processed.
1267 igvn->hash_delete(use); // Yank from hash table prior to mod 1269 igvn->hash_delete(use); // Yank from hash table prior to mod
1268 if (use->in(0) == dead) { // Found another dead node 1270 if (use->in(0) == dead) { // Found another dead node
1269 assert (!use->is_Con(), "Control for Con node should be Root node."); 1271 assert (!use->is_Con(), "Control for Con node should be Root node.");
1270 use->set_req(0, top); // Cut dead edge to prevent processing 1272 use->set_req(0, top); // Cut dead edge to prevent processing
1271 nstack.push(use); // the dead node again. 1273 nstack.push(use); // the dead node again.
1274 } else if (!has_irreducible_loop && // Backedge could be alive in irreducible loop
1275 use->is_Loop() && !use->is_Root() && // Don't kill Root (RootNode extends LoopNode)
1276 use->in(LoopNode::EntryControl) == dead) { // Dead loop if its entry is dead
1277 use->set_req(LoopNode::EntryControl, top); // Cut dead edge to prevent processing
1278 use->set_req(0, top); // Cut self edge
1279 nstack.push(use);
1272 } else { // Else found a not-dead user 1280 } else { // Else found a not-dead user
1281 // Dead if all inputs are top or null
1282 bool dead_use = !use->is_Root(); // Keep empty graph alive
1273 for (uint j = 1; j < use->req(); j++) { 1283 for (uint j = 1; j < use->req(); j++) {
1274 if (use->in(j) == dead) { // Turn all dead inputs into TOP 1284 Node* in = use->in(j);
1285 if (in == dead) { // Turn all dead inputs into TOP
1275 use->set_req(j, top); 1286 use->set_req(j, top);
1287 } else if (in != NULL && !in->is_top()) {
1288 dead_use = false;
1276 } 1289 }
1277 } 1290 }
1278 igvn->_worklist.push(use); 1291 if (dead_use) {
1292 if (use->is_Region()) {
1293 use->set_req(0, top); // Cut self edge
1294 }
1295 nstack.push(use);
1296 } else {
1297 igvn->_worklist.push(use);
1298 }
1279 } 1299 }
1280 // Refresh the iterator, since any number of kills might have happened. 1300 // Refresh the iterator, since any number of kills might have happened.
1281 k = dead->last_outs(kmin); 1301 k = dead->last_outs(kmin);
1282 } 1302 }
1283 } else { // (dead->outcnt() == 0) 1303 } else { // (dead->outcnt() == 0)

mercurial