Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider possibility of TR::newvalue operation in some optimizations #7031

Merged
merged 2 commits into from
Jun 19, 2023

Conversation

hzongaro
Copy link
Contributor

This pull request includes changes to consider the possibility that an object allocation is being performed by way of a TR::newvalue operation. One is in the context of LocalReordering, which already prevented reordering of other kinds of object allocations. The second is in the context of OMR::AutomaticSymbol::createLocalObject which is used in the process of stack allocating short-lived objects that do not need to be allocated on the heap, allowing downstream projects to stack allocate objects that were created by a TR::newvalue operation.

Prevent local reordering for newvalue operations as is already done for
other object allocation operations, such as new, newarray, etc.
A local (stack allocated) object might be created with a TR::newvalue
opcode in downstream projects.  Allow for that possibility in
the assertion that appears in OMR::AutomaticSymbol::createLocalObject.
@hzongaro hzongaro changed the title Consider possibility TR::newvalue in some optimizations Consider possibility of TR::newvalue operation in some optimizations Jun 14, 2023
@hzongaro
Copy link
Contributor Author

@vijaysun-omr, may I ask you to review this change?

@vijaysun-omr vijaysun-omr self-assigned this Jun 14, 2023
@@ -357,6 +357,7 @@ void TR_LocalReordering::moveStoresEarlierIfRhsAnchored(TR::Block *block, TR::Tr
!node->getOpCode().isTreeTop() &&
!node->getOpCode().isCall() &&
(node->getOpCodeValue() != TR::New) &&
(node->getOpCodeValue() != TR::newvalue) &&
Copy link
Contributor

@vijaysun-omr vijaysun-omr Jun 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this spot chosen in particular for some reason ? i.e. was the rest of the optimizer checked for places where new* opcodes are dealt with and only this one mattered for this change ? Maybe the point is that this ought to have been changed when newvalue was added along with N other places using new* opcodes that were changed properly and this commit is just fixing that bug.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a case that ought to have been checked for when prototype support for newvalue was originally added. In the process of prototyping support downstream in OpenJ9 for escape analysis for newvalue operations, I tracked down a test failure to the fact that local reordering was not checking for newvalue operations.

@vijaysun-omr
Copy link
Contributor

jenkins build all

@vijaysun-omr vijaysun-omr merged commit 6921ed4 into eclipse-omr:master Jun 19, 2023
@hzongaro hzongaro deleted the avoid-reordering-newvalue branch July 17, 2023 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants