< prev index next >

hotspot/src/share/vm/runtime/advancedThresholdPolicy.cpp

Print this page
rev 6907 : 8056071: compiler/whitebox/IsMethodCompilableTest.java fails with 'method() is not compilable after 3 iterations'
Summary: Always use MDO if valid and always compile trivial methods with C1 if available.
Reviewed-by: kvn, iveresov


 299  * Method states:
 300  *   0 - interpreter (CompLevel_none)
 301  *   1 - pure C1 (CompLevel_simple)
 302  *   2 - C1 with invocation and backedge counting (CompLevel_limited_profile)
 303  *   3 - C1 with full profiling (CompLevel_full_profile)
 304  *   4 - C2 (CompLevel_full_optimization)
 305  *
 306  * Common state transition patterns:
 307  * a. 0 -> 3 -> 4.
 308  *    The most common path. But note that even in this straightforward case
 309  *    profiling can start at level 0 and finish at level 3.
 310  *
 311  * b. 0 -> 2 -> 3 -> 4.
 312  *    This case occures when the load on C2 is deemed too high. So, instead of transitioning
 313  *    into state 3 directly and over-profiling while a method is in the C2 queue we transition to
 314  *    level 2 and wait until the load on C2 decreases. This path is disabled for OSRs.
 315  *
 316  * c. 0 -> (3->2) -> 4.
 317  *    In this case we enqueue a method for compilation at level 3, but the C1 queue is long enough
 318  *    to enable the profiling to fully occur at level 0. In this case we change the compilation level
 319  *    of the method to 2, because it'll allow it to run much faster without full profiling while c2
 320  *    is compiling.
 321  *
 322  * d. 0 -> 3 -> 1 or 0 -> 2 -> 1.
 323  *    After a method was once compiled with C1 it can be identified as trivial and be compiled to
 324  *    level 1. These transition can also occur if a method can't be compiled with C2 but can with C1.
 325  *
 326  * e. 0 -> 4.
 327  *    This can happen if a method fails C1 compilation (it will still be profiled in the interpreter)
 328  *    or because of a deopt that didn't require reprofiling (compilation won't happen in this case because
 329  *    the compiled version already exists).
 330  *
 331  * Note that since state 0 can be reached from any other state via deoptimization different loops
 332  * are possible.
 333  *
 334  */
 335 
 336 // Common transition function. Given a predicate determines if a method should transition to another level.
 337 CompLevel AdvancedThresholdPolicy::common(Predicate p, Method* method, CompLevel cur_level, bool disable_feedback) {
 338   CompLevel next_level = cur_level;
 339   int i = method->invocation_count();
 340   int b = method->backedge_count();




 299  * Method states:
 300  *   0 - interpreter (CompLevel_none)
 301  *   1 - pure C1 (CompLevel_simple)
 302  *   2 - C1 with invocation and backedge counting (CompLevel_limited_profile)
 303  *   3 - C1 with full profiling (CompLevel_full_profile)
 304  *   4 - C2 (CompLevel_full_optimization)
 305  *
 306  * Common state transition patterns:
 307  * a. 0 -> 3 -> 4.
 308  *    The most common path. But note that even in this straightforward case
 309  *    profiling can start at level 0 and finish at level 3.
 310  *
 311  * b. 0 -> 2 -> 3 -> 4.
 312  *    This case occures when the load on C2 is deemed too high. So, instead of transitioning
 313  *    into state 3 directly and over-profiling while a method is in the C2 queue we transition to
 314  *    level 2 and wait until the load on C2 decreases. This path is disabled for OSRs.
 315  *
 316  * c. 0 -> (3->2) -> 4.
 317  *    In this case we enqueue a method for compilation at level 3, but the C1 queue is long enough
 318  *    to enable the profiling to fully occur at level 0. In this case we change the compilation level
 319  *    of the method to 2 while the request is still in-queue, because it'll allow it to run much faster
 320  *    without full profiling while c2 is compiling.
 321  *
 322  * d. 0 -> 3 -> 1 or 0 -> 2 -> 1.
 323  *    After a method was once compiled with C1 it can be identified as trivial and be compiled to
 324  *    level 1. These transition can also occur if a method can't be compiled with C2 but can with C1.
 325  *
 326  * e. 0 -> 4.
 327  *    This can happen if a method fails C1 compilation (it will still be profiled in the interpreter)
 328  *    or because of a deopt that didn't require reprofiling (compilation won't happen in this case because
 329  *    the compiled version already exists).
 330  *
 331  * Note that since state 0 can be reached from any other state via deoptimization different loops
 332  * are possible.
 333  *
 334  */
 335 
 336 // Common transition function. Given a predicate determines if a method should transition to another level.
 337 CompLevel AdvancedThresholdPolicy::common(Predicate p, Method* method, CompLevel cur_level, bool disable_feedback) {
 338   CompLevel next_level = cur_level;
 339   int i = method->invocation_count();
 340   int b = method->backedge_count();


< prev index next >