提交 6becc0d2 编写于 作者: K kvn

7077439: Possible reference through NULL in loopPredicate.cpp:726

Summary: Use cl->is_valid_counted_loop() check.
Reviewed-by: never
上级 68562bd4
...@@ -718,7 +718,7 @@ bool PhaseIdealLoop::loop_predication_impl(IdealLoopTree *loop) { ...@@ -718,7 +718,7 @@ bool PhaseIdealLoop::loop_predication_impl(IdealLoopTree *loop) {
} }
CountedLoopNode *cl = NULL; CountedLoopNode *cl = NULL;
if (head->is_CountedLoop()) { if (head->is_valid_counted_loop()) {
cl = head->as_CountedLoop(); cl = head->as_CountedLoop();
// do nothing for iteration-splitted loops // do nothing for iteration-splitted loops
if (!cl->is_normal_loop()) return false; if (!cl->is_normal_loop()) return false;
......
...@@ -2099,7 +2099,7 @@ bool IdealLoopTree::policy_do_remove_empty_loop( PhaseIdealLoop *phase ) { ...@@ -2099,7 +2099,7 @@ bool IdealLoopTree::policy_do_remove_empty_loop( PhaseIdealLoop *phase ) {
if (!_head->is_CountedLoop()) if (!_head->is_CountedLoop())
return false; // Dead loop return false; // Dead loop
CountedLoopNode *cl = _head->as_CountedLoop(); CountedLoopNode *cl = _head->as_CountedLoop();
if (!cl->loopexit()) if (!cl->is_valid_counted_loop())
return false; // Malformed loop return false; // Malformed loop
if (!phase->is_member(this, phase->get_ctrl(cl->loopexit()->in(CountedLoopEndNode::TestValue)))) if (!phase->is_member(this, phase->get_ctrl(cl->loopexit()->in(CountedLoopEndNode::TestValue))))
return false; // Infinite loop return false; // Infinite loop
...@@ -2255,7 +2255,7 @@ bool IdealLoopTree::iteration_split_impl( PhaseIdealLoop *phase, Node_List &old_ ...@@ -2255,7 +2255,7 @@ bool IdealLoopTree::iteration_split_impl( PhaseIdealLoop *phase, Node_List &old_
} }
CountedLoopNode *cl = _head->as_CountedLoop(); CountedLoopNode *cl = _head->as_CountedLoop();
if (!cl->loopexit()) return true; // Ignore various kinds of broken loops if (!cl->is_valid_counted_loop()) return true; // Ignore various kinds of broken loops
// Do nothing special to pre- and post- loops // Do nothing special to pre- and post- loops
if (cl->is_pre_loop() || cl->is_post_loop()) return true; if (cl->is_pre_loop() || cl->is_post_loop()) return true;
...@@ -2636,7 +2636,7 @@ bool PhaseIdealLoop::intrinsify_fill(IdealLoopTree* lpt) { ...@@ -2636,7 +2636,7 @@ bool PhaseIdealLoop::intrinsify_fill(IdealLoopTree* lpt) {
// Must have constant stride // Must have constant stride
CountedLoopNode* head = lpt->_head->as_CountedLoop(); CountedLoopNode* head = lpt->_head->as_CountedLoop();
if (!head->stride_is_con() || !head->is_normal_loop()) { if (!head->is_valid_counted_loop() || !head->is_normal_loop()) {
return false; return false;
} }
......
...@@ -689,6 +689,7 @@ bool PhaseIdealLoop::is_counted_loop( Node *x, IdealLoopTree *loop ) { ...@@ -689,6 +689,7 @@ bool PhaseIdealLoop::is_counted_loop( Node *x, IdealLoopTree *loop ) {
Node* PhaseIdealLoop::exact_limit( IdealLoopTree *loop ) { Node* PhaseIdealLoop::exact_limit( IdealLoopTree *loop ) {
assert(loop->_head->is_CountedLoop(), ""); assert(loop->_head->is_CountedLoop(), "");
CountedLoopNode *cl = loop->_head->as_CountedLoop(); CountedLoopNode *cl = loop->_head->as_CountedLoop();
assert(cl->is_valid_counted_loop(), "");
if (!LoopLimitCheck || ABS(cl->stride_con()) == 1 || if (!LoopLimitCheck || ABS(cl->stride_con()) == 1 ||
cl->limit()->Opcode() == Op_LoopLimit) { cl->limit()->Opcode() == Op_LoopLimit) {
...@@ -1608,14 +1609,13 @@ bool PhaseIdealLoop::is_deleteable_safept(Node* sfpt) { ...@@ -1608,14 +1609,13 @@ bool PhaseIdealLoop::is_deleteable_safept(Node* sfpt) {
void PhaseIdealLoop::replace_parallel_iv(IdealLoopTree *loop) { void PhaseIdealLoop::replace_parallel_iv(IdealLoopTree *loop) {
assert(loop->_head->is_CountedLoop(), ""); assert(loop->_head->is_CountedLoop(), "");
CountedLoopNode *cl = loop->_head->as_CountedLoop(); CountedLoopNode *cl = loop->_head->as_CountedLoop();
if (!cl->is_valid_counted_loop())
return; // skip malformed counted loop
Node *incr = cl->incr(); Node *incr = cl->incr();
if (incr == NULL) if (incr == NULL)
return; // Dead loop? return; // Dead loop?
Node *init = cl->init_trip(); Node *init = cl->init_trip();
Node *phi = cl->phi(); Node *phi = cl->phi();
// protect against stride not being a constant
if (!cl->stride_is_con())
return;
int stride_con = cl->stride_con(); int stride_con = cl->stride_con();
PhaseGVN *gvn = &_igvn; PhaseGVN *gvn = &_igvn;
......
...@@ -70,6 +70,8 @@ void SuperWord::transform_loop(IdealLoopTree* lpt) { ...@@ -70,6 +70,8 @@ void SuperWord::transform_loop(IdealLoopTree* lpt) {
assert(lpt->_head->is_CountedLoop(), "must be"); assert(lpt->_head->is_CountedLoop(), "must be");
CountedLoopNode *cl = lpt->_head->as_CountedLoop(); CountedLoopNode *cl = lpt->_head->as_CountedLoop();
if (!cl->is_valid_counted_loop()) return; // skip malformed counted loop
if (!cl->is_main_loop() ) return; // skip normal, pre, and post loops if (!cl->is_main_loop() ) return; // skip normal, pre, and post loops
// Check for no control flow in body (other than exit) // Check for no control flow in body (other than exit)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册