Mercurial > hg > graal-compiler
comparison src/share/vm/opto/node.cpp @ 305:ab075d07f1ba
6736417: Fastdebug C2 crashes in StoreBNode::Ideal
Summary: The result of step_through_mergemem() and remove_dead_region() is not checked in some cases.
Reviewed-by: never
author | kvn |
---|---|
date | Wed, 27 Aug 2008 09:15:46 -0700 |
parents | 9c2ecc2ffb12 |
children | 98cb887364d3 |
comparison
equal
deleted
inserted
replaced
304:dc7f315e41f7 | 305:ab075d07f1ba |
---|---|
1164 //------------------------------remove_dead_region----------------------------- | 1164 //------------------------------remove_dead_region----------------------------- |
1165 // This control node is dead. Follow the subgraph below it making everything | 1165 // This control node is dead. Follow the subgraph below it making everything |
1166 // using it dead as well. This will happen normally via the usual IterGVN | 1166 // using it dead as well. This will happen normally via the usual IterGVN |
1167 // worklist but this call is more efficient. Do not update use-def info | 1167 // worklist but this call is more efficient. Do not update use-def info |
1168 // inside the dead region, just at the borders. | 1168 // inside the dead region, just at the borders. |
1169 static bool kill_dead_code( Node *dead, PhaseIterGVN *igvn ) { | 1169 static void kill_dead_code( Node *dead, PhaseIterGVN *igvn ) { |
1170 // Con's are a popular node to re-hit in the hash table again. | 1170 // Con's are a popular node to re-hit in the hash table again. |
1171 if( dead->is_Con() ) return false; | 1171 if( dead->is_Con() ) return; |
1172 | 1172 |
1173 // Can't put ResourceMark here since igvn->_worklist uses the same arena | 1173 // Can't put ResourceMark here since igvn->_worklist uses the same arena |
1174 // for verify pass with +VerifyOpto and we add/remove elements in it here. | 1174 // for verify pass with +VerifyOpto and we add/remove elements in it here. |
1175 Node_List nstack(Thread::current()->resource_area()); | 1175 Node_List nstack(Thread::current()->resource_area()); |
1176 | 1176 |
1177 Node *top = igvn->C->top(); | 1177 Node *top = igvn->C->top(); |
1178 bool progress = false; | |
1179 nstack.push(dead); | 1178 nstack.push(dead); |
1180 | 1179 |
1181 while (nstack.size() > 0) { | 1180 while (nstack.size() > 0) { |
1182 dead = nstack.pop(); | 1181 dead = nstack.pop(); |
1183 if (dead->outcnt() > 0) { | 1182 if (dead->outcnt() > 0) { |
1212 } | 1211 } |
1213 // Kill all inputs to the dead guy | 1212 // Kill all inputs to the dead guy |
1214 for (uint i=0; i < dead->req(); i++) { | 1213 for (uint i=0; i < dead->req(); i++) { |
1215 Node *n = dead->in(i); // Get input to dead guy | 1214 Node *n = dead->in(i); // Get input to dead guy |
1216 if (n != NULL && !n->is_top()) { // Input is valid? | 1215 if (n != NULL && !n->is_top()) { // Input is valid? |
1217 progress = true; | |
1218 dead->set_req(i, top); // Smash input away | 1216 dead->set_req(i, top); // Smash input away |
1219 if (n->outcnt() == 0) { // Input also goes dead? | 1217 if (n->outcnt() == 0) { // Input also goes dead? |
1220 if (!n->is_Con()) | 1218 if (!n->is_Con()) |
1221 nstack.push(n); // Clear it out as well | 1219 nstack.push(n); // Clear it out as well |
1222 } else if (n->outcnt() == 1 && | 1220 } else if (n->outcnt() == 1 && |
1231 } | 1229 } |
1232 } | 1230 } |
1233 } | 1231 } |
1234 } // (dead->outcnt() == 0) | 1232 } // (dead->outcnt() == 0) |
1235 } // while (nstack.size() > 0) for outputs | 1233 } // while (nstack.size() > 0) for outputs |
1236 return progress; | 1234 return; |
1237 } | 1235 } |
1238 | 1236 |
1239 //------------------------------remove_dead_region----------------------------- | 1237 //------------------------------remove_dead_region----------------------------- |
1240 bool Node::remove_dead_region(PhaseGVN *phase, bool can_reshape) { | 1238 bool Node::remove_dead_region(PhaseGVN *phase, bool can_reshape) { |
1241 Node *n = in(0); | 1239 Node *n = in(0); |
1242 if( !n ) return false; | 1240 if( !n ) return false; |
1243 // Lost control into this guy? I.e., it became unreachable? | 1241 // Lost control into this guy? I.e., it became unreachable? |
1244 // Aggressively kill all unreachable code. | 1242 // Aggressively kill all unreachable code. |
1245 if (can_reshape && n->is_top()) { | 1243 if (can_reshape && n->is_top()) { |
1246 return kill_dead_code(this, phase->is_IterGVN()); | 1244 kill_dead_code(this, phase->is_IterGVN()); |
1245 return false; // Node is dead. | |
1247 } | 1246 } |
1248 | 1247 |
1249 if( n->is_Region() && n->as_Region()->is_copy() ) { | 1248 if( n->is_Region() && n->as_Region()->is_copy() ) { |
1250 Node *m = n->nonnull_req(); | 1249 Node *m = n->nonnull_req(); |
1251 set_req(0, m); | 1250 set_req(0, m); |