--- a/hotspot/src/share/vm/opto/bytecodeInfo.cpp Fri Apr 29 17:00:19 2011 -0700
+++ b/hotspot/src/share/vm/opto/bytecodeInfo.cpp Mon May 02 10:51:36 2011 -0700
@@ -310,13 +310,14 @@
return "inlining too deep";
}
- // We need to detect recursive inlining of method handle targets: if
- // the current method is a method handle adapter and one of the
- // callers is the same method as the callee, we bail out if
- // MaxRecursiveInlineLevel is hit.
- if (method()->is_method_handle_adapter()) {
+ // detect direct and indirect recursive inlining
+ {
+ // count the current method and the callee
+ int inline_level = (method() == callee_method) ? 1 : 0;
+ if (inline_level > MaxRecursiveInlineLevel)
+ return "recursively inlining too deep";
+ // count callers of current method and callee
JVMState* jvms = caller_jvms();
- int inline_level = 0;
while (jvms != NULL && jvms->has_method()) {
if (jvms->method() == callee_method) {
inline_level++;
@@ -327,10 +328,6 @@
}
}
- if (method() == callee_method && inline_depth() > MaxRecursiveInlineLevel) {
- return "recursively inlining too deep";
- }
-
int size = callee_method->code_size();
if (UseOldInlining && ClipInlining
--- a/hotspot/src/share/vm/opto/loopTransform.cpp Fri Apr 29 17:00:19 2011 -0700
+++ b/hotspot/src/share/vm/opto/loopTransform.cpp Mon May 02 10:51:36 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