Skip to content

Commit

Permalink
8280320: C2: Loop opts are missing during OSR compilation
Browse files Browse the repository at this point in the history
Reviewed-by: thartmann, iveresov
  • Loading branch information
Vladimir Ivanov committed Jul 1, 2022
1 parent 8e01ffb commit 9925014
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/hotspot/share/ci/ciMethodData.cpp
Expand Up @@ -248,8 +248,15 @@ bool ciMethodData::load_data() {

// Note: Extra data are all BitData, and do not need translation.
_invocation_counter = mdo->invocation_count();
_state = mdo->is_mature()? mature_state: immature_state;
if (_invocation_counter == 0 && mdo->backedge_count() > 0) {
// Avoid skewing counter data during OSR compilation.
// Sometimes, MDO is allocated during the very first invocation and OSR compilation is triggered
// solely by backedge counter while invocation counter stays zero. In such case, it's important
// to observe non-zero invocation count to properly scale profile counts (see ciMethod::scale_count()).
_invocation_counter = 1;
}

_state = mdo->is_mature() ? mature_state : immature_state;
_eflags = mdo->eflags();
_arg_local = mdo->arg_local();
_arg_stack = mdo->arg_stack();
Expand Down

0 comments on commit 9925014

Please sign in to comment.