Skip to content

Commit

Permalink
Revert part of fix incorrect usage of TR::Options
Browse files Browse the repository at this point in the history
- Backing out this commit because of 2% performance regression on daytrader

Signed-off-by: Harry Yu <[email protected]>
  • Loading branch information
harryyu1994 committed Jul 31, 2018
1 parent ecd9e62 commit 999d0e9
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 26 deletions.
8 changes: 4 additions & 4 deletions compiler/compile/OMRCompilation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ OMR::Compilation::Compilation(
// while the PersistentMethodInfo is allocated during codegen creation
// Access to this list must be performed with assumptionTableMutex in hand
//
if (!options.getOption(TR_DisableFastAssumptionReclamation))
if (!TR::Options::getCmdLineOptions()->getOption(TR_DisableFastAssumptionReclamation))
_metadataAssumptionList = new (m->trPersistentMemory()) TR::SentinelRuntimeAssumption();
#endif

Expand Down Expand Up @@ -916,15 +916,15 @@ int32_t OMR::Compilation::compile()
if (!self()->getOption(TR_DisableSupportForCpuSpentInCompilation))
_cpuTimeAtStartOfCompilation = TR::Compiler->vm.cpuTimeSpentInCompilationThread(self());

bool printCodegenTime = self()->getOption(TR_CummTiming);
bool printCodegenTime = TR::Options::getCmdLineOptions()->getOption(TR_CummTiming);

if (self()->isOptServer())
{
// Temporarily exclude PPC due to perf regression
if( (self()->getMethodHotness() <= warm))
{
if (!TR::Compiler->target.cpu.isPower())
self()->getOptions()->setOption(TR_DisableInternalPointers);
TR::Options::getCmdLineOptions()->setOption(TR_DisableInternalPointers);
}
self()->getOptions()->setOption(TR_DisablePartialInlining);
}
Expand Down Expand Up @@ -1841,7 +1841,7 @@ void OMR::Compilation::resetVisitCounts(vcount_t count, TR::TreeTop *start)
void OMR::Compilation::reportFailure(const char *reason)
{
traceMsg(self(), "Compilation Failed Because: %s\n", reason);
if (self()->getOption(TR_PrintErrorInfoOnCompFailure))
if (TR::Options::getCmdLineOptions()->getOption(TR_PrintErrorInfoOnCompFailure))
fprintf(stderr, "Compilation Failed Because: %s\n", reason);
}

Expand Down
10 changes: 5 additions & 5 deletions compiler/control/CompileMethod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -405,23 +405,23 @@ compileMethodFromDetails(
}

if (
compiler.getOption(TR_PerfTool)
|| compiler.getOption(TR_EmitExecutableELFFile)
|| compiler.getOption(TR_EmitRelocatableELFFile)
TR::Options::getCmdLineOptions()->getOption(TR_PerfTool)
|| TR::Options::getCmdLineOptions()->getOption(TR_EmitExecutableELFFile)
|| TR::Options::getCmdLineOptions()->getOption(TR_EmitRelocatableELFFile)
)
{
TR::CodeCacheManager &codeCacheManager(fe.codeCacheManager());
TR::CodeGenerator &codeGenerator(*compiler.cg());
codeCacheManager.registerCompiledMethod(compiler.externalName(), startPC, codeGenerator.getCodeLength());
if (compiler.getOption(TR_EmitRelocatableELFFile))
if (TR::Options::getCmdLineOptions()->getOption(TR_EmitRelocatableELFFile))
{
auto &relocations = codeGenerator.getStaticRelocations();
for (auto it = relocations.begin(); it != relocations.end(); ++it)
{
codeCacheManager.registerStaticRelocation(*it);
}
}
if (compiler.getOption(TR_PerfTool))
if (TR::Options::getCmdLineOptions()->getOption(TR_PerfTool))
{
generatePerfToolEntry(startPC, codeGenerator.getCodeEnd(), compiler.signature(), compiler.getHotnessName(compiler.getMethodHotness()));
}
Expand Down
4 changes: 2 additions & 2 deletions compiler/il/Aliases.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ OMR::SymbolReference::getUseonlyAliasesBV(TR::SymbolReferenceTable * symRefTab)
case TR::Symbol::IsResolvedMethod:
{
TR::ResolvedMethodSymbol * resolvedMethodSymbol = _symbol->castToResolvedMethodSymbol();
if (!TR::comp()->getOption(TR_EnableHCR))
if (!TR::Options::getCmdLineOptions()->getOption(TR_EnableHCR))
{
switch (resolvedMethodSymbol->getRecognizedMethod())
{
Expand Down Expand Up @@ -354,7 +354,7 @@ OMR::SymbolReference::getUseDefAliasesBV(bool isDirectCall, bool includeGCSafePo
{
TR::ResolvedMethodSymbol * resolvedMethodSymbol = _symbol->castToResolvedMethodSymbol();

if (!comp->getOption(TR_EnableHCR))
if (!TR::Options::getCmdLineOptions()->getOption(TR_EnableHCR))
{
switch (resolvedMethodSymbol->getRecognizedMethod())
{
Expand Down
2 changes: 1 addition & 1 deletion compiler/optimizer/Inliner.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ class OMR_InlinerPolicy : public TR::OptimizationPolicy, public OMR_InlinerHelpe
virtual int32_t getInitialBytecodeSize(TR_ResolvedMethod *feMethod, TR::ResolvedMethodSymbol * methodSymbol, TR::Compilation *comp);
virtual bool tryToInline(TR_CallTarget *, TR_CallStack *, bool);
virtual bool inlineMethodEvenForColdBlocks(TR_ResolvedMethod *method);
bool aggressiveSmallAppOpts() { return comp()->getOption(TR_AggressiveOpts); }
bool aggressiveSmallAppOpts() { return TR::Options::getCmdLineOptions()->getOption(TR_AggressiveOpts); }
virtual bool willBeInlinedInCodeGen(TR::RecognizedMethod method);
virtual bool canInlineMethodWhileInstrumenting(TR_ResolvedMethod *method);

Expand Down
16 changes: 8 additions & 8 deletions compiler/optimizer/LoopVersioner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ bool TR_LoopVersioner::loopIsWorthVersioning(TR_RegionStructure *naturalLoop)
}

// if aggressive loop versioner flag is set then run at any optlevel, otherwise only at warm or less
bool aggressive = comp()->getOption(TR_EnableAggressiveLoopVersioning);
bool aggressive = TR::Options::getCmdLineOptions()->getOption(TR_EnableAggressiveLoopVersioning);
if (aggressive || comp()->getMethodHotness() <= warm)
{
if (naturalLoop->getParent())
Expand All @@ -225,7 +225,7 @@ bool TR_LoopVersioner::loopIsWorthVersioning(TR_RegionStructure *naturalLoop)
}
}

bool aggressive = comp()->getOption(TR_EnableAggressiveLoopVersioning);
bool aggressive = TR::Options::getCmdLineOptions()->getOption(TR_EnableAggressiveLoopVersioning);

int32_t lvBlockFreqCutoff;
static const char * b = feGetEnv("TR_LoopVersionerFreqCutoff");
Expand Down Expand Up @@ -567,7 +567,7 @@ int32_t TR_LoopVersioner::performWithoutDominators()
{
// default hotness threshold
TR_Hotness hotnessThreshold = hot;
if (comp()->getOption(TR_EnableAggressiveLoopVersioning))
if (TR::Options::getCmdLineOptions()->getOption(TR_EnableAggressiveLoopVersioning))
{
if (trace()) traceMsg(comp(), "aggressiveLoopVersioning: raising hotnessThreshold for conditionalsWillBeEliminated\n");
hotnessThreshold = maxHotness; // threshold which can't be matched by the > operator
Expand Down Expand Up @@ -712,7 +712,7 @@ int32_t TR_LoopVersioner::performWithoutDominators()
////if (!_virtualGuardPairs.isEmpty())
if (!_virtualGuardInfo.isEmpty())
{
bool disableLT = comp()->getOption(TR_DisableLoopTransfer);
bool disableLT = TR::Options::getCmdLineOptions()->getOption(TR_DisableLoopTransfer);
if (!disableLT)
performLoopTransfer();
}
Expand Down Expand Up @@ -3252,7 +3252,7 @@ bool TR_LoopVersioner::detectChecksToBeEliminated(TR_RegionStructure *whileLoop,
)
{
isUnimportant = true;
if (trace() || comp()->getOption(TR_CountOptTransformations))
if (trace() || TR::Options::getCmdLineOptions()->getOption(TR_CountOptTransformations))
{
for (TR::TreeTop *tt = entryTree; isUnimportant && tt != exitTree; tt = tt->getNextTreeTop())
{
Expand Down Expand Up @@ -3315,7 +3315,7 @@ bool TR_LoopVersioner::detectChecksToBeEliminated(TR_RegionStructure *whileLoop,
vcount_t visitCount = comp()->incVisitCount(); //@TODO: unsafe API/use pattern
updateDefinitionsAndCollectProfiledExprs(NULL, currentNode, visitCount, specializedInvariantNodes, invariantNodes, invariantTranslationNodesList, NULL, collectProfiledExprs, nextBlock, warmBranchCount);

bool disableLT = comp()->getOption(TR_DisableLoopTransfer);
bool disableLT = TR::Options::getCmdLineOptions()->getOption(TR_DisableLoopTransfer);
if (!disableLT &&
currentNode->isTheVirtualGuardForAGuardedInlinedCall() &&
blocksInWhileLoop.find(currentNode->getBranchDestination()->getNode()->getBlock()))
Expand Down Expand Up @@ -3791,7 +3791,7 @@ void TR_LoopVersioner::versionNaturalLoop(TR_RegionStructure *whileLoop, List<TR
}

TR::Node *lastTree = nextBlock->getLastRealTreeTop()->getNode();
bool disableLT = comp()->getOption(TR_DisableLoopTransfer);
bool disableLT = TR::Options::getCmdLineOptions()->getOption(TR_DisableLoopTransfer);
if (!disableLT &&
lastTree->getOpCode().isIf() &&
blocksInWhileLoop.find(lastTree->getBranchDestination()->getNode()->getBlock()) &&
Expand Down Expand Up @@ -4255,7 +4255,7 @@ void TR_LoopVersioner::versionNaturalLoop(TR_RegionStructure *whileLoop, List<TR
TR_Hotness hotnessThreshold = hot;

// If aggressive loop versioning is requested, don't call buildNullCheckComparisonsTree based on hotness
if (comp()->getOption(TR_EnableAggressiveLoopVersioning))
if (TR::Options::getCmdLineOptions()->getOption(TR_EnableAggressiveLoopVersioning))
{
if (trace()) traceMsg(comp(), "aggressiveLoopVersioning: raising hotnessThreshold for buildNullCheckComparisonsTree\n");
hotnessThreshold = maxHotness; // threshold which can't be matched by the > operator
Expand Down
6 changes: 3 additions & 3 deletions compiler/optimizer/OMROptimizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1139,7 +1139,7 @@ void OMR::Optimizer::optimize()
}
}

if (comp()->getOption(TR_EnableDeterministicOrientedCompilation) &&
if (TR::Options::getCmdLineOptions()->getOption(TR_EnableDeterministicOrientedCompilation) &&
comp()->isOutermostMethod() &&
(comp()->getMethodHotness() > cold) &&
(comp()->getMethodHotness() < scorching))
Expand Down Expand Up @@ -1353,13 +1353,13 @@ int32_t OMR::Optimizer::performOptimization(const OptimizationStrategy *optimiza
#ifdef J9_PROJECT_SPECIFIC
case IfNotClassLoadPhase:
if (!comp()->getPersistentInfo()->isClassLoadingPhase() ||
comp()->getOption(TR_DontDowngradeToCold))
TR::Options::getCmdLineOptions()->getOption(TR_DontDowngradeToCold))
doThisOptimization = true;
break;

case IfNotClassLoadPhaseAndNotProfiling:
if ((!comp()->getPersistentInfo()->isClassLoadingPhase() ||
comp()->getOption(TR_DontDowngradeToCold))
TR::Options::getCmdLineOptions()->getOption(TR_DontDowngradeToCold))
&&
(!comp()->isProfilingCompilation() || debug("ignoreIfNotProfiling"))
)
Expand Down
2 changes: 1 addition & 1 deletion compiler/optimizer/OrderBlocks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ bool TR_OrderBlocks::candidateIsBetterSuccessorThanBest(TR::CFGEdge *candidateEd

//if (!_superColdBlockOnly)
// {
if (!comp()->getOption(TR_DisableInterpreterProfiling))
if (!TR::Options::getCmdLineOptions()->getOption(TR_DisableInterpreterProfiling))
{
if (candidateEdge->getFrequency() >= 0)
{
Expand Down
2 changes: 1 addition & 1 deletion compiler/optimizer/VPHandlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12771,7 +12771,7 @@ TR::Node *constrainArrayStoreChk(OMR::ValuePropagation *vp, TR::Node *node)
}

else if ( !vp->comp()->compileRelocatableCode() &&
!(vp->comp()->getOption(TR_DisableArrayStoreCheckOpts)) &&
!(TR::Options::getCmdLineOptions()->getOption(TR_DisableArrayStoreCheckOpts)) &&
arrayComponentClass &&
objectClass &&
vp->fe()->isInstanceOf(objectClass, arrayComponentClass,true,true)
Expand Down
2 changes: 1 addition & 1 deletion compiler/x/amd64/codegen/AMD64SystemLinkage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -892,7 +892,7 @@ TR::Register *TR::AMD64SystemLinkage::buildDirectDispatch(
methodSymRef,
cg());

if (comp()->getOption(TR_EmitRelocatableELFFile))
if (TR::Options::getCmdLineOptions()->getOption(TR_EmitRelocatableELFFile))
{
LoadRegisterInstruction->setReloKind(TR_NativeMethodAbsolute);
}
Expand Down

0 comments on commit 999d0e9

Please sign in to comment.