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

Remove J9::Options::setCounts() #9465

Merged
merged 1 commit into from
Jul 9, 2020
Merged
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
248 changes: 0 additions & 248 deletions runtime/compiler/control/J9Options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2980,251 +2980,3 @@ J9::Options::closeLogFileForClientOptions()
}
}
#endif /* defined(J9VM_OPT_JITSERVER) */

#if 0
char*
J9::Options::setCounts()
{
if (_countString)
{
// Use the count string in preference to any specified fixed opt level
//
_optLevel = -1;

_countsAreProvidedByUser = true; // so that we don't try to change counts later on

// caveat: if the counts string is provided we should also not forget that
// interpreterSamplingDivisorInStartupMode is at the default level of 16
if (_interpreterSamplingDivisorInStartupMode == -1) // unchanged
_interpreterSamplingDivisorInStartupMode = TR_DEFAULT_INTERPRETER_SAMPLING_DIVISOR;
}
else // no counts string specified
{
// No need for sampling thread if only one level of compilation and
// interpreted methods are not to be sampled. Also, methods with loops
// will need a smaller initial count since we won't know if they are hot.
//
if (_optLevel >= 0 && self()->getOption(TR_DisableInterpreterSampling))
disableSamplingThread();

// useLowerMethodCounts sets the count/bcount to the old values of 1000,250 resp.
// those are what TR_QUICKSTART_INITIAL_COUNT and TR_QUICKSTART_INITIAL_BCOUNT are defined to.
// if these defines are updated in the context of -Xquickstart,
// please update this option accordingly
//

if (self()->getOption(TR_FirstRun)) // This overrides everything
{
_startupTimeMatters = TR_no;
}

if (_startupTimeMatters == TR_maybe) // not yet set
{
if (getJITCmdLineOptions()->getOption(TR_UseLowerMethodCounts) ||
(getAOTCmdLineOptions() && getAOTCmdLineOptions()->getOption(TR_UseLowerMethodCounts)))
_startupTimeMatters = TR_yes;
else if (getJITCmdLineOptions()->getOption(TR_UseHigherMethodCounts) ||
(getAOTCmdLineOptions() && getAOTCmdLineOptions()->getOption(TR_UseHigherMethodCounts)))
_startupTimeMatters = TR_no;
else if (isQuickstartDetected())
_startupTimeMatters = TR_yes;
}

bool startupTimeMatters = (_startupTimeMatters == TR_yes ||
(_startupTimeMatters == TR_maybe && sharedClassCache()));

// Determine the counts for first time compilations
if (_initialCount == -1) // Count was not set by user
{
if (startupTimeMatters)
{
// Select conditions under which we want even smaller counts
if (TR::Compiler->target.isWindows() && !is64Bit(_target) && isQuickstartDetected() && sharedClassCache())
_initialCount = TR_QUICKSTART_SMALLER_INITIAL_COUNT;
else
_initialCount = TR_QUICKSTART_INITIAL_COUNT;
}
else // Use higher count
{
_initialCount = TR_DEFAULT_INITIAL_COUNT;
}
}
else
{
_countsAreProvidedByUser = true;
}

if (_initialBCount == -1)
{
if (_samplingFrequency == 0 || self()->getOption(TR_DisableInterpreterSampling))
_initialBCount = std::min(1, _initialCount); // If no help from sampling, then loopy methods need a smaller count
else
{
if (startupTimeMatters)
{
if (TR::Compiler->target.isWindows() && !is64Bit(_target) && isQuickstartDetected() && sharedClassCache())
_initialBCount = TR_QUICKSTART_SMALLER_INITIAL_BCOUNT;
else
_initialBCount = TR_QUICKSTART_INITIAL_BCOUNT;
}
else
{
_initialBCount = TR_DEFAULT_INITIAL_BCOUNT;
}
_initialBCount = std::min(_initialBCount, _initialCount);
}
}
else
{
_countsAreProvidedByUser = true;
}

if (_initialMILCount == -1)
_initialMILCount = std::min(startupTimeMatters? TR_QUICKSTART_INITIAL_MILCOUNT : TR_DEFAULT_INITIAL_MILCOUNT, _initialBCount);

if (_interpreterSamplingDivisorInStartupMode == -1) // unchanged
_interpreterSamplingDivisorInStartupMode = startupTimeMatters ? TR_DEFAULT_INTERPRETER_SAMPLING_DIVISOR : 64;
}

// Prevent increasing the counts if lowerMethodCounts or quickstart is used
if (_startupTimeMatters == TR_yes || _countsAreProvidedByUser)
{
getCmdLineOptions()->setOption(TR_IncreaseCountsForNonBootstrapMethods, false);
getCmdLineOptions()->setOption(TR_IncreaseCountsForMethodsCompiledOutsideStartup, false);
getCmdLineOptions()->setOption(TR_UseHigherCountsForNonSCCMethods, false);
getCmdLineOptions()->setOption(TR_UseHigherMethodCountsAfterStartup, false);
}
if (_countsAreProvidedByUser)
{
getCmdLineOptions()->setOption(TR_ReduceCountsForMethodsCompiledDuringStartup, false);
}

// Set up default count string if none was specified
//
if (!_countString)
_countString = self()->getDefaultCountString(); // _initialCount and _initialBCount have been set above

if (_countString)
{
// The counts string is set up as:
//
// counts=c0 b0 m0 c1 b1 m1 c2 b2 m2 c3 b3 m3 c4 b4 m4 ... etc.
//
// where "cn" is the count to get to recompile at level n
// "bn" is the bcount to get to recompile at level n
// "mn" is the milcount to get to recompile at level n
// If a value is '-' or is an omitted trailing value, that opt level is
// skipped. For levels other than 0, a zero value also skips the opt level.
int32_t initialCount = -1;
int32_t initialBCount = -1;
int32_t initialMILCount = -1;
bool allowRecompilation = false;

count[0] = 0;

const char *s = _countString;
if (s[0] == '"') ++s; // eat the leading quote
int32_t i;
for (i = minHotness; i <= maxHotness; ++i)
{
while (s[0] == ' ')
++s;
if (isdigit(s[0]))
{
count[i] = atoi(s);
while(isdigit(s[0]))
++s;
if (initialCount >= 0)
{
allowRecompilation = true;
if (count[i] == 0)
count[i] = -1;
}
else
{
initialCount = count[i];
}
}
else if (s[0] == '-')
{
count[i] = -1;
++s;
}
else
count[i] = -1;
while (s[0] == ' ')
++s;
if (isdigit(s[0]))
{
bcount[i] = atoi(s);
while(isdigit(s[0]))
++s;
if (initialBCount >= 0)
{
allowRecompilation = true;
if (bcount[i] == 0)
bcount[i] = -1;
}
else
initialBCount = bcount[i];
}
else if (s[0] == '-')
{
bcount[i] = -1;
++s;
}
else
bcount[i] = -1;
while (s[0] == ' ')
++s;
if (isdigit(s[0]))
{
milcount[i] = atoi(s);
while(isdigit(s[0]))
++s;
if (initialMILCount >= 0)
{
allowRecompilation = true;
if (milcount[i] == 0)
milcount[i] = -1;
}
else
initialMILCount = milcount[i];
}
else if (s[0] == '-')
{
milcount[i] = -1;
++s;
}
else
milcount[i] = -1;
}

_initialCount = initialCount;
_initialBCount = initialBCount;
_initialMILCount = initialMILCount;
_allowRecompilation = allowRecompilation;
}

// The following need to stay after the count string has been processed
if (_initialColdRunCount == -1) // not yet set
_initialColdRunCount = std::min(TR_INITIAL_COLDRUN_COUNT, _initialCount);
if (_initialColdRunBCount == -1) // not yet set
_initialColdRunBCount = std::min(TR_INITIAL_COLDRUN_BCOUNT, _initialBCount);


if (!_countString)
{
TR_VerboseLog::writeLine(TR_Vlog_FAILURE, "Count string could not be allocated");
return dummy_string;
}

if (_initialCount == -1 || _initialBCount == -1 || _initialMILCount == -1)
{
TR_VerboseLog::writeLine(TR_Vlog_FAILURE, "Bad string count: '%s'", _countString);
return _countString;
}

return 0;
}
#endif