Skip to content

Commit

Permalink
Reduce counts when class of method is not in SCC
Browse files Browse the repository at this point in the history
By default, OpenJ9 uses an "implicit" shared class cache (SCC)
that is used to cache "bootstrap" classes and methods.
Currently, methods whose class is not present in the SCC
receive a high initial invocation count (3000/3000 for
loopless/loopy method) in order to improve steady state
throughput. However, this could affect start-up time of
applications because methods are interpreted for too long
before being JIT compiled.
The presence of `-Xshareclasses` on the command line is a sign
that the user cares about start-up time and OpenJ9 automatically
lowers the invocations counts to 1000/250. However, with the
implicit SCC (no -Xshareclasses command line option), application
classes are not cached and methods belonging to those classes
will receive a large initial invocation count (3000/3000). Since
application classes are likely important, we would like to use
lower counts even when the implict SCC is used.

This commit lowers the initial invocation counts for methods
whose class is not in SCC under the following conditions:
- SCC is used. Rationale: -Xshareclasses:none may be a sign that
user does not care about start-up that much.
- -Xtune:throughput is not used. Rationale: this option is a
clear signal that the user cares more about throughput than startup.
- The user has not provided a specific count on the command line.
- The JVM is in start-up mode. Rationale: this feature only seeks
to improve start-up time.
- The JVM runs on 4 or more vCPUs. Rationale: lower counts will
generate more compilations which will compete with application

Depends on eclipse/omr/#7156

Signed-off-by: Marius <mpirvu@ca.ibm.com>
  • Loading branch information
mpirvu committed Oct 27, 2023
1 parent ae0b30a commit 4049925
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions runtime/compiler/control/HookedByTheJit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -573,14 +573,29 @@ static void jitHookInitializeSendTarget(J9HookInterface * * hook, UDATA eventNum
compInfo->setAotQueryTime(compInfo->getAotQueryTime() + (UDATA)sharedQueryTime);
}
}
else // ROM class not in shared class cache
else // ROM class not in shared class cache (no space or ineligible - maybe because of implicit SCC)
{
// SCC is used, either explicit or implicit; this is a sign that start-up may be important
// If there is enough CPU power to compile sooner, do so by using lower counts
// but only for the classes loaded during startup
if (!TR::Options::getCountsAreProvidedByUser() && !countInOptionSet)
{
if (TR::Options::getCmdLineOptions()->getOption(TR_UseLowerCountsForNonSCCMethodsDuringStartup) &&
(jitConfig->javaVM->phase != J9VM_PHASE_NOT_STARTUP) &&
TR::Compiler->target.numberOfProcessors() >= TR_NUMPROC_FOR_LARGE_SMP)
{
count = getCount(romMethod, optionsJIT, optionsAOT); // counts are lower when SCC is enabled
}
#if !defined(J9ZOS390) // Do not change the counts on zos at the moment since the
// shared cache capacity is higher on this platform and by
// increasing counts we could end up significantly impacting startup
if (TR::Options::getCmdLineOptions()->getOption(TR_UseHigherCountsForNonSCCMethods))
count = J9ROMMETHOD_HAS_BACKWARDS_BRANCHES(romMethod) ? TR_DEFAULT_INITIAL_BCOUNT : TR_DEFAULT_INITIAL_COUNT;
// shared cache capacity is higher on this platform and by
// increasing counts we could end up significantly impacting startup
else
{
if (TR::Options::getCmdLineOptions()->getOption(TR_UseHigherCountsForNonSCCMethods))
count = J9ROMMETHOD_HAS_BACKWARDS_BRANCHES(romMethod) ? TR_DEFAULT_INITIAL_BCOUNT : TR_DEFAULT_INITIAL_COUNT;
}
#endif // !J9ZOS390
}
}
#endif // defined(J9VM_INTERP_AOT_COMPILE_SUPPORT) && defined(J9VM_OPT_SHARED_CLASSES) && (defined(TR_HOST_X86) || defined(TR_HOST_POWER) || defined(TR_HOST_S390) || defined(TR_HOST_ARM) || defined(TR_HOST_ARM64))
} // if (TR::Options::sharedClassCache())
Expand Down

0 comments on commit 4049925

Please sign in to comment.