2115 //------------------------------ loop_predication_impl-------------------------- |
2115 //------------------------------ loop_predication_impl-------------------------- |
2116 // Insert loop predicates for null checks and range checks |
2116 // Insert loop predicates for null checks and range checks |
2117 bool PhaseIdealLoop::loop_predication_impl(IdealLoopTree *loop) { |
2117 bool PhaseIdealLoop::loop_predication_impl(IdealLoopTree *loop) { |
2118 if (!UseLoopPredicate) return false; |
2118 if (!UseLoopPredicate) return false; |
2119 |
2119 |
|
2120 if (!loop->_head->is_Loop()) { |
|
2121 // Could be a simple region when irreducible loops are present. |
|
2122 return false; |
|
2123 } |
|
2124 |
|
2125 CountedLoopNode *cl = NULL; |
|
2126 if (loop->_head->is_CountedLoop()) { |
|
2127 cl = loop->_head->as_CountedLoop(); |
|
2128 // do nothing for iteration-splitted loops |
|
2129 if (!cl->is_normal_loop()) return false; |
|
2130 } |
|
2131 |
2120 // Too many traps seen? |
2132 // Too many traps seen? |
2121 bool tmt = C->too_many_traps(C->method(), 0, Deoptimization::Reason_predicate); |
2133 bool tmt = C->too_many_traps(C->method(), 0, Deoptimization::Reason_predicate); |
2122 int tc = C->trap_count(Deoptimization::Reason_predicate); |
2134 int tc = C->trap_count(Deoptimization::Reason_predicate); |
2123 if (tmt || tc > 0) { |
2135 if (tmt || tc > 0) { |
2124 if (TraceLoopPredicate) { |
2136 if (TraceLoopPredicate) { |
2125 tty->print_cr("too many predicate traps: %d", tc); |
2137 tty->print_cr("too many predicate traps: %d", tc); |
2126 C->method()->print(); // which method has too many predicate traps |
2138 C->method()->print(); // which method has too many predicate traps |
2127 tty->print_cr(""); |
2139 tty->print_cr(""); |
2128 } |
2140 } |
2129 return false; |
2141 return false; |
2130 } |
|
2131 |
|
2132 CountedLoopNode *cl = NULL; |
|
2133 if (loop->_head->is_CountedLoop()) { |
|
2134 cl = loop->_head->as_CountedLoop(); |
|
2135 // do nothing for iteration-splitted loops |
|
2136 if(!cl->is_normal_loop()) return false; |
|
2137 } |
2142 } |
2138 |
2143 |
2139 LoopNode *lpn = loop->_head->as_Loop(); |
2144 LoopNode *lpn = loop->_head->as_Loop(); |
2140 Node* entry = lpn->in(LoopNode::EntryControl); |
2145 Node* entry = lpn->in(LoopNode::EntryControl); |
2141 |
2146 |