Skip to content

Commit

Permalink
AArch64: Add relocation record for second child of ifacmpeq/ifacmpne
Browse files Browse the repository at this point in the history
A relocation record for class or method pointer in the second child of
`ifacmpeq`/`ifampne` is missing if the constant value of it can be
encoded into 12bit immediate field.
This commit adds a relocation record for it by evaluating the node
if it needs relocation.

Signed-off-by: Akira Saitoh <saiaki@jp.ibm.com>
  • Loading branch information
Akira Saitoh committed Aug 25, 2021
1 parent ab70342 commit 347c244
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions compiler/aarch64/codegen/ControlFlowEvaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,11 @@ static TR::Instruction *ificmpHelper(TR::Node *node, TR::ARM64ConditionCode cc,
TR::LabelSymbol *dstLabel;
TR::Instruction *result;
TR::RegisterDependencyConditions *deps;
bool secondChildNeedsRelocation = cg->profiledPointersRequireRelocation() && (secondChild->getOpCodeValue() == TR::aconst) &&
(secondChild->isClassPointerConstant() || secondChild->isMethodPointerConstant());

#ifdef J9_PROJECT_SPECIFIC
if (cg->profiledPointersRequireRelocation() && secondChild->getOpCodeValue() == TR::aconst &&
(secondChild->isClassPointerConstant() || secondChild->isMethodPointerConstant()))
if (secondChildNeedsRelocation)
{
if (node->isProfiledGuard())
{
Expand Down Expand Up @@ -176,7 +177,7 @@ if (cg->profiledPointersRequireRelocation() && secondChild->getOpCodeValue() ==
}
}

if (secondChild->getOpCode().isLoadConst() && secondChild->getRegister() == NULL)
if ((!secondChildNeedsRelocation) && secondChild->getOpCode().isLoadConst() && secondChild->getRegister() == NULL)
{
int64_t value = is64bit ? secondChild->getLongInt() : secondChild->getInt();
if (constantIsUnsignedImm12(value) || constantIsUnsignedImm12(-value) ||
Expand Down Expand Up @@ -371,8 +372,10 @@ static TR::Register *icmpHelper(TR::Node *node, TR::ARM64ConditionCode cc, bool
TR::Node *secondChild = node->getSecondChild();
TR::Register *src1Reg = cg->evaluate(firstChild);
bool useRegCompare = true;
bool secondChildNeedsRelocation = cg->profiledPointersRequireRelocation() && (secondChild->getOpCodeValue() == TR::aconst) &&
(secondChild->isClassPointerConstant() || secondChild->isMethodPointerConstant());

if (secondChild->getOpCode().isLoadConst() && secondChild->getRegister() == NULL)
if ((!secondChildNeedsRelocation) && secondChild->getOpCode().isLoadConst() && secondChild->getRegister() == NULL)
{
int64_t value = is64bit ? secondChild->getLongInt() : secondChild->getInt();
if (constantIsUnsignedImm12(value) || constantIsUnsignedImm12(-value) ||
Expand Down

0 comments on commit 347c244

Please sign in to comment.