From 27349e85cd5198a333f382a73b2a78d06709a20d Mon Sep 17 00:00:00 2001 From: Filip Jeremic Date: Fri, 6 Mar 2020 18:30:09 -0500 Subject: [PATCH] Reformat performProcessRelocationsPhase function The indentation in it's current state is very confusing [1], and at first sight one may think the: ``` if (comp->getCurrentMethod() == NULL) { comp->getMethodSymbol()->setMethodAddress(cg->getBinaryBufferStart()); } ``` piece of code is guarded by the `if (cg->getAheadOfTimeCompile() &&` check, which is what I first thought, but upon a more careful inspection the indentation was hiding this is not the case. [1] https://github.com/eclipse/omr/blob/31db81f3d84a431736ac7a9ff1b3980158fae258/compiler/codegen/OMRCodeGenPhase.cpp#L182-L202 Signed-off-by: Filip Jeremic --- compiler/codegen/OMRCodeGenPhase.cpp | 67 ++++++++++++++-------------- 1 file changed, 34 insertions(+), 33 deletions(-) diff --git a/compiler/codegen/OMRCodeGenPhase.cpp b/compiler/codegen/OMRCodeGenPhase.cpp index 9e70cc81a93..b817340e123 100644 --- a/compiler/codegen/OMRCodeGenPhase.cpp +++ b/compiler/codegen/OMRCodeGenPhase.cpp @@ -180,43 +180,44 @@ OMR::CodeGenPhase::performProcessRelocationsPhase(TR::CodeGenerator * cg, TR::Co } if (cg->getAheadOfTimeCompile() && (comp->getOption(TR_TraceRelocatableDataCG) || comp->getOption(TR_TraceRelocatableDataDetailsCG) || comp->getOption(TR_TraceReloCG))) - { - traceMsg(comp, "\n\n"); - if (comp->getOption(TR_TraceRelocatableDataDetailsCG)) // verbose output - { - uint8_t * relocatableMethodCodeStart = (uint8_t *)comp->getRelocatableMethodCodeStart(); - traceMsg(comp, "Code start = %8x, Method start pc = %x, Method start pc offset = 0x%x\n", relocatableMethodCodeStart, cg->getCodeStart(), cg->getCodeStart() - relocatableMethodCodeStart); - } - cg->getAheadOfTimeCompile()->dumpRelocationData(); - traceMsg(comp, "\n"); - } + { + traceMsg(comp, "\n\n"); + if (comp->getOption(TR_TraceRelocatableDataDetailsCG)) // verbose output + { + uint8_t * relocatableMethodCodeStart = (uint8_t *)comp->getRelocatableMethodCodeStart(); + traceMsg(comp, "Code start = %8x, Method start pc = %x, Method start pc offset = 0x%x\n", relocatableMethodCodeStart, cg->getCodeStart(), cg->getCodeStart() - relocatableMethodCodeStart); + } + cg->getAheadOfTimeCompile()->dumpRelocationData(); + traceMsg(comp, "\n"); + } - if (debug("dumpCodeSizes")) - { - diagnostic("%08d %s\n", cg->getCodeLength(), comp->signature()); - } + if (debug("dumpCodeSizes")) + { + diagnostic("%08d %s\n", cg->getCodeLength(), comp->signature()); + } - TR_ASSERT(cg->getCodeLength() <= cg->getEstimatedCodeLength(), - "Method length estimate must be conservatively large\n" - " codeLength = %d, estimatedCodeLength = %d \n", - cg->getCodeLength(), cg->getEstimatedCodeLength() - ); + TR_ASSERT(cg->getCodeLength() <= cg->getEstimatedCodeLength(), + "Method length estimate must be conservatively large\n" + " codeLength = %d, estimatedCodeLength = %d \n", + cg->getCodeLength(), cg->getEstimatedCodeLength() + ); - // also trace the interal stack atlas - cg->getStackAtlas()->close(cg); + // also trace the interal stack atlas + cg->getStackAtlas()->close(cg); + + TR::SimpleRegex * regex = comp->getOptions()->getSlipTrap(); + if (regex && TR::SimpleRegex::match(regex, comp->getCurrentMethod())) + { + if (cg->comp()->target().is64Bit()) + { + setDllSlip((char*)cg->getCodeStart(), (char*)cg->getCodeStart() + cg->getCodeLength(), "SLIPDLL64", comp); + } + else + { + setDllSlip((char*)cg->getCodeStart(), (char*)cg->getCodeStart() + cg->getCodeLength(), "SLIPDLL31", comp); + } + } - TR::SimpleRegex * regex = comp->getOptions()->getSlipTrap(); - if (regex && TR::SimpleRegex::match(regex, comp->getCurrentMethod())) - { - if (cg->comp()->target().is64Bit()) - { - setDllSlip((char*)cg->getCodeStart(),(char*)cg->getCodeStart()+cg->getCodeLength(),"SLIPDLL64", comp); - } - else - { - setDllSlip((char*)cg->getCodeStart(),(char*)cg->getCodeStart()+cg->getCodeLength(),"SLIPDLL31", comp); - } - } if (comp->getOption(TR_TraceCG) || comp->getOptions()->getTraceCGOption(TR_TraceCGPostBinaryEncoding)) { const char * title = "Post Relocation Instructions";