# HG changeset patch # User kvn # Date 1304034023 25200 # Node ID ae93231c7a1fd75e79bfa1f8f6bdba74429c54d9 # Parent 01fd6090fdd89335c8ea4f82e10a5fe69193c5bb 7039652: Performance regression after 7004547 changes Summary: Use unrolled_count() to limit unrolling and use the stride check only for initial stride value. Reviewed-by: never diff -r 01fd6090fdd8 -r ae93231c7a1f src/share/vm/opto/loopTransform.cpp --- a/src/share/vm/opto/loopTransform.cpp Thu Apr 28 14:00:13 2011 -0700 +++ b/src/share/vm/opto/loopTransform.cpp Thu Apr 28 16:40:23 2011 -0700 @@ -632,6 +632,8 @@ } +#define MAX_UNROLL 16 // maximum number of unrolls for main loop + //------------------------------policy_unroll---------------------------------- // Return TRUE or FALSE if the loop should be unrolled or not. Unroll if // the loop is a CountedLoop and the body is small enough. @@ -646,10 +648,11 @@ // protect against over-unrolling if (cl->trip_count() <= 1) return false; - // Check for stride being a small enough constant - if (abs(cl->stride_con()) > (1<<3)) return false; + int future_unroll_ct = cl->unrolled_count() * 2; + if (future_unroll_ct > MAX_UNROLL) return false; - int future_unroll_ct = cl->unrolled_count() * 2; + // Check for initial stride being a small enough constant + if (abs(cl->stride_con()) > (1<<2)*future_unroll_ct) return false; // Don't unroll if the next round of unrolling would push us // over the expected trip count of the loop. One is subtracted