Skip to content

Commit

Permalink
Distinguish why AOT is disabled post-restore
Browse files Browse the repository at this point in the history
Signed-off-by: Irwin D'Souza <[email protected]>
  • Loading branch information
dsouzai committed Sep 26, 2024
1 parent 670e183 commit 34aeb1c
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
19 changes: 14 additions & 5 deletions runtime/compiler/control/OptionsPostRestore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ J9::OptionsPostRestore::invalidateCompiledMethodsIfNeeded(bool invalidateAll)
}

void
J9::OptionsPostRestore::disableAOTCompilation()
J9::OptionsPostRestore::disableAOTCompilation(bool disabledPreCheckpoint)
{
static bool aotDisabled = false;
if (aotDisabled)
Expand All @@ -567,7 +567,14 @@ J9::OptionsPostRestore::disableAOTCompilation()
aotDisabled = true;
_disableAOTPostRestore = true;

j9nls_printf(PORTLIB, (UDATA) J9NLS_WARNING, J9NLS_JIT_CHECKPOINT_RESTORE_AOT_DISABLED);
if (disabledPreCheckpoint)
{
j9nls_printf(PORTLIB, (UDATA) J9NLS_WARNING, J9NLS_JIT_CHECKPOINT_RESTORE_AOT_DISABLED_PRE_CHECKPOINT);
}
else
{
j9nls_printf(PORTLIB, (UDATA) J9NLS_WARNING, J9NLS_JIT_CHECKPOINT_RESTORE_AOT_DISABLED);
}
}

void
Expand Down Expand Up @@ -834,8 +841,10 @@ J9::OptionsPostRestore::processCompilerOptions()
J9JavaVM *vm = _jitConfig->javaVM;
PORT_ACCESS_FROM_JAVAVM(vm);

bool aotEnabledPreCheckpoint = TR_J9SharedCache::aotHeaderValidationDelayed() ? true : TR::Options::sharedClassCache();

bool jitEnabled = TR::Options::canJITCompile();
bool aotEnabled = TR_J9SharedCache::aotHeaderValidationDelayed() ? true : TR::Options::sharedClassCache();
bool aotEnabled = aotEnabledPreCheckpoint;

_argIndexXjit = FIND_AND_CONSUME_RESTORE_ARG(OPTIONAL_LIST_MATCH, J9::Options::_externalOptionStrings[J9::ExternalOptions::Xjit], 0);
_argIndexXnojit = FIND_AND_CONSUME_RESTORE_ARG(OPTIONAL_LIST_MATCH, J9::Options::_externalOptionStrings[J9::ExternalOptions::Xnojit], 0);
Expand All @@ -848,7 +857,7 @@ J9::OptionsPostRestore::processCompilerOptions()
// If -Xnoaot was specified pre-checkpoint, there is a lot of infrastructure
// that needs to be set up. For now, ignore -Xaot post-restore if -Xnoaot
// was specified pre-checkpoint.
if (aotEnabled)
if (aotEnabledPreCheckpoint)
aotEnabled = (_argIndexXaot >= _argIndexXnoaot);

if (!aotEnabled)
Expand All @@ -859,7 +868,7 @@ J9::OptionsPostRestore::processCompilerOptions()
if (_disableAOTPostRestore)
{
aotEnabled = false;
disableAOTCompilation();
disableAOTCompilation(aotEnabledPreCheckpoint);
}

if (!jitEnabled)
Expand Down
5 changes: 4 additions & 1 deletion runtime/compiler/control/OptionsPostRestore.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,11 @@ class OptionsPostRestore

/**
* \brief Helper method to disable further AOT compilation.
*
* \param disabledPreCheckpoint bool to indicate whther AOT was disable post
* restore or pre checkpoint.
*/
void disableAOTCompilation();
void disableAOTCompilation(bool disabledPreCheckpoint = false);

/**
* \brief Helper method to perform tasks prior to processing
Expand Down
7 changes: 7 additions & 0 deletions runtime/nls/jitm/j9jit.nls
Original file line number Diff line number Diff line change
Expand Up @@ -431,3 +431,10 @@ J9NLS_JIT_OPTIONS_PERCENT_OUT_OF_RANGE.sample_input_1=-XX:codecachetotalMaxRAMPe
J9NLS_JIT_OPTIONS_PERCENT_OUT_OF_RANGE.sample_input_2=0.8
J9NLS_JIT_OPTIONS_PERCENT_OUT_OF_RANGE.sample_input_3=25
# END NON-TRANSLATABLE

J9NLS_JIT_CHECKPOINT_RESTORE_AOT_DISABLED_PRE_CHECKPOINT=AOT load and compilation disabled pre-checkpoint and post-restore.
# START NON-TRANSLATABLE
J9NLS_JIT_CHECKPOINT_RESTORE_AOT_DISABLED_PRE_CHECKPOINT.explanation=The JVM was running in a mode pre-checkpoint that prevents AOT load and compilation.
J9NLS_JIT_CHECKPOINT_RESTORE_AOT_DISABLED_PRE_CHECKPOINT.system_action=The compiler will not generate AOT code. AOT code from the shared class cache will not be used.
J9NLS_JIT_CHECKPOINT_RESTORE_AOT_DISABLED_PRE_CHECKPOINT.user_response=Remove any (pre-checkpoint) option that would have resulted in this behaviour.
# END NON-TRANSLATABLE

0 comments on commit 34aeb1c

Please sign in to comment.