Skip to content

Commit

Permalink
Fix riscv iselectEvaluator to ensure correct gc flags are set on resu…
Browse files Browse the repository at this point in the history
…lt register

- Add code to flag the result register as a collected reference if the false
  register contains a collected reference.

- Add assert which will fail if one of the children of the select node is an
  internal pointer. Internal pointers cannot be handled since we cannot set the
  pinning array on the result register without knowing which side of the select
  will be taken.

Issue: eclipse-openj9/openj9#8397

Signed-off-by: Ryan Shukla <ryans@ibm.com>
  • Loading branch information
mayshukla committed Sep 2, 2020
1 parent f3c4501 commit da1333e
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions compiler/riscv/codegen/ControlFlowEvaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,23 @@ OMR::RV::TreeEvaluator::iselectEvaluator(TR::Node *node, TR::CodeGenerator *cg)
TR::Register *falseReg = cg->evaluate(falseNode);
TR::RealRegister *zero = cg->machine()->getRealRegister(TR::RealRegister::zero);

// Internal pointers cannot be handled since we cannot set the pinning array
// on the result register without knowing which side of the select will be
// taken.
TR_ASSERT_FATAL_WITH_NODE(
node,
!trueReg->containsInternalPointer() && !falseReg->containsInternalPointer(),
"Select nodes cannot have children that are internal pointers"
);
if (falseReg->containsCollectedReference())
{
if (cg->comp()->getOption(TR_TraceCG))
traceMsg(
cg->comp(),
"Setting containsCollectedReference on result of select node in register %s\n",
cg->getDebug()->getName(trueReg));
trueReg->setContainsCollectedReference();
}

TR::LabelSymbol *startLabel = generateLabelSymbol(cg);
TR::LabelSymbol *joinLabel = generateLabelSymbol(cg);
Expand Down

0 comments on commit da1333e

Please sign in to comment.