Skip to content

Commit

Permalink
Fix for missing NULLCHK in Unsafe atomics
Browse files Browse the repository at this point in the history
NULLCHK on receiver is missing when transforming Unsafe.getAndAdd/Set.
Fixing it.

Signed-off-by: Victor Ding <[email protected]>
  • Loading branch information
Victor Ding committed Sep 26, 2018
1 parent cf45f6e commit 6d025e4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions runtime/compiler/optimizer/J9RecognizedCallTransformer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,15 @@ void J9::RecognizedCallTransformer::process_java_lang_StringUTF16_toBytes(TR::Tr
void J9::RecognizedCallTransformer::processUnsafeAtomicCall(TR::TreeTop* treetop, TR::Node* node, TR::SymbolReferenceTable::CommonNonhelperSymbol helper)
{
node->setSymbolReference(comp()->getSymRefTab()->findOrCreateCodeGenInlinedHelper(helper));
if (treetop->getNode()->getOpCodeValue() == TR::NULLCHK)
{
auto nullchk = comp()->getSymRefTab()->findOrCreateNullCheckSymbolRef(comp()->getMethodSymbol());
treetop->insertBefore(TR::TreeTop::create(comp(), TR::Node::createWithSymRef(TR::NULLCHK, 1, 1, TR::Node::create(node, TR::PassThrough, 1, node->getChild(0)), nullchk)));
treetop->getNode()->setSymbolReference(NULL);
TR::Node::recreate(treetop->getNode(), TR::treetop);
}
node->removeChild(0);

bool safeToSkipDiamond = !strncmp(comp()->getCurrentMethod()->classNameChars(), "java/util/concurrent/atomic/", strlen("java/util/concurrent/atomic/"));

TR_Array<TR::Node*> params(trMemory(), node->getNumChildren()-2);
Expand Down

0 comments on commit 6d025e4

Please sign in to comment.