Skip to content

Commit

Permalink
Merge pull request #8756 from dsouzai/iprofilerSCCCompatiblity_0.19
Browse files Browse the repository at this point in the history
Check if SCC is valid at startup (0.19)
  • Loading branch information
pshipton committed Mar 5, 2020
2 parents c20a03c + 45e8cb3 commit 421081a
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 20 deletions.
21 changes: 7 additions & 14 deletions runtime/compiler/control/CompilationThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5931,18 +5931,14 @@ void *TR::CompilationInfo::compileOnSeparateThread(J9VMThread * vmThread, TR::Il
//
if (vmThread->javaVM->sharedClassConfig->existsCachedCodeForROMMethod(vmThread, J9_ROM_METHOD_FROM_RAM_METHOD(method)))
{
TR_J9SharedCacheVM *fe = (TR_J9SharedCacheVM *) TR_J9VMBase::get(jitConfig, vmThread, TR_J9VMBase::AOT_VM);
if (
static_cast<TR_JitPrivateConfig *>(jitConfig->privateConfig)->aotValidHeader == TR_yes
|| (
static_cast<TR_JitPrivateConfig *>(jitConfig->privateConfig)->aotValidHeader == TR_maybe
&& _sharedCacheReloRuntime.validateAOTHeader(fe, vmThread)
)
)
if (static_cast<TR_JitPrivateConfig *>(jitConfig->privateConfig)->aotValidHeader == TR_yes)
{
methodIsInSharedCache = TR_yes;
// if (getPersistentInfo()->isClassLoadingPhase() || TR::Options::getCmdLineOptions()->getOption(TR_ForceLoadAOT))
useCodeFromSharedCache = true;
useCodeFromSharedCache = true;
}
else
{
TR_ASSERT_FATAL(static_cast<TR_JitPrivateConfig *>(jitConfig->privateConfig)->aotValidHeader != TR_maybe, "Should not be possible for aotValidHeader to be TR_maybe at this point\n");
}
}
}
Expand Down Expand Up @@ -11757,10 +11753,7 @@ TR::CompilationInfo::storeAOTInSharedCache(
}
else if (static_cast<TR_JitPrivateConfig *>(jitConfig->privateConfig)->aotValidHeader == TR_maybe)
{
// If validation has been performed, then a header already existed
// or one was already been created in this JVM
TR_J9SharedCacheVM *fe = (TR_J9SharedCacheVM *) TR_J9VMBase::get(jitConfig, vmThread, TR_J9VMBase::AOT_VM);
safeToStore = entry->_compInfoPT->reloRuntime()->storeAOTHeader(fe, vmThread);
TR_ASSERT_FATAL(static_cast<TR_JitPrivateConfig *>(jitConfig->privateConfig)->aotValidHeader != TR_maybe, "Should not be possible for aotValidHeader to be TR_maybe at this point\n");
}
else
{
Expand Down
39 changes: 33 additions & 6 deletions runtime/compiler/control/rossa.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1868,13 +1868,40 @@ aboutToBootstrap(J9JavaVM * javaVM, J9JITConfig * jitConfig)
#if defined(J9VM_OPT_SHARED_CLASSES)
if (isSharedAOT)
{
/* If AOT Shared Classes is turned ON, perform compatibility checks for AOT Shared Classes */
if (0) //!validateSharedClassAOTHeader(javaVM, curThread, compInfo))
bool validateSCC = true;

#if define(JITSERVER_SUPPORT)
if (compInfo->getPersistentInfo()->getRemoteCompilationMode() == JITServer::SERVER)
validateSCC = false;
#endif

if (validateSCC)
{
TR::Options::getAOTCmdLineOptions()->setOption(TR_NoLoadAOT);
TR::Options::getAOTCmdLineOptions()->setOption(TR_NoStoreAOT);
TR::Options::setSharedClassCache(false);
TR_J9SharedCache::setSharedCacheDisabledReason(TR_J9SharedCache::AOT_DISABLED);
/* If AOT Shared Classes is turned ON, perform compatibility checks for AOT Shared Classes
*
* This check has to be done after latePostProcessJIT so that all the necessary JIT options
* can be set
*/
TR_J9VMBase *fe = TR_J9VMBase::get(jitConfig, curThread);
if (!compInfo->reloRuntime()->validateAOTHeader(fe, curThread))
{
TR_ASSERT_FATAL(static_cast<TR_JitPrivateConfig *>(jitConfig->privateConfig)->aotValidHeader != TR_yes,
"aotValidHeader is TR_yes after failing to validate AOT header\n");

/* If this is the second run, then failing to validate AOT header will cause aotValidHeader
* to be TR_no, in which case the SCC is not valid for use. However, if this is the first
* run, then aotValidHeader will be TR_maybe; try to store the AOT Header in this case.
*/
if (static_cast<TR_JitPrivateConfig *>(jitConfig->privateConfig)->aotValidHeader == TR_no
|| !compInfo->reloRuntime()->storeAOTHeader(fe, curThread))
{
static_cast<TR_JitPrivateConfig *>(jitConfig->privateConfig)->aotValidHeader = TR_no;
TR::Options::getAOTCmdLineOptions()->setOption(TR_NoLoadAOT);
TR::Options::getAOTCmdLineOptions()->setOption(TR_NoStoreAOT);
TR::Options::setSharedClassCache(false);
TR_J9SharedCache::setSharedCacheDisabledReason(TR_J9SharedCache::AOT_DISABLED);
}
}
}

if (TR::Options::getAOTCmdLineOptions()->getOption(TR_NoStoreAOT))
Expand Down

0 comments on commit 421081a

Please sign in to comment.