diff --git a/compiler/p/codegen/OMRConstantDataSnippet.cpp b/compiler/p/codegen/OMRConstantDataSnippet.cpp index 262c93f9fec..093c5ba4181 100644 --- a/compiler/p/codegen/OMRConstantDataSnippet.cpp +++ b/compiler/p/codegen/OMRConstantDataSnippet.cpp @@ -81,7 +81,7 @@ int32_t OMR::ConstantDataSnippet::addConstantRequest(void *v, { fcursor = new (_cg->trHeapMemory()) PPCConstant(_cg, fin.fvalue); _floatConstants.add(fcursor); - if (TR::Compiler->target.is64Bit() && !comp->getOption(TR_DisableTOC)) + if (TR::Compiler->target.is64Bit()) { ret = TR_PPCTableOfConstants::lookUp(fin.fvalue, _cg); } @@ -110,7 +110,7 @@ int32_t OMR::ConstantDataSnippet::addConstantRequest(void *v, { dcursor = new (_cg->trHeapMemory()) PPCConstant(_cg, din.dvalue); _doubleConstants.add(dcursor); - if (TR::Compiler->target.is64Bit() && !comp->getOption(TR_DisableTOC)) + if (TR::Compiler->target.is64Bit()) { ret = TR_PPCTableOfConstants::lookUp(din.dvalue, _cg); } diff --git a/compiler/p/codegen/OMRTreeEvaluator.cpp b/compiler/p/codegen/OMRTreeEvaluator.cpp index 3c5d6dde487..199211126d1 100644 --- a/compiler/p/codegen/OMRTreeEvaluator.cpp +++ b/compiler/p/codegen/OMRTreeEvaluator.cpp @@ -198,8 +198,7 @@ TR::Instruction *loadConstant(TR::CodeGenerator *cg, TR::Node * node, int64_t va int32_t offset = PTOC_FULL_INDEX; - bool canUseTOC = (!TR::isJ9() || !isPicSite) && - !comp->getOption(TR_DisableTOC); + bool canUseTOC = (!TR::isJ9() || !isPicSite); if (canUseTOC && useTOC) offset = TR_PPCTableOfConstants::lookUp((int8_t *)&value, sizeof(int64_t), true, 0, cg); diff --git a/compiler/p/codegen/PPCTableOfConstants.cpp b/compiler/p/codegen/PPCTableOfConstants.cpp index edc1e9822ea..a6c524406a5 100644 --- a/compiler/p/codegen/PPCTableOfConstants.cpp +++ b/compiler/p/codegen/PPCTableOfConstants.cpp @@ -180,7 +180,7 @@ TR_PPCTableOfConstants::lookUp(int32_t val, struct TR_tocHashEntry *tmplate, int { TR::Compilation *comp = cg->comp(); - if (comp->compileRelocatableCode() || (comp->getOption(TR_EnableHCR) && comp->getOption(TR_HCRPatchClassPointers)) || comp->getOption(TR_MimicInterpreterFrameShape)) + if (comp->compileRelocatableCode() || comp->getOption(TR_DisableTOC) || (comp->getOption(TR_EnableHCR) && comp->getOption(TR_HCRPatchClassPointers)) || comp->getOption(TR_MimicInterpreterFrameShape)) return PTOC_FULL_INDEX; if (comp->isOptServer()) @@ -391,7 +391,7 @@ int32_t TR_PPCTableOfConstants::lookUp(int8_t *name, int32_t len, bool isAddr, i struct TR_tocHashEntry localEntry; int32_t val, offsetInSlot; - if (comp->compileRelocatableCode() || (comp->getOption(TR_EnableHCR) && comp->getOption(TR_HCRPatchClassPointers))) + if (comp->compileRelocatableCode() || comp->getOption(TR_DisableTOC) || (comp->getOption(TR_EnableHCR) && comp->getOption(TR_HCRPatchClassPointers))) return PTOC_FULL_INDEX; if (comp->isOptServer()) @@ -430,6 +430,9 @@ int32_t TR_PPCTableOfConstants::lookUp(double dvalue, TR::CodeGenerator *cg) return PTOC_FULL_INDEX; } + if (comp->getOption(TR_DisableTOC)) + return PTOC_FULL_INDEX; + struct TR_tocHashEntry localEntry; int32_t offsetInSlot, val, tindex; int8_t seed[8] = {'U', 'p', 'E', 'd', 'G', 'a', 'M', 'e'}; @@ -456,6 +459,9 @@ int32_t TR_PPCTableOfConstants::lookUp(float fvalue, TR::CodeGenerator *cg) return PTOC_FULL_INDEX; } + if (comp->getOption(TR_DisableTOC)) + return PTOC_FULL_INDEX; + struct TR_tocHashEntry localEntry; intptrj_t entryVal = 0; int32_t offsetInSlot, val, tindex; @@ -484,6 +490,9 @@ int32_t TR_PPCTableOfConstants::lookUp(TR::SymbolReference *symRef, TR::CodeGene return PTOC_FULL_INDEX; } + if (comp->getOption(TR_DisableTOC)) + return PTOC_FULL_INDEX; + TR::StaticSymbol *sym = symRef->getSymbol()->castToStaticSymbol(); intptrj_t addr = (intptrj_t)sym->getStaticAddress(); int32_t nlen, tindex; @@ -559,7 +568,7 @@ int32_t TR_PPCTableOfConstants::allocateChunk(uint32_t numEntries, TR::CodeGener { TR_PPCTableOfConstants *tocManagement = toPPCTableOfConstants(TR_PersistentMemory::getNonThreadSafePersistentInfo()->getPersistentTOC()); - if (tocManagement == NULL || cg->comp()->compileRelocatableCode() || (cg->comp()->getOption(TR_EnableHCR) && cg->comp()->getOption(TR_HCRPatchClassPointers))) + if (tocManagement == NULL || cg->comp()->getOption(TR_DisableTOC) || cg->comp()->compileRelocatableCode() || (cg->comp()->getOption(TR_EnableHCR) && cg->comp()->getOption(TR_HCRPatchClassPointers))) return PTOC_FULL_INDEX; if (grabMonitor)