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

Fix incorrect usage of TR::Options #2290

Merged
merged 2 commits into from
Jul 10, 2018
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
2 changes: 1 addition & 1 deletion runtime/compiler/codegen/J9CodeGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4416,7 +4416,7 @@ void
J9::CodeGenerator::createHWPRecords()
{
if (self()->comp()->getPersistentInfo()->isRuntimeInstrumentationEnabled() &&
TR::Options::getCmdLineOptions()->getOption(TR_EnableHardwareProfileIndirectDispatch))
self()->comp()->getOption(TR_EnableHardwareProfileIndirectDispatch))
{
self()->comp()->fej9()->createHWProfilerRecords(self()->comp());
}
Expand Down
10 changes: 5 additions & 5 deletions runtime/compiler/control/CompilationThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7465,7 +7465,7 @@ TR::CompilationInfoPerThreadBase::wrappedCompile(J9PortLibrary *portLib, void *
// Check to see if there is sufficient physical memory available for this compilation
// Temporarily only do this for JSR292 compilations
if (TR::CompilationInfo::isJSR292(details.getMethod())
|| TR::Options::getCmdLineOptions()->getOption(TR_EnableSelfTuningScratchMemoryUsageBeforeCompile))
|| compiler->getOption(TR_EnableSelfTuningScratchMemoryUsageBeforeCompile))
{
bool incompleteInfo = false;
int64_t physicalLimitB_64bit = compInfo->computeFreePhysicalLimitAndAbortCompilationIfLow(compiler,
Expand All @@ -7486,7 +7486,7 @@ TR::CompilationInfoPerThreadBase::wrappedCompile(J9PortLibrary *portLib, void *
// If we weren't able to get all the memory information
// only lower the limit for JSR292 compilations
if (TR::CompilationInfo::isJSR292(details.getMethod())
&& TR::Options::getCmdLineOptions()->getOption(TR_EnableSelfTuningScratchMemoryUsageBeforeCompile))
&& compiler->getOption(TR_EnableSelfTuningScratchMemoryUsageBeforeCompile))
{
proposedScratchMemoryLimitB = (physicalLimitB >= scratchSegmentProvider.allocationLimit()
? physicalLimitB
Expand All @@ -7501,7 +7501,7 @@ TR::CompilationInfoPerThreadBase::wrappedCompile(J9PortLibrary *portLib, void *
}
else // Not enough physical memory to use even a regular scratch space limit
{
if (TR::Options::getCmdLineOptions()->getOption(TR_EnableSelfTuningScratchMemoryUsageBeforeCompile))
if (compiler->getOption(TR_EnableSelfTuningScratchMemoryUsageBeforeCompile))
{
proposedScratchMemoryLimitB = (physicalLimitB >= TR::Options::getScratchSpaceLowerBound()
? physicalLimitB
Expand Down Expand Up @@ -7958,7 +7958,7 @@ TR::CompilationInfoPerThreadBase::compile(
);
}

if (compiler->getOptions()->getOption(TR_AlwaysSafeFatal)) {
if (compiler->getOption(TR_AlwaysSafeFatal)) {
TR_ASSERT_SAFE_FATAL(false, "alwaysSafeFatal set");
TR_VerboseLog::writeLineLocked(
TR_Vlog_INFO ,
Expand All @@ -7968,7 +7968,7 @@ TR::CompilationInfoPerThreadBase::compile(
);
}

if (compiler->getOptions()->getOption(TR_AlwaysFatalAssert)) {
if (compiler->getOption(TR_AlwaysFatalAssert)) {
TR_ASSERT_FATAL(false, "alwaysFatalAssert set");
}

Expand Down
10 changes: 4 additions & 6 deletions runtime/compiler/env/j9method.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1116,7 +1116,7 @@ TR_ResolvedJ9MethodBase::isInlineable(TR::Compilation *comp)

static intptrj_t getInitialCountForMethod(TR_ResolvedMethod *m, TR::Compilation *comp)
{
TR::Options * options = comp->getOptions()->getCmdLineOptions();
TR::Options * options = comp->getOptions();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am torn about this one: we are asking about the initial count for method m which is not the same as the method being compiled. It's true that asking for the global options is not correct either because the user could have provided specific options for that method.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that true 100% of the time? Are there cases where method m and method being compiled are the same method?

TR_ResolvedMethod *compMethod = comp->getCurrentMethod();
count = compMethod->getInvocationCount();
initialCount = getInitialCountForMethod(compMethod, comp);

^ this looks like they are the same method, no?

Copy link
Contributor Author

@harryyu1994 harryyu1994 Jun 28, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this is the call where method m and method being compiled could be different

 intptrj_t initialCount = getInitialCountForMethod(this, comp);

is there a way to get options from TR_ResolvedMethod *m.


intptrj_t initialCount = m->hasBackwardBranches() ? options->getInitialBCount() : options->getInitialCount();

Expand All @@ -1132,7 +1132,7 @@ static intptrj_t getInitialCountForMethod(TR_ResolvedMethod *m, TR::Compilation
// 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
#else
bool startupTimeMatters = TR::Options::isQuickstartDetected() || TR::Options::getCmdLineOptions()->getOption(TR_UseLowerMethodCounts);
bool startupTimeMatters = TR::Options::isQuickstartDetected() || comp->getOption(TR_UseLowerMethodCounts);

if (!startupTimeMatters)
{
Expand Down Expand Up @@ -1222,14 +1222,13 @@ TR_ResolvedJ9MethodBase::isCold(TR::Compilation * comp, bool isIndirectCall, TR:

intptrj_t count = getInvocationCount();

TR::Options * options = comp->getOptions()->getCmdLineOptions();
intptrj_t initialCount = getInitialCountForMethod(this, comp);

if (count < 0 || count > initialCount)
return false;

// if compiling a BigDecimal method, block isn't cold
if ((!options->getOption(TR_DisableDFP) && !comp->getOptions()->getAOTCmdLineOptions()->getOption(TR_DisableDFP)) &&
if ((!comp->getOption(TR_DisableDFP)) &&
(
#ifdef TR_TARGET_S390
TR::Compiler->target.cpu.getS390SupportsDFP() ||
Expand Down Expand Up @@ -2054,8 +2053,7 @@ TR_ResolvedRelocatableJ9Method::createResolvedMethodFromJ9Method(TR::Compilation
if (dontInline)
return NULL;

if (TR::Options::getCmdLineOptions()->getOption(TR_DisableDFP) ||
TR::Options::getAOTCmdLineOptions()->getOption(TR_DisableDFP) ||
if (comp->getOption(TR_DisableDFP) ||
(!(TR::Compiler->target.cpu.supportsDecimalFloatingPoint()
#ifdef TR_TARGET_S390
|| TR::Compiler->target.cpu.getS390SupportsDFP()
Expand Down
6 changes: 3 additions & 3 deletions runtime/compiler/ilgen/IlGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -366,10 +366,10 @@ TR_J9ByteCodeIlGenerator::genILFromByteCodes()

prependEntryCode(blocks(0));

if (!comp()->getOptions()->getOption(TR_DisableGuardedCountingRecompilations) &&
if (!comp()->getOption(TR_DisableGuardedCountingRecompilations) &&
comp()->getRecompilationInfo() && comp()->getRecompilationInfo()->shouldBeCompiledAgain() &&
!comp()->getRecompilationInfo()->isRecompilation() && // only do it for first time compilations
(!comp()->getPersistentInfo()->_countForRecompile || comp()->getOptions()->getOption(TR_EnableMultipleGCRPeriods)) &&
(!comp()->getPersistentInfo()->_countForRecompile || comp()->getOption(TR_EnableMultipleGCRPeriods)) &&
comp()->isOutermostMethod() &&
comp()->getOptions()->getInsertGCRTrees() &&
!comp()->isDLT() && !method()->isJNINative())
Expand Down Expand Up @@ -1212,7 +1212,7 @@ TR_J9ByteCodeIlGenerator::createGeneratedFirstBlock()
bool
TR_J9ByteCodeIlGenerator::hasFPU()
{
bool result = !comp()->getOptions()->getOption(TR_DisableFPCodeGen) ? TR::Compiler->target.cpu.hasFPU() : false;
bool result = !comp()->getOption(TR_DisableFPCodeGen) ? TR::Compiler->target.cpu.hasFPU() : false;
return result;
}

Expand Down
2 changes: 1 addition & 1 deletion runtime/compiler/ilgen/J9ByteCodeIlGenerator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class TR_J9ByteCodeIlGenerator : public TR_IlGenerator, public TR_J9ByteCodeIter
bool inliningCheckIfFinalizeObjectIsBeneficial()
{
return (comp()->getOption(TR_FullSpeedDebug) || comp()->getOptLevel() <= cold ||
(!comp()->getOptions()->getOption(TR_DisableInlineCheckIfFinalizeObject) && fej9()->isBenefitInliningCheckIfFinalizeObject()) ||
(!comp()->getOption(TR_DisableInlineCheckIfFinalizeObject) && fej9()->isBenefitInliningCheckIfFinalizeObject()) ||
(comp()->getCurrentMethod()->isConstructor() && !comp()->getCurrentMethod()->isFinal()));
}
virtual TR::ResolvedMethodSymbol *methodSymbol() const { return _methodSymbol;}
Expand Down
2 changes: 1 addition & 1 deletion runtime/compiler/optimizer/EscapeAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1498,7 +1498,7 @@ Candidate *TR_EscapeAnalysis::createCandidateIfValid(TR::Node *node, TR_OpaqueCl
// Don't convert double-word arrays if platform does not have double-word aligned stacks
// will handle stack alignment later
else if (!comp()->cg()->getHasDoubleWordAlignedStack() &&
node->getOpCodeValue() == TR::newarray && !comp()->getOptions()->getOption(TR_EnableSIMDLibrary))
node->getOpCodeValue() == TR::newarray && !comp()->getOption(TR_EnableSIMDLibrary))
{
TR::Node *typeNode = node->getSecondChild();
if (typeNode->getInt() == 7 || typeNode->getInt() == 11)
Expand Down
2 changes: 1 addition & 1 deletion runtime/compiler/optimizer/J9TransformUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ bool J9::TransformUtil::foldFinalFieldsIn(TR_OpaqueClassBlock *clazz, char *clas
return true;

static char *enableJCLFolding = feGetEnv("TR_EnableJCLStaticFinalFieldFolding");
if ((enableJCLFolding || TR::Options::getCmdLineOptions()->getOption(TR_AggressiveOpts))
if ((enableJCLFolding || comp->getOption(TR_AggressiveOpts))
&& isStatic
&& comp->fej9()->isClassLibraryClass(clazz)
&& comp->fej9()->isClassInitialized(clazz))
Expand Down
6 changes: 3 additions & 3 deletions runtime/compiler/optimizer/SPMDParallelizer.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2017 IBM Corp. and others
* Copyright (c) 2000, 2018 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -3389,7 +3389,7 @@ TR_SPMDKernelParallelizer::perform()
TR_HashTab* reductionOperationsHashTab = new (comp()->trStackMemory()) TR_HashTab(comp()->trMemory(), stackAlloc);

//TODO: make independent of GPU
if ((!comp()->getOptions()->getOption(TR_DisableAutoSIMD) &&
if ((!comp()->getOption(TR_DisableAutoSIMD) &&
comp()->cg()->getSupportsAutoSIMD()) ||
comp()->getOptions()->getEnableGPU(TR_EnableGPU))
collectParallelLoops(root, simdLoops, reductionOperationsHashTab, useDefInfo);
Expand Down Expand Up @@ -4188,7 +4188,7 @@ TR_SPMDKernelParallelizer::collectParallelLoops(TR_RegionStructure *region,
TR_HashId id = 0;

if (isSPMDKernelLoop(region, comp()) ||
(!comp()->getOptions()->getOption(TR_DisableAutoSIMD) &&
(!comp()->getOption(TR_DisableAutoSIMD) &&
comp()->cg()->getSupportsAutoSIMD() &&
isPerfectNest(region, comp()) &&
checkDataLocality(region, useNodesOfDefsInLoop, defsInLoop, comp(), useDefInfo, reductionHashTab) &&
Expand Down
2 changes: 1 addition & 1 deletion runtime/compiler/p/codegen/J9CodeGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ bool
J9::Power::CodeGenerator::enableAESInHardwareTransformations()
{
if ( (TR::Compiler->target.cpu.getPPCSupportsAES() || (TR::Compiler->target.cpu.getPPCSupportsVMX() && TR::Compiler->target.cpu.getPPCSupportsVSX())) &&
!self()->comp()->getOptions()->getOption(TR_DisableAESInHardware))
!self()->comp()->getOption(TR_DisableAESInHardware))
return true;
else
return false;
Expand Down
2 changes: 1 addition & 1 deletion runtime/compiler/p/codegen/J9TreeEvaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2780,7 +2780,7 @@ static void VMarrayStoreCHKEvaluator(TR::Node *node, TR::Register *src, TR::Regi
generateTrg1Src2Instruction(cg,TR::InstOpCode::Op_cmpl, node, cndReg, t1Reg, t3Reg);
generateConditionalBranchInstruction(cg, TR::InstOpCode::beq, node, toWB, cndReg);

if ((!TR::Options::getCmdLineOptions()->getOption(TR_DisableArrayStoreCheckOpts)) && node->getArrayComponentClassInNode())
if ((!comp->getOption(TR_DisableArrayStoreCheckOpts)) && node->getArrayComponentClassInNode())
{
TR_OpaqueClassBlock *castClass = (TR_OpaqueClassBlock *) node->getArrayComponentClassInNode();

Expand Down
4 changes: 2 additions & 2 deletions runtime/compiler/runtime/IProfiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ TR_IProfiler::persistIprofileInfo(TR::ResolvedMethodSymbol *resolvedMethodSymbol
if (TR::Options::sharedClassCache() // shared classes must be enabled
&& !comp->getOption(TR_DisablePersistIProfile) &&
isIProfilingEnabled() &&
(!SCfull || !TR::Options::getCmdLineOptions()->getOption(TR_DisableUpdateJITBytesSize)))
(!SCfull || !comp->getOption(TR_DisableUpdateJITBytesSize)))
{
TR_J9VMBase *fej9 = (TR_J9VMBase *)_vm;
J9SharedClassConfig * scConfig = _compInfo->getJITConfig()->javaVM->sharedClassConfig;
Expand Down Expand Up @@ -489,7 +489,7 @@ TR_IProfiler::persistIprofileInfo(TR::ResolvedMethodSymbol *resolvedMethodSymbol

if (SCfull &&
bytesToPersist &&
!TR::Options::getCmdLineOptions()->getOption(TR_DisableUpdateJITBytesSize))
!comp->getOption(TR_DisableUpdateJITBytesSize))
{
_compInfo->increaseUnstoredBytes(0, bytesToPersist);
}
Expand Down
8 changes: 4 additions & 4 deletions runtime/compiler/runtime/MetaData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1435,8 +1435,8 @@ createMethodMetaData(

int32_t bytecodePCToIAMapOffset = -1;
if (comp->getPersistentInfo()->isRuntimeInstrumentationEnabled() &&
TR::Options::getCmdLineOptions()->getOption(TR_EnableHardwareProfileIndirectDispatch) &&
TR::Options::getCmdLineOptions()->getOption(TR_EnableMetadataBytecodePCToIAMap))
comp->getOption(TR_EnableHardwareProfileIndirectDispatch) &&
comp->getOption(TR_EnableMetadataBytecodePCToIAMap))
{
// Array of TR_HWPBytecodePCToIAMap structs
// The first element is a special; it contains the size of the array and an eyecatcher
Expand Down Expand Up @@ -1699,8 +1699,8 @@ createMethodMetaData(
}

if (comp->getPersistentInfo()->isRuntimeInstrumentationEnabled() &&
TR::Options::getCmdLineOptions()->getOption(TR_EnableHardwareProfileIndirectDispatch) &&
TR::Options::getCmdLineOptions()->getOption(TR_EnableMetadataBytecodePCToIAMap))
comp->getOption(TR_EnableHardwareProfileIndirectDispatch) &&
comp->getOption(TR_EnableMetadataBytecodePCToIAMap))
{
void *bytecodePCToIAMapLocation = (void *)((uint8_t*)data + bytecodePCToIAMapOffset);
data->riData = bytecodePCToIAMapLocation;
Expand Down
2 changes: 1 addition & 1 deletion runtime/compiler/x/codegen/J9CodeGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ J9::X86::CodeGenerator::nopsAlsoProcessedByRelocations()
bool
J9::X86::CodeGenerator::enableAESInHardwareTransformations()
{
if (TR::CodeGenerator::getX86ProcessorInfo().supportsAESNI() && !self()->comp()->getOptions()->getOption(TR_DisableAESInHardware) && !self()->comp()->getCurrentMethod()->isJNINative())
if (TR::CodeGenerator::getX86ProcessorInfo().supportsAESNI() && !self()->comp()->getOption(TR_DisableAESInHardware) && !self()->comp()->getCurrentMethod()->isJNINative())
return true;
else
return false;
Expand Down
8 changes: 4 additions & 4 deletions runtime/compiler/x/codegen/J9TreeEvaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6439,7 +6439,7 @@ void J9::X86::TreeEvaluator::generateValueTracingCode(
TR::Register *valueReg,
TR::CodeGenerator *cg)
{
if (!TR::Options::getCmdLineOptions()->getOption(TR_EnableValueTracing))
if (!cg->comp()->getOption(TR_EnableValueTracing))
return;
// the code requires that the caller has vmThread in EBP as well as
// that the caller has already setup internal control flow
Expand Down Expand Up @@ -6468,7 +6468,7 @@ void J9::X86::TreeEvaluator::generateValueTracingCode(
TR::Register *valueRegLow,
TR::CodeGenerator *cg)
{
if (!TR::Options::getCmdLineOptions()->getOption(TR_EnableValueTracing))
if (!cg->comp()->getOption(TR_EnableValueTracing))
return;

// the code requires that the caller has vmThread in EBP as well as
Expand Down Expand Up @@ -9709,7 +9709,7 @@ J9::X86::TreeEvaluator::VMarrayStoreCHKEvaluator(
// --------------------------------------------


if (!(TR::Options::getCmdLineOptions()->getOption(TR_DisableArrayStoreCheckOpts)) && node->getArrayComponentClassInNode() )
if (!(comp->getOption(TR_DisableArrayStoreCheckOpts)) && node->getArrayComponentClassInNode() )
{
TR_OpaqueClassBlock *arrayComponentClass = (TR_OpaqueClassBlock *) node->getArrayComponentClassInNode();
if (TR::Compiler->target.is64Bit())
Expand Down Expand Up @@ -12839,7 +12839,7 @@ void J9::X86::TreeEvaluator::VMwrtbarRealTimeWithoutStoreEvaluator(
TR::DebugCounter::debugCounterName(comp, "helperCalls/%s/(%s)/%d/%d", node->getOpCode().getName(), comp->signature(), node->getByteCodeInfo().getCallerIndex(), node->getByteCodeInfo().getByteCodeIndex()),
1, TR::DebugCounter::Cheap);

if (TR::Options::getCmdLineOptions()->getOption(TR_CountWriteBarriersRT))
if (comp->getOption(TR_CountWriteBarriersRT))
{
TR::MemoryReference *barrierCountMR = generateX86MemoryReference(cg->getVMThreadRegister(), offsetof(J9VMThread, debugEventData6), cg);
generateMemInstruction(INCMem(TR::Compiler->target.is64Bit()), node, barrierCountMR, cg);
Expand Down
2 changes: 1 addition & 1 deletion runtime/compiler/x/codegen/X86PrivateLinkage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1698,7 +1698,7 @@ void TR::X86CallSite::computeProfiledTargets()
(callNode->getSymbolReference() != comp()->getSymRefTab()->findObjectNewInstanceImplSymbol()) &&
callNode->getOpCode().isIndirect())
{
if (!TR::Options::getCmdLineOptions()->getOption(TR_DisableInterpreterProfiling) &&
if (!comp()->getOption(TR_DisableInterpreterProfiling) &&
TR_ValueProfileInfoManager::get(comp()))
{
TR::Node *callNode = getCallNode();
Expand Down
Loading