Skip to content
Permalink
Browse files
8272330: C2: Cleanup profile counter scaling
Reviewed-by: kvn
  • Loading branch information
Igor Veresov committed Aug 11, 2021
1 parent 75a0642 commit 9faab400b8cf0611f14d377ea55a58d99795fa57
Showing 1 changed file with 7 additions and 8 deletions.
@@ -880,17 +880,16 @@ ciKlass* ciMethod::get_declared_method_holder_at_bci(int bci) {
// invocation counts in methods.
int ciMethod::scale_count(int count, float prof_factor) {
if (count > 0 && method_data() != NULL) {
int counter_life;
int counter_life = method_data()->invocation_count();
int method_life = interpreter_invocation_count();
// In tiered the MDO's life is measured directly, so just use the snapshotted counters
counter_life = MAX2(method_data()->invocation_count(), method_data()->backedge_count());

// counter_life due to backedge_counter could be > method_life
if (counter_life > method_life)
counter_life = method_life;
if (0 < counter_life && counter_life <= method_life) {
if (method_life < counter_life) { // may happen because of the snapshot timing
method_life = counter_life;
}
if (counter_life > 0) {
count = (int)((double)count * prof_factor * method_life / counter_life + 0.5);
count = (count > 0) ? count : 1;
} else {
count = 1;
}
}
return count;

1 comment on commit 9faab40

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on 9faab40 Aug 11, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.