Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Track methods with AOT bodies with dependencies #20599

Merged
merged 1 commit into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions runtime/compiler/control/CompilationThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
#include "env/StackMemoryRegion.hpp"
#include "env/jittypes.h"
#include "env/ClassTableCriticalSection.hpp"
#include "env/DependencyTable.hpp"
#include "env/PersistentCHTable.hpp"
#include "env/VMAccessCriticalSection.hpp"
#include "env/VerboseLog.hpp"
Expand Down Expand Up @@ -8253,6 +8254,11 @@ TR::CompilationInfoPerThreadBase::compile(J9VMThread * vmThread,
vmThread->omrVMThread->vmState = J9VMSTATE_JIT | J9VMSTATE_MINOR;
vmThread->jitMethodToBeCompiled = method;

// If method is being compiled, then the dependency table no longer needs to
// track it. Let the table know.
if (auto dependencyTable = getCompilationInfo()->getPersistentInfo()->getAOTDependencyTable())
mpirvu marked this conversation as resolved.
Show resolved Hide resolved
dependencyTable->methodWillBeCompiled(method);

try
{
TR::RawAllocator rawAllocator(vmThread->javaVM);
Expand Down
2 changes: 2 additions & 0 deletions runtime/compiler/control/DLLMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,8 @@ IDATA J9VMDllMain(J9JavaVM* vm, IDATA stage, void * reserved)
persistentInfo->setAOTDependencyTable(dependencyTable);
}
#endif /* !defined(PERSISTENT_COLLECTIONS_UNSUPPORTED) */
if (!persistentInfo->getAOTDependencyTable())
persistentInfo->setTrackAOTDependencies(false);
}
}
else
Expand Down
39 changes: 28 additions & 11 deletions runtime/compiler/control/HookedByTheJit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -566,20 +566,37 @@ static void jitHookInitializeSendTarget(J9HookInterface * * hook, UDATA eventNum
#endif /* defined(J9VM_OPT_CRIU_SUPPORT) */
)
{
int32_t scount = optionsAOT->getInitialSCount();
uint16_t newScount = 0;
if (sc && sc->isHint(method, TR_HintFailedValidation, &newScount))
if (auto dependencyTable = compInfo->getPersistentInfo()->getAOTDependencyTable())
mpirvu marked this conversation as resolved.
Show resolved Hide resolved
{
if ((scount == TR_QUICKSTART_INITIAL_SCOUNT) || (scount == TR_INITIAL_SCOUNT))
{ // If scount is not user specified (coarse way due to info being lost from options parsing)
// TODO: Is casting the best thing to do here?
scount= std::min(getCount(romMethod, optionsJIT, optionsAOT), static_cast<int32_t>(newScount) ); // Find what would've been normal count for this method and
// make sure new scount isn't larger than that
if (optionsAOT->getVerboseOption(TR_VerboseSCHints) || optionsJIT->getVerboseOption(TR_VerboseSCHints))
TR_VerboseLog::writeLineLocked(TR_Vlog_SCHINTS,"Found hint in sc, increase scount to: %d, wanted scount: %d", scount, newScount);
bool dependenciesSatisfied = false;
// TODO: Obey user counts if they are set for this method
//
// TODO: The initial count for unsatisfied dependencies should
// be revisited. It can likely be lower, particularly if AOT
// loads are suppressed if dependencies are unsatisfied,
// though remember that counts can decrease faster in the warm
// run due to sampling.
if (dependencyTable->trackMethod(vmThread, method, romMethod, dependenciesSatisfied))
count = dependenciesSatisfied ? 0 : TR_DEFAULT_INITIAL_COUNT;
}

if (count == -1)
{
int32_t scount = optionsAOT->getInitialSCount();
uint16_t newScount = 0;
if (sc && sc->isHint(method, TR_HintFailedValidation, &newScount))
{
if ((scount == TR_QUICKSTART_INITIAL_SCOUNT) || (scount == TR_INITIAL_SCOUNT))
{ // If scount is not user specified (coarse way due to info being lost from options parsing)
// TODO: Is casting the best thing to do here?
scount= std::min(getCount(romMethod, optionsJIT, optionsAOT), static_cast<int32_t>(newScount) ); // Find what would've been normal count for this method and
// make sure new scount isn't larger than that
if (optionsAOT->getVerboseOption(TR_VerboseSCHints) || optionsJIT->getVerboseOption(TR_VerboseSCHints))
TR_VerboseLog::writeLineLocked(TR_Vlog_SCHINTS,"Found hint in sc, increase scount to: %d, wanted scount: %d", scount, newScount);
}
}
count = scount;
}
count = scount;
compInfo->incrementNumMethodsFoundInSharedCache();
}
// AOT Body not in SCC, so scount was not set
Expand Down
Loading