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

Only devirtualize call for compatible classes #3242

Merged
merged 1 commit into from
Nov 27, 2018

Conversation

cathyzhyi
Copy link
Contributor

Change InvariantArgumentPreexistence to only devirtualize method if the
propagated arg info with known object index is compatible with the
method class of the callsite.

Signed-off-by: Yi Zhang yizhang@ca.ibm.com

Change InvariantArgumentPreexistence to only devirtualize method if the
propagated arg info with known object index is compatible with the
method class of the callsite.

Signed-off-by: Yi Zhang <yizhang@ca.ibm.com>
@Leonardo2718
Copy link
Contributor

@genie-omr build all

@vijaysun-omr
Copy link
Contributor

@andrewcraik please review this.

//
if (methodSymbol->isVirtual())
devirtualize = true;
if (methodSymbol->isVirtual() && fixedOrFinalInfoExists)
Copy link
Contributor

Choose a reason for hiding this comment

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

Since we moved this logic down from where it was, one difference seems to be the check here that is methodSymbol->isVirtual() as opposed to the original check that was !isInterface. Are these two essentially equivalent at this point in the code ? i.e. we would not be changing the logic for those cases that were entering this code after checking !isInterface originally ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think they are equivalent, originally the logic was guarded by both methodSymbol->isVirtual() || methodSymbol->isInterface() and if (!isInterface && fixedOrFinalInfoExists) , the !isInterface could have been replaced by methodSymbol->isVirtual().

Copy link
Contributor

Choose a reason for hiding this comment

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

So we can only devirtualize virtual methods in general in the context where this code is running - interfaces are not strict enough to allow for devirtualization. I agree the conversion looks equivalent. I think the change looks good.

Copy link
Contributor

Choose a reason for hiding this comment

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

Okay thanks for the explanation.

@vijaysun-omr
Copy link
Contributor

Looks safe to me and tests have passed. Merging.

@vijaysun-omr vijaysun-omr merged commit bb66fe7 into eclipse:master Nov 27, 2018
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.

4 participants