Skip to content

Commit

Permalink
Merge pull request #16911 from dsouzai/postRestoreOptions
Browse files Browse the repository at this point in the history
Add support to disable JITServer and AOT post restore
  • Loading branch information
mpirvu authored Mar 15, 2023
2 parents ccdc87f + 9af1e28 commit 5938c2f
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 4 deletions.
4 changes: 4 additions & 0 deletions runtime/compiler/control/CompilationThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7402,6 +7402,10 @@ TR::CompilationInfoPerThreadBase::cannotPerformRemoteComp(
// after the process is restored. In portable restore mode checkpoints are always possible
// so there's no point to delaying remote compilations.
(_jitConfig->javaVM->internalVMFunctions->isCheckpointAllowed(vmThread) && _jitConfig->javaVM->internalVMFunctions->isNonPortableRestoreMode(vmThread)) ||

// If -XX:-UseJITServer is specified post-restore, then the Remote Compilation Mode will
// be set to JITServer::NONE
_compInfo.getPersistentInfo()->getRemoteCompilationMode() == JITServer::NONE ||
#endif /* defined(J9VM_OPT_CRIU_SUPPORT) */
!JITServer::ClientStream::isServerCompatible(OMRPORT_FROM_J9PORT(_jitConfig->javaVM->portLibrary)) ||
(!JITServerHelpers::isServerAvailable() && !JITServerHelpers::shouldRetryConnection(OMRPORT_FROM_J9PORT(_jitConfig->javaVM->portLibrary))) ||
Expand Down
3 changes: 2 additions & 1 deletion runtime/compiler/control/J9Options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,8 @@ char * J9::Options::_externalOptionStrings[J9::ExternalOptions::TR_NumExternalOp
"-XX:-JITServerAOTCachePersistence", // = 64
"-XX:JITServerAOTCacheDir=", // = 65
"-XX:JITServerAOTCacheName=", // = 66
// TR_NumExternalOptions = 67
"-Xshareclasses:disableOnRestore", // = 67
// TR_NumExternalOptions = 68
};

//************************************************************************
Expand Down
3 changes: 2 additions & 1 deletion runtime/compiler/control/J9Options.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ enum ExternalOptions
XXminusJITServerAOTCachePersistenceOption = 64,
XXJITServerAOTCacheDirOption = 65,
XXJITServerAOTCacheNameOption = 66,
TR_NumExternalOptions = 67
XShareclassesDisableOnRestore = 67,
TR_NumExternalOptions = 68
};

class OMR_EXTENSIBLE Options : public OMR::OptionsConnector
Expand Down
24 changes: 22 additions & 2 deletions runtime/compiler/control/OptionsPostRestore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include "control/Options.hpp"
#include "control/OptionsPostRestore.hpp"
#include "control/J9Recompilation.hpp"
#include "env/J9PersistentInfo.hpp"
#include "env/SystemSegmentProvider.hpp"
#include "env/RawAllocator.hpp"
#include "env/Region.hpp"
Expand All @@ -59,6 +60,7 @@ J9::OptionsPostRestore::OptionsPostRestore(J9VMThread *vmThread, J9JITConfig *ji
_oldVLogFileName(_privateConfig->vLogFileName),
_oldRtLogFileName(_privateConfig->rtLogFileName),
_asyncCompilationPreCheckpoint(_compInfo->asynchronousCompilation()),
_disableAOTPostRestore(false),
_argIndexXjit(-1),
_argIndexXjitcolon(-1),
_argIndexXnojit(-1),
Expand Down Expand Up @@ -261,6 +263,13 @@ J9::OptionsPostRestore::iterateOverExternalOptions()
}
break;

case J9::ExternalOptions::XShareclassesDisableOnRestore:
{
if (FIND_ARG_IN_RESTORE_ARGS(OPTIONAL_LIST_MATCH, optString, 0) >= 0)
_disableAOTPostRestore = true;
}
break;

default:
TR_ASSERT_FATAL(false, "Option %s not addressed post restore\n", TR::Options::_externalOptionStrings[option]);
}
Expand Down Expand Up @@ -306,7 +315,11 @@ J9::OptionsPostRestore::processJitServerOptions()
}
else
{
// TODO: Disable JITServer
_compInfo->getPersistentInfo()->setClientUID(0);
_compInfo->getPersistentInfo()->setServerUID(0);
_jitConfig->clientUID = 0;
_jitConfig->serverUID = 0;
J9::PersistentInfo::_remoteCompilationMode = JITServer::NONE;
}
#endif // defined(J9VM_OPT_JITSERVER)
}
Expand Down Expand Up @@ -468,6 +481,9 @@ J9::OptionsPostRestore::disableAOTCompilation()
// but not during a compilation as all compilation threads are suspended at
// this point, and so it won't impact AOT code.

if (TR::Options::getCmdLineOptions()->getVerboseOption(TR_VerboseCheckpointRestore))
TR_VerboseLog::writeLineLocked(TR_Vlog_CHECKPOINT_RESTORE, "Disabling AOT Compilation and Load");

TR::Options::getAOTCmdLineOptions()->setOption(TR_NoLoadAOT);
TR::Options::getAOTCmdLineOptions()->setOption(TR_NoStoreAOT);
TR::Options::setSharedClassCache(false);
Expand Down Expand Up @@ -603,7 +619,7 @@ J9::OptionsPostRestore::postProcessInternalCompilerOptions()
// If -Xrs, -Xtrace, or disabling traps is specified post-restore,
// invalidate all method bodies
bool invalidateAll = false;
bool disableAOT = false;
bool disableAOT = _disableAOTPostRestore;
if (!_disableTrapsPreCheckpoint
&& (J9_ARE_ALL_BITS_SET(vm->sigFlags, J9_SIG_XRS_SYNC)
|| TR::Options::getCmdLineOptions()->getOption(TR_NoResumableTrapHandler)
Expand Down Expand Up @@ -673,11 +689,15 @@ J9::OptionsPostRestore::processCompilerOptions()

if (!aotEnabled)
{
_disableAOTPostRestore = true;
disableAOTCompilation();
}

if (!jitEnabled)
{
if (TR::Options::getCmdLineOptions()->getVerboseOption(TR_VerboseCheckpointRestore))
TR_VerboseLog::writeLineLocked(TR_Vlog_CHECKPOINT_RESTORE, "Disabling JIT Compilation");

TR::Options::setCanJITCompile(false);
invalidateCompiledMethodsIfNeeded(true);
}
Expand Down
1 change: 1 addition & 0 deletions runtime/compiler/control/OptionsPostRestore.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ class OptionsPostRestore

bool _asyncCompilationPreCheckpoint;
bool _disableTrapsPreCheckpoint;
bool _disableAOTPostRestore;

int32_t _argIndexXjit;
int32_t _argIndexXjitcolon;
Expand Down

0 comments on commit 5938c2f

Please sign in to comment.