Skip to content

Commit

Permalink
For Unsafe.get()/put(), reorder blocks to optimize fallthrough path
Browse files Browse the repository at this point in the history
When offheap is enabled and the type of the object being operated on
is unknown, there are three possible cases that need to be accounted
for regarding the type of the object being operated on for
Unsafe.get()/put():

1.) array object
2.) java/lang/Class object
3.) none of the above

Since case (3) is the most likely, we want the block corresponding to
this case (directAccessBlock) to be on the fallthrough path.

Signed-off-by: midronij <[email protected]>
  • Loading branch information
midronij committed Jul 19, 2024
1 parent f7f295e commit 6510d00
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions runtime/compiler/optimizer/InlinerTempForJ9.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -998,7 +998,7 @@ TR_J9InlinerPolicy::genCodeForUnsafeGetPut(TR::Node* unsafeAddress,

if (typeTestsNeeded && arrayBlockNeeded) // CASE (1)
{
indirectAccessBlock = beforeCallBlock->getNextBlock();
directAccessBlock = beforeCallBlock->getNextBlock();

if (directAccessWithConversionTreeTop)
{
Expand Down Expand Up @@ -1036,7 +1036,7 @@ TR_J9InlinerPolicy::genCodeForUnsafeGetPut(TR::Node* unsafeAddress,
indirectAccessBlock->append(indirectAccessTreeTop);
indirectAccessBlock->append(
TR::TreeTop::create(comp(),
TR::Node::create(directAccessTreeTop->getNode(),
TR::Node::create(indirectAccessTreeTop->getNode(),
TR::Goto, 0, joinBlock->getEntry())));

arrayDirectAccessBlock->getExit()->insertTreeTopsAfterMe(indirectAccessBlock->getEntry(),
Expand Down

0 comments on commit 6510d00

Please sign in to comment.