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

(0.46) Move anchored instanceof to the correct position #19655

Conversation

a7ehuo
Copy link
Contributor

@a7ehuo a7ehuo commented Jun 7, 2024

This PR ports #19604 to 0.46


This commit includes the following two changes in ILGen:

If the class is unresolved, genInstanceof anchors instanceof under a treetop node. Then the anchored instanceof treetop appears after the callTree and it commons with
the instanceof node under the ZEROCHK in geninterface.

This causes a problem because expandUnresolvedClassInstanceof does not expect the treetop that has the anchored instanceof to have already been evaluated when it appears under ZEROCHK. The transformation in expandUnresolvedClassInstanceof will not function correctly.

Therefore, the anchored instanceof treetop needs to be moved up before ZEROCHK.

If the receiver of the instanceof is non-null, there is no need to transform the instanceof into two cases: the null case and the non-null cases in expandUnresolvedClassInstanceof.

Fixes: #18748

This commit includes the following two changes in ILGen:

1.
If the class is unresolved, `genInstanceof` anchors `instanceof`
under a `treetop` node. Then the anchored `instanceof` treetop
appears after the callTree and it commons with
the `instanceof` node under the `ZEROCHK` in `geninterface`.

This causes a problem because `expandUnresolvedClassInstanceof`
does not expect the treetop that has the anchored `instanceof`
to have already been evaluated when it appears under ZEROCHK.
The transformation in `expandUnresolvedClassInstanceof` will
not function correctly.

Therefore, the anchored `instanceof` treetop needs to be moved
up before ZEROCHK.

2.
If the receiver of the `instanceof` is non-null, there is no need
to transform the `instanceof` into two cases: the null case and
the non-null cases in `expandUnresolvedClassInstanceof`.

Fixes: eclipse-openj9#18748

Signed-off-by: Annabelle Huo <Annabelle.Huo@ibm.com>
@a7ehuo a7ehuo added the comp:jit label Jun 7, 2024
@a7ehuo a7ehuo requested a review from hzongaro June 7, 2024 14:55
@a7ehuo
Copy link
Contributor Author

a7ehuo commented Jun 7, 2024

@hzongaro May I ask you to review this change for 0.46? Thank you!

Copy link
Member

@hzongaro hzongaro left a comment

Choose a reason for hiding this comment

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

Looks good. Thanks!

@hzongaro hzongaro merged commit da980bf into eclipse-openj9:v0.46.0-release Jun 8, 2024
2 checks passed
@a7ehuo a7ehuo deleted the fix-ilgen-instanceof-3-release-46 branch October 28, 2024 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants