Skip to content

Commit

Permalink
Add NoReg dependencies for Power two-reg form fixedSeqMemAccess
Browse files Browse the repository at this point in the history
This fix ensure no register spills occurring in the middle of
the fixedSeqMemAccess which will break JIT/AOT address patching
code as it assumes specific relative instructions addresses.

Issue: eclipse-openj9/openj9#11163

Signed-off-by: Abdulrahman Alattas <rmnattas@gmail.com>
  • Loading branch information
rmnattas committed Dec 1, 2020
1 parent f719080 commit f14cd51
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions compiler/p/codegen/OMRTreeEvaluator.cpp
Expand Up @@ -481,6 +481,18 @@ TR::Instruction *fixedSeqMemAccess(TR::CodeGenerator *cg, TR::Node *node, intptr
nibbles[idx] = cursor = generateMemSrc1Instruction(cg, opCode, node, memRef, srcOrTrg, cursor);
}

// When using tempReg ensure no register spills occur in the middle of the fixed sequence
if (tempReg)
{
TR::RegisterDependencyConditions *dep = new (cg->trHeapMemory()) TR::RegisterDependencyConditions(0, 3, cg->trMemory());
if (srcOrTrg != tempReg && srcOrTrg != baseReg)
dep->addPostCondition(srcOrTrg, TR::RealRegister::NoReg);
dep->addPostCondition(tempReg, TR::RealRegister::NoReg);
dep->addPostCondition(baseReg, TR::RealRegister::NoReg, UsesDependentRegister | ExcludeGPR0InAssigner);

cursor = generateDepLabelInstruction(cg, TR::InstOpCode::label, node, TR::LabelSymbol::create(cg->trHeapMemory(),cg), dep);
}

if (cursorCopy == NULL)
cg->setAppendInstruction(cursor);

Expand Down

0 comments on commit f14cd51

Please sign in to comment.