Skip to content

Commit

Permalink
Use testIsClassArrayType to generate IL to test for array type
Browse files Browse the repository at this point in the history
The downstream OpenJ9 project defines a new method,
TR_VMBase::testIsClassArrayType, that generates IL to tests whether a
class is an array class.  Change code that generated IL that loaded
classDepthAndFlags field itself to call testIsClassArrayType instead to
hide at least some of the J9-specific details.
  • Loading branch information
hzongaro committed May 8, 2024
1 parent 4ae6ba4 commit 5f83203
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions compiler/optimizer/LoopVersioner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8340,19 +8340,9 @@ bool TR_LoopVersioner::depsForLoopEntryPrep(

TR::Node *vftLoad = TR::Node::createWithSymRef(TR::aloadi, 1, 1, node->getFirstChild(), comp()->getSymRefTab()->findOrCreateVftSymbolRef());
//TR::Node *componentTypeLoad = TR::Node::create(TR::aloadi, 1, vftLoad, comp()->getSymRefTab()->findOrCreateArrayComponentTypeSymbolRef());
TR::Node *classFlag = NULL;
if (comp()->target().is32Bit())
{
classFlag = TR::Node::createWithSymRef(TR::iloadi, 1, 1, vftLoad, comp()->getSymRefTab()->findOrCreateClassAndDepthFlagsSymbolRef());
}
else
{
classFlag = TR::Node::createWithSymRef(TR::lloadi, 1, 1, vftLoad, comp()->getSymRefTab()->findOrCreateClassAndDepthFlagsSymbolRef());
classFlag = TR::Node::create(TR::l2i, 1, classFlag);
}
TR::Node *andConstNode = TR::Node::create(classFlag, TR::iconst, 0, TR::Compiler->cls.flagValueForArrayCheck(comp()));
TR::Node * andNode = TR::Node::create(TR::iand, 2, classFlag, andConstNode);
TR::Node *cmp = TR::Node::createif(TR::ificmpne, andNode, andConstNode, _exitGotoTarget);
TR::Node *classFlag = comp()->fej9()->testIsClassArrayType(vftLoad);
TR::Node *flagConstNode = TR::Node::create(classFlag, TR::iconst, 0, TR::Compiler->cls.flagValueForArrayCheck(comp()));
TR::Node *cmp = TR::Node::createif(TR::ificmpne, classFlag, flagConstNode, _exitGotoTarget);
if (addLoopEntryPrepDep(LoopEntryPrep::TEST, cmp, deps, visited) == NULL)
{
dumpOptDetailsFailedToCreateTest("array type", node->getFirstChild());
Expand Down

0 comments on commit 5f83203

Please sign in to comment.