Skip to content

Commit

Permalink
Fix x iselectEvaluator to ensure correct gc flags are set on result r…
Browse files Browse the repository at this point in the history
…egister

- Use `TR::Register::containsCollectedReference()` instead of
  `TR::Node::isNotCollected()` to check if the false register contains a
  collected reference. `isNotCollected` should not be used after lower trees as
  it does not handle nodes that convert between integral and address types.

- 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 1a59d02 commit c0843bb
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion compiler/x/codegen/ControlFlowEvaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1300,8 +1300,24 @@ TR::Register *OMR::X86::TreeEvaluator::iselectEvaluator(TR::Node *node, TR::Code
TR::Register *falseReg = cg->evaluate(falseVal);
bool trueValIs64Bit = TR::TreeEvaluator::getNodeIs64Bit(trueVal, cg);
TR::Register *trueReg = TR::TreeEvaluator::intOrLongClobberEvaluate(trueVal, trueValIs64Bit, cg);
if (!node->isNotCollected())

// 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();
}

// don't need to test if we're already using a compare eq or compare ne
auto conditionOp = condition->getOpCode();
Expand Down

0 comments on commit c0843bb

Please sign in to comment.