Skip to content

Commit

Permalink
Prevent LoopVersioner from attempting to privatize BCD type nodes
Browse files Browse the repository at this point in the history
A crash would occur in decReferenceCount() after privatizing a pdLoadi
because the Z evaluator was not expecting a pdLoad Opcode. This fix
will disable privatizing all BCD type nodes.

Signed-off-by: Kevin Langman <langman@ca.ibm.com>
  • Loading branch information
klangman committed May 13, 2021
1 parent 092787c commit 4c68263
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions compiler/optimizer/LoopVersioner.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2020 IBM Corp. and others
* Copyright (c) 2000, 2021 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -2449,12 +2449,22 @@ bool opCodeIsHoistable(TR::Node *node, TR::Compilation *comp)
bool TR_LoopVersioner::isExprInvariant(TR::Node *node, bool ignoreHeapificationStore)
{
_visitedNodes.empty();
return isExprInvariantRecursive(node, ignoreHeapificationStore);
}
return isExprInvariantRecursive(node, ignoreHeapificationStore);
}

bool TR_LoopVersioner::isExprInvariantRecursive(TR::Node *node, bool ignoreHeapificationStore)
bool TR_LoopVersioner::isExprInvariantRecursive(TR::Node *node, bool ignoreHeapificationStore)
{
static const bool paranoid = feGetEnv("TR_paranoidVersioning") != NULL;

// Do not attempt to privatize BCD type nodes because doing so can result in creating direct loads of BCD types which are currently
// not handled correctly within Java. BCDCHK IL will attempt to recreate a call to the original Java API for the corresponding BCD
// IL and it needs to be able to materialize the node representing the original byte array object. This is not possible if the byte
// array is stored on the stack.
#ifdef J9_PROJECT_SPECIFIC
if (node->getType().isBCD())
return false;
#endif

if (paranoid && requiresPrivatization(node))
return false;

Expand Down

0 comments on commit 4c68263

Please sign in to comment.