src/share/vm/runtime/simpleThresholdPolicy.cpp

Print this page

        

@@ -215,11 +215,12 @@
   return osr_nm;
 }
 
 // Check if the method can be compiled, change level if necessary
 void SimpleThresholdPolicy::compile(methodHandle mh, int bci, CompLevel level, JavaThread* thread) {
-  assert(level <= TieredStopAtLevel, "Invalid compilation level");
+  assert(level <= TieredStopAtLevel,  "Invalid compilation level - level too large");
+  assert(level >= TieredStartAtLevel, "Invalid compilation level - level too small");
   if (level == CompLevel_none) {
     return;
   }
   // Check if the method can be compiled. If it cannot be compiled with C1, continue profiling
   // in the interpreter and then compile with C2 (the transition function will request that,

@@ -328,11 +329,12 @@
         }
       }
       break;
     }
   }
-  return MIN2(next_level, (CompLevel)TieredStopAtLevel);
+  next_level = MIN2(next_level, (CompLevel)TieredStopAtLevel);
+  return MAX2(next_level, (CompLevel)TieredStartAtLevel);
 }
 
 // Determine if a method should be compiled with a normal entry point at a different level.
 CompLevel SimpleThresholdPolicy::call_event(Method* method,  CompLevel cur_level) {
   CompLevel osr_level = MIN2((CompLevel) method->highest_osr_comp_level(),