# HG changeset patch # User kvn # Date 1313010417 25200 # Node ID fa58671dde311ba1befc0839b15f0d25b04bc234 # Parent c5f62d314bee25ad7f9fd8efb35981515f9e6641 7077439: Possible reference through NULL in loopPredicate.cpp:726 Summary: Use cl->is_valid_counted_loop() check. Reviewed-by: never diff -r c5f62d314bee -r fa58671dde31 hotspot/src/share/vm/opto/loopPredicate.cpp --- a/hotspot/src/share/vm/opto/loopPredicate.cpp Tue Aug 02 18:36:40 2011 +0200 +++ b/hotspot/src/share/vm/opto/loopPredicate.cpp Wed Aug 10 14:06:57 2011 -0700 @@ -718,7 +718,7 @@ } CountedLoopNode *cl = NULL; - if (head->is_CountedLoop()) { + if (head->is_valid_counted_loop()) { cl = head->as_CountedLoop(); // do nothing for iteration-splitted loops if (!cl->is_normal_loop()) return false; diff -r c5f62d314bee -r fa58671dde31 hotspot/src/share/vm/opto/loopTransform.cpp --- a/hotspot/src/share/vm/opto/loopTransform.cpp Tue Aug 02 18:36:40 2011 +0200 +++ b/hotspot/src/share/vm/opto/loopTransform.cpp Wed Aug 10 14:06:57 2011 -0700 @@ -2099,7 +2099,7 @@ if (!_head->is_CountedLoop()) return false; // Dead loop CountedLoopNode *cl = _head->as_CountedLoop(); - if (!cl->loopexit()) + if (!cl->is_valid_counted_loop()) return false; // Malformed loop if (!phase->is_member(this, phase->get_ctrl(cl->loopexit()->in(CountedLoopEndNode::TestValue)))) return false; // Infinite loop @@ -2255,7 +2255,7 @@ } 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 if (cl->is_pre_loop() || cl->is_post_loop()) return true; @@ -2636,7 +2636,7 @@ // Must have constant stride 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; } diff -r c5f62d314bee -r fa58671dde31 hotspot/src/share/vm/opto/loopnode.cpp --- a/hotspot/src/share/vm/opto/loopnode.cpp Tue Aug 02 18:36:40 2011 +0200 +++ b/hotspot/src/share/vm/opto/loopnode.cpp Wed Aug 10 14:06:57 2011 -0700 @@ -689,6 +689,7 @@ Node* PhaseIdealLoop::exact_limit( IdealLoopTree *loop ) { assert(loop->_head->is_CountedLoop(), ""); CountedLoopNode *cl = loop->_head->as_CountedLoop(); + assert(cl->is_valid_counted_loop(), ""); if (!LoopLimitCheck || ABS(cl->stride_con()) == 1 || cl->limit()->Opcode() == Op_LoopLimit) { @@ -1608,14 +1609,13 @@ void PhaseIdealLoop::replace_parallel_iv(IdealLoopTree *loop) { assert(loop->_head->is_CountedLoop(), ""); CountedLoopNode *cl = loop->_head->as_CountedLoop(); + if (!cl->is_valid_counted_loop()) + return; // skip malformed counted loop Node *incr = cl->incr(); if (incr == NULL) return; // Dead loop? Node *init = cl->init_trip(); Node *phi = cl->phi(); - // protect against stride not being a constant - if (!cl->stride_is_con()) - return; int stride_con = cl->stride_con(); PhaseGVN *gvn = &_igvn; diff -r c5f62d314bee -r fa58671dde31 hotspot/src/share/vm/opto/superword.cpp --- a/hotspot/src/share/vm/opto/superword.cpp Tue Aug 02 18:36:40 2011 +0200 +++ b/hotspot/src/share/vm/opto/superword.cpp Wed Aug 10 14:06:57 2011 -0700 @@ -70,6 +70,8 @@ assert(lpt->_head->is_CountedLoop(), "must be"); 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 // Check for no control flow in body (other than exit)