提交 3c0bc693 编写于 作者: M morris

8009181: [parfait] Null pointer deference in hotspot/src/share/vm/opto/loopTransform.cpp

Summary: add guarantee() to insert_pre_post_loops()
Reviewed-by: kvn
上级 be7b8480
...@@ -888,6 +888,7 @@ void PhaseIdealLoop::insert_pre_post_loops( IdealLoopTree *loop, Node_List &old_ ...@@ -888,6 +888,7 @@ void PhaseIdealLoop::insert_pre_post_loops( IdealLoopTree *loop, Node_List &old_
CountedLoopNode *main_head = loop->_head->as_CountedLoop(); CountedLoopNode *main_head = loop->_head->as_CountedLoop();
assert( main_head->is_normal_loop(), "" ); assert( main_head->is_normal_loop(), "" );
CountedLoopEndNode *main_end = main_head->loopexit(); CountedLoopEndNode *main_end = main_head->loopexit();
guarantee(main_end != NULL, "no loop exit node");
assert( main_end->outcnt() == 2, "1 true, 1 false path only" ); assert( main_end->outcnt() == 2, "1 true, 1 false path only" );
uint dd_main_head = dom_depth(main_head); uint dd_main_head = dom_depth(main_head);
uint max = main_head->outcnt(); uint max = main_head->outcnt();
...@@ -2554,13 +2555,16 @@ bool PhaseIdealLoop::match_fill_loop(IdealLoopTree* lpt, Node*& store, Node*& st ...@@ -2554,13 +2555,16 @@ bool PhaseIdealLoop::match_fill_loop(IdealLoopTree* lpt, Node*& store, Node*& st
ok.set(store->_idx); ok.set(store->_idx);
ok.set(store->in(MemNode::Memory)->_idx); ok.set(store->in(MemNode::Memory)->_idx);
CountedLoopEndNode* loop_exit = head->loopexit();
guarantee(loop_exit != NULL, "no loop exit node");
// Loop structure is ok // Loop structure is ok
ok.set(head->_idx); ok.set(head->_idx);
ok.set(head->loopexit()->_idx); ok.set(loop_exit->_idx);
ok.set(head->phi()->_idx); ok.set(head->phi()->_idx);
ok.set(head->incr()->_idx); ok.set(head->incr()->_idx);
ok.set(head->loopexit()->cmp_node()->_idx); ok.set(loop_exit->cmp_node()->_idx);
ok.set(head->loopexit()->in(1)->_idx); ok.set(loop_exit->in(1)->_idx);
// Address elements are ok // Address elements are ok
if (con) ok.set(con->_idx); if (con) ok.set(con->_idx);
...@@ -2572,7 +2576,7 @@ bool PhaseIdealLoop::match_fill_loop(IdealLoopTree* lpt, Node*& store, Node*& st ...@@ -2572,7 +2576,7 @@ bool PhaseIdealLoop::match_fill_loop(IdealLoopTree* lpt, Node*& store, Node*& st
if (n->outcnt() == 0) continue; // Ignore dead if (n->outcnt() == 0) continue; // Ignore dead
if (ok.test(n->_idx)) continue; if (ok.test(n->_idx)) continue;
// Backedge projection is ok // Backedge projection is ok
if (n->is_IfTrue() && n->in(0) == head->loopexit()) continue; if (n->is_IfTrue() && n->in(0) == loop_exit) continue;
if (!n->is_AddP()) { if (!n->is_AddP()) {
msg = "unhandled node"; msg = "unhandled node";
msg_node = n; msg_node = n;
...@@ -2585,7 +2589,7 @@ bool PhaseIdealLoop::match_fill_loop(IdealLoopTree* lpt, Node*& store, Node*& st ...@@ -2585,7 +2589,7 @@ bool PhaseIdealLoop::match_fill_loop(IdealLoopTree* lpt, Node*& store, Node*& st
Node* n = lpt->_body.at(i); Node* n = lpt->_body.at(i);
// These values can be replaced with other nodes if they are used // These values can be replaced with other nodes if they are used
// outside the loop. // outside the loop.
if (n == store || n == head->loopexit() || n == head->incr() || n == store->in(MemNode::Memory)) continue; if (n == store || n == loop_exit || n == head->incr() || n == store->in(MemNode::Memory)) continue;
for (SimpleDUIterator iter(n); iter.has_next(); iter.next()) { for (SimpleDUIterator iter(n); iter.has_next(); iter.next()) {
Node* use = iter.get(); Node* use = iter.get();
if (!lpt->_body.contains(use)) { if (!lpt->_body.contains(use)) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册