Skip to content

Commit

Permalink
Merge pull request #14563 from mpirvu/accept-huge-methods
Browse files Browse the repository at this point in the history
Allow more expensive hot compilations under -Xtune:throughput
  • Loading branch information
vijaysun-omr authored Feb 22, 2022
2 parents 934d656 + a73ea43 commit e21d943
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
18 changes: 18 additions & 0 deletions runtime/compiler/control/CompilationThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8559,6 +8559,17 @@ TR::CompilationInfoPerThreadBase::wrappedCompile(J9PortLibrary *portLib, void *

TR_ASSERT(TR::comp() == NULL, "there seems to be a current TLS TR::Compilation object %p for this thread. At this point there should be no current TR::Compilation object", TR::comp());

// Under -Xtune:throughput we allow huge methods for compilations above warm
if (TR::Options::getAggressivityLevel() == TR::Options::TR_AggresivenessLevel::AGGRESSIVE_THROUGHPUT &&
options->getOptLevel() > warm &&
!options->getOption(TR_ProcessHugeMethods))
{
static char *dontAcceptHugeMethods = feGetEnv("TR_DontAcceptHugeMethods");
if (!dontAcceptHugeMethods)
{
options->setOption(TR_ProcessHugeMethods);
}
}
}

uint64_t proposedScratchMemoryLimit = static_cast<uint64_t>(TR::Options::getScratchSpaceLimit());
Expand Down Expand Up @@ -8722,6 +8733,13 @@ TR::CompilationInfoPerThreadBase::wrappedCompile(J9PortLibrary *portLib, void *
compiler->getOptions()->setBigCalleeScorchingOptThreshold(1024);
#endif
}
// Under -Xtune:throughput, increase the scratch space limit for hot/scorching compilations
else if (TR::Options::getAggressivityLevel() == TR::Options::TR_AggresivenessLevel::AGGRESSIVE_THROUGHPUT &&
compiler->getOptions()->getOptLevel() > warm &&
TR::Options::getScratchSpaceLimitForHotCompilations() > proposedScratchMemoryLimit) // Make sure we don't decrease the value proposed so far
{
proposedScratchMemoryLimit = TR::Options::getScratchSpaceLimitForHotCompilations();
}
#if defined(J9VM_OPT_JITSERVER)
else if (compiler->isOutOfProcessCompilation())
{
Expand Down
3 changes: 3 additions & 0 deletions runtime/compiler/control/J9Options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ int32_t J9::Options::_updateFreeMemoryMinPeriod = 500; // 500 ms
size_t J9::Options::_scratchSpaceLimitKBWhenLowVirtualMemory = 64*1024; // 64MB; currently, only used on 32 bit Windows

int32_t J9::Options::_scratchSpaceFactorWhenJSR292Workload = JSR292_SCRATCH_SPACE_FACTOR;
size_t J9::Options::_scratchSpaceLimitForHotCompilations = 512 * 1024 * 1024; // 512 MB
#if defined(J9VM_OPT_JITSERVER)
int32_t J9::Options::_scratchSpaceFactorWhenJITServerWorkload = 2;
#endif /* defined(J9VM_OPT_JITSERVER) */
Expand Down Expand Up @@ -977,6 +978,8 @@ TR::OptionTable OMR::Options::_feOptions[] = {
#endif /* defined(J9VM_OPT_JITSERVER) */
{"scratchSpaceFactorWhenJSR292Workload=","M<nnn>\tMultiplier for scratch space limit when MethodHandles are in use",
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_scratchSpaceFactorWhenJSR292Workload, 0, "F%d", NOT_IN_SUBSET},
{"scratchSpaceLimitKBForHotCompilations=","M<nnn>\tLimit for memory used by JIT when compiling at hot and above (in KB)",
TR::Options::setStaticNumericKBAdjusted, (intptr_t)&TR::Options::_scratchSpaceLimitForHotCompilations, 0, "F%d (bytes)", NOT_IN_SUBSET},
{"scratchSpaceLimitKBWhenLowVirtualMemory=","M<nnn>\tLimit for memory used by JIT when running on low virtual memory",
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_scratchSpaceLimitKBWhenLowVirtualMemory, 0, "F%d", NOT_IN_SUBSET},
{"secondaryClassLoadPhaseThreshold=", "O<nnn>\tWhen class load rate just dropped under the CLP threshold "
Expand Down
3 changes: 3 additions & 0 deletions runtime/compiler/control/J9Options.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,9 @@ class OMR_EXTENSIBLE Options : public OMR::OptionsConnector
static int32_t _scratchSpaceFactorWhenJSR292Workload;
static int32_t getScratchSpaceFactorWhenJSR292Workload() { return _scratchSpaceFactorWhenJSR292Workload; }

static size_t _scratchSpaceLimitForHotCompilations; // Only used under -Xtune:throughput
static size_t getScratchSpaceLimitForHotCompilations() { return _scratchSpaceLimitForHotCompilations; }

#if defined(J9VM_OPT_JITSERVER)
static int32_t _scratchSpaceFactorWhenJITServerWorkload;
static int32_t getScratchSpaceFactorWhenJITServerWorkload() { return _scratchSpaceFactorWhenJITServerWorkload; }
Expand Down

0 comments on commit e21d943

Please sign in to comment.