Skip to content

Commit

Permalink
ool_in_warm_pr: PR comments 1
Browse files Browse the repository at this point in the history
  • Loading branch information
gita-omr committed Aug 7, 2024
1 parent 9a6d5fe commit f93c09f
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 31 deletions.
1 change: 1 addition & 0 deletions compiler/control/OMROptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1002,6 +1002,7 @@ TR::OptionTable OMR::Options::_jitOptions[] = {
TR::Options::setStaticNumeric, (intptr_t)&OMR::Options::_minProfiledCheckcastFrequency, 0, "F%d", NOT_IN_SUBSET},
{"minSleepTimeMsForCompThrottling=", "M<nnn>\tLower bound for sleep time during compilation throttling (ms)",
TR::Options::setStaticNumeric, (intptr_t)&OMR::Options::_minSleepTimeMsForCompThrottling, 0, "F%d", NOT_IN_SUBSET },
{"moveOOLInstructionsToWarmCode", "M\tmove out-of-line instructions to after last warm instruction", SET_OPTION_BIT(TR_MoveOOLInstructionsToWarmCode), "F"},
{"noAotSecondRunDetection", "M\tdo not do second run detection for AOT", SET_OPTION_BIT(TR_NoAotSecondRunDetection), "F", NOT_IN_SUBSET },
#ifdef DEBUG
{"noExceptions", "C\tfail compilation for methods with exceptions",
Expand Down
2 changes: 1 addition & 1 deletion compiler/control/OMROptions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ enum TR_CompilationOptions
TR_BreakOnNew = 0x08000000 + 9,
TR_DisableInliningUnrecognizedIntrinsics = 0x10000000 + 9,
TR_EnableVectorAPIExpansion = 0x20000000 + 9,
// Available = 0x40000000 + 9,
TR_MoveOOLInstructionsToWarmCode = 0x40000000 + 9,
// Available = 0x80000000 + 9,

// Option word 10
Expand Down
58 changes: 29 additions & 29 deletions compiler/x/codegen/OMRCodeGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1868,8 +1868,8 @@ void OMR::X86::CodeGenerator::doRegisterAssignment(TR_RegisterKinds kindsToAssig
self()->doBackwardsRegisterAssignment(kindsToAssign, self()->getAppendInstruction());
}

if (TR::Options::getCmdLineOptions()->getOption(TR_EnableCodeCacheDisclaiming))
moveOutOfLineInstructionsToWarm();
if (TR::Options::getCmdLineOptions()->getOption(TR_MoveOOLInstructionsToWarmCode))
moveOutOfLineInstructionsToWarmCode();
}

bool OMR::X86::CodeGenerator::isReturnInstruction(TR::Instruction *instr)
Expand Down Expand Up @@ -3505,58 +3505,58 @@ OMR::X86::CodeGenerator::getOutOfLineCodeSize()
}

void
OMR::X86::CodeGenerator::moveOutOfLineInstructionsToWarm()
OMR::X86::CodeGenerator::moveOutOfLineInstructionsToWarmCode()
{
// OOL instructions are already attached at the end of the IL (after cold instructions)
// and register allocated.
// Move them to immediately after the last warm instruction, unless they already happend to be
// Move them to immediately after the last warm instruction, unless they already happened to be
// there (e.g. there are no cold instructions)
//
if (!self()->getLastWarmInstruction())
return;

if (self()->comp()->getOption(TR_TraceCG))
traceMsg(self()->comp(), "Moving OutOfLine instructions\n");
traceMsg(self()->comp(), "Moving OutOfLine instructions to after %p\n", self()->getLastWarmInstruction());

auto oiIterator = self()->getOutlinedInstructionsList().begin();

while (oiIterator != self()->getOutlinedInstructionsList().end())
{
TR::Instruction *firstInstruction = (*oiIterator)->getFirstInstruction();
TR::Instruction *lastInstruction = (*oiIterator)->getAppendInstruction();
TR::Instruction *firstOLInstruction = (*oiIterator)->getFirstInstruction();
TR::Instruction *lastOLInstruction = (*oiIterator)->getAppendInstruction();

TR_ASSERT_FATAL(firstInstruction, "VFPRestore instruciton should preceeed any OOL section\n");
TR_ASSERT_FATAL(firstOLInstruction, "VFPRestore instruction should preceeed any OOL section\n");
TR_ASSERT_FATAL(self()->getLastWarmInstruction() != self()->getAppendInstruction(),
"Last warm instruction can't be append instruction since OOL code was attached already\n");

if (self()->getLastWarmInstruction() &&
self()->getLastWarmInstruction() != firstInstruction->getPrev())
if (self()->getLastWarmInstruction() != firstOLInstruction->getPrev())
{
TR::Instruction *appendInstruction;

// remove from prrevious location
if (firstInstruction->getPrev())
firstInstruction->getPrev()->setNext(lastInstruction->getNext());
// remove from previous location
if (firstOLInstruction->getPrev())
firstOLInstruction->getPrev()->setNext(lastOLInstruction->getNext());

if (lastInstruction->getNext())
lastInstruction->getNext()->setPrev(firstInstruction->getPrev());
if (lastOLInstruction->getNext())
lastOLInstruction->getNext()->setPrev(firstOLInstruction->getPrev());

// update codegen append instruction
if (lastInstruction == self()->getAppendInstruction())
self()->setAppendInstruction(firstInstruction->getPrev());
if (lastOLInstruction == self()->getAppendInstruction())
self()->setAppendInstruction(firstOLInstruction->getPrev());

// insert after last warm instruction
appendInstruction = self()->getLastWarmInstruction();
appendInstruction->setLastWarmInstruction(false);
lastInstruction->setLastWarmInstruction(true);
self()->setLastWarmInstruction(lastInstruction);
TR::Instruction *mainlineAppendInstruction = self()->getLastWarmInstruction();
mainlineAppendInstruction->setLastWarmInstruction(false);
lastOLInstruction->setLastWarmInstruction(true);
self()->setLastWarmInstruction(lastOLInstruction);

TR::Instruction *followInstruction = appendInstruction->getNext();
TR::Instruction *mainlineFollowInstruction = mainlineAppendInstruction->getNext();

appendInstruction->setNext(firstInstruction);
firstInstruction->setPrev(appendInstruction);
mainlineAppendInstruction->setNext(firstOLInstruction);
firstOLInstruction->setPrev(mainlineAppendInstruction);

lastInstruction->setNext(followInstruction);
lastOLInstruction->setNext(mainlineFollowInstruction);

if (followInstruction)
followInstruction->setPrev(lastInstruction);
if (mainlineFollowInstruction)
mainlineFollowInstruction->setPrev(lastOLInstruction);
}

++oiIterator;
Expand Down
2 changes: 1 addition & 1 deletion compiler/x/codegen/OMRCodeGenerator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ class OMR_EXTENSIBLE CodeGenerator : public OMR::CodeGenerator
* \brief move out-of-line instructions from cold code to warm
*
*/
void moveOutOfLineInstructionsToWarm();
void moveOutOfLineInstructionsToWarmCode();

uint32_t getOutOfLineCodeSize();

Expand Down

0 comments on commit f93c09f

Please sign in to comment.