comparison src/share/vm/opto/loopopts.cpp @ 3840:4e761e7e6e12

7070134: Hotspot crashes with sigsegv from PorterStemmer Summary: Do not move data nodes which are attached to a predicate test to a dominating test. Reviewed-by: never
author kvn
date Tue, 26 Jul 2011 19:35:23 -0700
parents 273b56978029
children d8cb48376797
comparison
equal deleted inserted replaced
3839:3d42f82cd811 3840:4e761e7e6e12
192 192
193 //------------------------------dominated_by------------------------------------ 193 //------------------------------dominated_by------------------------------------
194 // Replace the dominated test with an obvious true or false. Place it on the 194 // Replace the dominated test with an obvious true or false. Place it on the
195 // IGVN worklist for later cleanup. Move control-dependent data Nodes on the 195 // IGVN worklist for later cleanup. Move control-dependent data Nodes on the
196 // live path up to the dominating control. 196 // live path up to the dominating control.
197 void PhaseIdealLoop::dominated_by( Node *prevdom, Node *iff, bool flip ) { 197 void PhaseIdealLoop::dominated_by( Node *prevdom, Node *iff, bool flip, bool exclude_loop_predicate ) {
198 #ifndef PRODUCT 198 #ifndef PRODUCT
199 if (VerifyLoopOptimizations && PrintOpto) tty->print_cr("dominating test"); 199 if (VerifyLoopOptimizations && PrintOpto) tty->print_cr("dominating test");
200 #endif 200 #endif
201 201
202 202
226 if (iff->outcnt() != 2) return; 226 if (iff->outcnt() != 2) return;
227 227
228 // Make control-dependent data Nodes on the live path (path that will remain 228 // Make control-dependent data Nodes on the live path (path that will remain
229 // once the dominated IF is removed) become control-dependent on the 229 // once the dominated IF is removed) become control-dependent on the
230 // dominating projection. 230 // dominating projection.
231 Node* dp = ((IfNode*)iff)->proj_out(pop == Op_IfTrue); 231 Node* dp = iff->as_If()->proj_out(pop == Op_IfTrue);
232
233 // Loop predicates may have depending checks which should not
234 // be skipped. For example, range check predicate has two checks
235 // for lower and upper bounds.
236 ProjNode* unc_proj = iff->as_If()->proj_out(1 - dp->as_Proj()->_con)->as_Proj();
237 if (exclude_loop_predicate &&
238 is_uncommon_trap_proj(unc_proj, Deoptimization::Reason_predicate))
239 return; // Let IGVN transformation change control dependence.
240
232 IdealLoopTree *old_loop = get_loop(dp); 241 IdealLoopTree *old_loop = get_loop(dp);
233 242
234 for (DUIterator_Fast imax, i = dp->fast_outs(imax); i < imax; i++) { 243 for (DUIterator_Fast imax, i = dp->fast_outs(imax); i < imax; i++) {
235 Node* cd = dp->fast_out(i); // Control-dependent node 244 Node* cd = dp->fast_out(i); // Control-dependent node
236 if (cd->depends_only_on_test()) { 245 if (cd->depends_only_on_test()) {
857 while( dom != cutoff ) { 866 while( dom != cutoff ) {
858 if( dom->req() > 1 && dom->in(1) == bol && prevdom->in(0) == dom ) { 867 if( dom->req() > 1 && dom->in(1) == bol && prevdom->in(0) == dom ) {
859 // Replace the dominated test with an obvious true or false. 868 // Replace the dominated test with an obvious true or false.
860 // Place it on the IGVN worklist for later cleanup. 869 // Place it on the IGVN worklist for later cleanup.
861 C->set_major_progress(); 870 C->set_major_progress();
862 dominated_by( prevdom, n ); 871 dominated_by( prevdom, n, false, true );
863 #ifndef PRODUCT 872 #ifndef PRODUCT
864 if( VerifyLoopOptimizations ) verify(); 873 if( VerifyLoopOptimizations ) verify();
865 #endif 874 #endif
866 return; 875 return;
867 } 876 }