comparison src/share/vm/opto/phaseX.cpp @ 23043:03596ae35800

8060036: C2: CmpU nodes can end up with wrong type information Summary: CmpU needs to be reprocessed by CCP when an AddI/SubI input's input type change Reviewed-by: mcberg, kvn, roland Contributed-by: andreas.eriksson@oracle.com
author aeriksso
date Thu, 21 May 2015 16:49:11 +0200
parents 4c228230f1d6
children dd9cc155639c c1091733abe6
comparison
equal deleted inserted replaced
23042:9246942b90ef 23043:03596ae35800
1519 } 1519 }
1520 #endif 1520 #endif
1521 set_type(n, t); 1521 set_type(n, t);
1522 for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) { 1522 for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) {
1523 Node* m = n->fast_out(i); // Get user 1523 Node* m = n->fast_out(i); // Get user
1524 if( m->is_Region() ) { // New path to Region? Must recheck Phis too 1524 if (m->is_Region()) { // New path to Region? Must recheck Phis too
1525 for (DUIterator_Fast i2max, i2 = m->fast_outs(i2max); i2 < i2max; i2++) { 1525 for (DUIterator_Fast i2max, i2 = m->fast_outs(i2max); i2 < i2max; i2++) {
1526 Node* p = m->fast_out(i2); // Propagate changes to uses 1526 Node* p = m->fast_out(i2); // Propagate changes to uses
1527 if( p->bottom_type() != type(p) ) // If not already bottomed out 1527 if (p->bottom_type() != type(p)) { // If not already bottomed out
1528 worklist.push(p); // Propagate change to user 1528 worklist.push(p); // Propagate change to user
1529 }
1529 } 1530 }
1530 } 1531 }
1531 // If we changed the receiver type to a call, we need to revisit 1532 // If we changed the receiver type to a call, we need to revisit
1532 // the Catch following the call. It's looking for a non-NULL 1533 // the Catch following the call. It's looking for a non-NULL
1533 // receiver to know when to enable the regular fall-through path 1534 // receiver to know when to enable the regular fall-through path
1534 // in addition to the NullPtrException path 1535 // in addition to the NullPtrException path
1535 if (m->is_Call()) { 1536 if (m->is_Call()) {
1536 for (DUIterator_Fast i2max, i2 = m->fast_outs(i2max); i2 < i2max; i2++) { 1537 for (DUIterator_Fast i2max, i2 = m->fast_outs(i2max); i2 < i2max; i2++) {
1537 Node* p = m->fast_out(i2); // Propagate changes to uses 1538 Node* p = m->fast_out(i2); // Propagate changes to uses
1538 if (p->is_Proj() && p->as_Proj()->_con == TypeFunc::Control && p->outcnt() == 1) 1539 if (p->is_Proj() && p->as_Proj()->_con == TypeFunc::Control && p->outcnt() == 1) {
1539 worklist.push(p->unique_out()); 1540 worklist.push(p->unique_out());
1541 }
1540 } 1542 }
1541 } 1543 }
1542 if( m->bottom_type() != type(m) ) // If not already bottomed out 1544 if (m->bottom_type() != type(m)) { // If not already bottomed out
1543 worklist.push(m); // Propagate change to user 1545 worklist.push(m); // Propagate change to user
1546 }
1547
1548 // CmpU nodes can get their type information from two nodes up in the
1549 // graph (instead of from the nodes immediately above). Make sure they
1550 // are added to the worklist if nodes they depend on are updated, since
1551 // they could be missed and get wrong types otherwise.
1552 uint m_op = m->Opcode();
1553 if (m_op == Op_AddI || m_op == Op_SubI) {
1554 for (DUIterator_Fast i2max, i2 = m->fast_outs(i2max); i2 < i2max; i2++) {
1555 Node* p = m->fast_out(i2); // Propagate changes to uses
1556 if (p->Opcode() == Op_CmpU) {
1557 // Got a CmpU which might need the new type information from node n.
1558 if(p->bottom_type() != type(p)) { // If not already bottomed out
1559 worklist.push(p); // Propagate change to user
1560 }
1561 }
1562 }
1563 }
1544 } 1564 }
1545 } 1565 }
1546 } 1566 }
1547 } 1567 }
1548 1568