Tue, 28 Jan 2020 13:36:30 +0100
8237951: CTW: C2 compilation fails with "malformed control flow"
Reviewed-by: vlivanov, kvn
1.1 --- a/src/share/vm/opto/node.cpp Mon Mar 30 17:55:01 2020 +0200 1.2 +++ b/src/share/vm/opto/node.cpp Tue Jan 28 13:36:30 2020 +0100 1.3 @@ -937,6 +937,17 @@ 1.4 return (Node*) this; 1.5 } 1.6 1.7 +// Find out of current node that matches opcode. 1.8 +Node* Node::find_out_with(int opcode) { 1.9 + for (DUIterator_Fast imax, i = fast_outs(imax); i < imax; i++) { 1.10 + Node* use = fast_out(i); 1.11 + if (use->Opcode() == opcode) { 1.12 + return use; 1.13 + } 1.14 + } 1.15 + return NULL; 1.16 +} 1.17 + 1.18 //---------------------------uncast_helper------------------------------------- 1.19 Node* Node::uncast_helper(const Node* p) { 1.20 #ifdef ASSERT
2.1 --- a/src/share/vm/opto/node.hpp Mon Mar 30 17:55:01 2020 +0200 2.2 +++ b/src/share/vm/opto/node.hpp Tue Jan 28 13:36:30 2020 +0100 2.3 @@ -454,6 +454,9 @@ 2.4 return (this->uncast() == n->uncast()); 2.5 } 2.6 2.7 + // Find out of current node that matches opcode. 2.8 + Node* find_out_with(int opcode); 2.9 + 2.10 private: 2.11 static Node* uncast_helper(const Node* n); 2.12
3.1 --- a/src/share/vm/opto/phaseX.cpp Mon Mar 30 17:55:01 2020 +0200 3.2 +++ b/src/share/vm/opto/phaseX.cpp Tue Jan 28 13:36:30 2020 +0100 3.3 @@ -1653,8 +1653,11 @@ 3.4 if (m->is_Call()) { 3.5 for (DUIterator_Fast i2max, i2 = m->fast_outs(i2max); i2 < i2max; i2++) { 3.6 Node* p = m->fast_out(i2); // Propagate changes to uses 3.7 - if (p->is_Proj() && p->as_Proj()->_con == TypeFunc::Control && p->outcnt() == 1) { 3.8 - worklist.push(p->unique_out()); 3.9 + if (p->is_Proj() && p->as_Proj()->_con == TypeFunc::Control) { 3.10 + Node* catch_node = p->find_out_with(Op_Catch); 3.11 + if (catch_node != NULL) { 3.12 + worklist.push(catch_node); 3.13 + } 3.14 } 3.15 } 3.16 }