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