@@ -1350,17 +1350,24 @@ CompLevel CompilationPolicy::standard_transition(const methodHandle& method, Com
13501350 return next_level;
13511351}
13521352
1353+ template <typename Predicate> static inline bool apply_predicate (const methodHandle& method, CompLevel cur_level, int i, int b, bool delay_profiling, double delay_profiling_scale) {
1354+ if (delay_profiling) {
1355+ return Predicate::apply_scaled (method, cur_level, i, b, delay_profiling_scale);
1356+ } else {
1357+ return Predicate::apply (method, cur_level, i, b);
1358+ }
1359+ }
1360+
13531361template <typename Predicate>
13541362CompLevel CompilationPolicy::transition_from_none (const methodHandle& method, CompLevel cur_level, bool delay_profiling, bool disable_feedback) {
13551363 precond (cur_level == CompLevel_none);
13561364 CompLevel next_level = cur_level;
13571365 int i = method->invocation_count ();
13581366 int b = method->backedge_count ();
1359- double scale = delay_profiling ? Tier0ProfileDelayFactor : 1.0 ;
13601367 // If we were at full profile level, would we switch to full opt?
13611368 if (transition_from_full_profile<Predicate>(method, CompLevel_full_profile) == CompLevel_full_optimization) {
13621369 next_level = CompLevel_full_optimization;
1363- } else if (!CompilationModeFlag::disable_intermediate () && Predicate::apply_scaled (method, cur_level, i, b, scale )) {
1370+ } else if (!CompilationModeFlag::disable_intermediate () && apply_predicate< Predicate> (method, cur_level, i, b, delay_profiling, Tier0ProfileDelayFactor )) {
13641371 // C1-generated fully profiled code is about 30% slower than the limited profile
13651372 // code that has only invocation and backedge counters. The observation is that
13661373 // if C2 queue is large enough we can spend too much time in the fully profiled code
@@ -1402,13 +1409,12 @@ CompLevel CompilationPolicy::transition_from_limited_profile(const methodHandle&
14021409 CompLevel next_level = cur_level;
14031410 int i = method->invocation_count ();
14041411 int b = method->backedge_count ();
1405- double scale = delay_profiling ? Tier2ProfileDelayFactor : 1.0 ;
14061412 MethodData* mdo = method->method_data ();
14071413 if (mdo != nullptr ) {
14081414 if (mdo->would_profile ()) {
14091415 if (disable_feedback || (CompileBroker::queue_size (CompLevel_full_optimization) <=
14101416 Tier3DelayOff * compiler_count (CompLevel_full_optimization) &&
1411- Predicate::apply_scaled (method, cur_level, i, b, scale ))) {
1417+ apply_predicate< Predicate> (method, cur_level, i, b, delay_profiling, Tier2ProfileDelayFactor ))) {
14121418 next_level = CompLevel_full_profile;
14131419 }
14141420 } else {
@@ -1418,7 +1424,7 @@ CompLevel CompilationPolicy::transition_from_limited_profile(const methodHandle&
14181424 // If there is no MDO we need to profile
14191425 if (disable_feedback || (CompileBroker::queue_size (CompLevel_full_optimization) <=
14201426 Tier3DelayOff * compiler_count (CompLevel_full_optimization) &&
1421- Predicate::apply_scaled (method, cur_level, i, b, scale ))) {
1427+ apply_predicate< Predicate> (method, cur_level, i, b, delay_profiling, Tier2ProfileDelayFactor ))) {
14221428 next_level = CompLevel_full_profile;
14231429 }
14241430 }
0 commit comments