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

8264731: Introduce InstanceKlass::method_at_itable_or_null() #3344

Closed

Conversation

iwanowww
Copy link
Contributor

@iwanowww iwanowww commented Apr 5, 2021

Introduce InstanceKlass::method_at_itable_or_null() - a non-throwing variant of InstanceKlass::method_at_itable() that implements interface method selection.

As a cleanup, rewrite InstanceKlass::method_at_itable() on top of InstanceKlass::method_at_itable_or_null().

Testing:

  • hs-tier1 - hs-tier6

Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8264731: Introduce InstanceKlass::method_at_itable_or_null()

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/3344/head:pull/3344
$ git checkout pull/3344

Update a local copy of the PR:
$ git checkout pull/3344
$ git pull https://git.openjdk.java.net/jdk pull/3344/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 3344

View PR using the GUI difftool:
$ git pr show -t 3344

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/3344.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Apr 5, 2021

👋 Welcome back vlivanov! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the hotspot-runtime hotspot-runtime-dev@openjdk.org label Apr 5, 2021
@openjdk
Copy link

openjdk bot commented Apr 5, 2021

@iwanowww
The hotspot-runtime label was successfully added.

@iwanowww iwanowww changed the title Introduce InstanceKlass::method_at_itable_or_null() 8264731: Introduce InstanceKlass::method_at_itable_or_null() Apr 5, 2021
@iwanowww iwanowww marked this pull request as ready for review April 5, 2021 17:47
@openjdk openjdk bot added the rfr Pull request is ready for review label Apr 5, 2021
@mlbridge
Copy link

mlbridge bot commented Apr 5, 2021

Webrevs

Copy link
Contributor

@coleenp coleenp left a comment

Choose a reason for hiding this comment

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

This is a lot clearer than existing code. I don't see the caller other than mehod_at_itable() though.

}

Method* InstanceKlass::method_at_itable_or_null(InstanceKlass* holder, int index, bool& itable_entry_found) {
klassItable itable(this);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you need a ResourceMark before this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can you elaborate, please, why you think so?
I don't see anything in klassItable which may allocate in the resource arena.

Copy link
Contributor

Choose a reason for hiding this comment

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

oh, never mind. Somebody fixed this a long time ago.

@openjdk
Copy link

openjdk bot commented Apr 6, 2021

@iwanowww This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8264731: Introduce InstanceKlass::method_at_itable_or_null()

Reviewed-by: coleenp, dholmes

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 51 new commits pushed to the master branch:

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Apr 6, 2021
Copy link
Member

@dholmes-ora dholmes-ora left a comment

Choose a reason for hiding this comment

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

Hi Vladimir,

Seems okay in principle. I assume more callers of the new API are in the pipeline?

I have one suggested changed that would have made the code much much clearer to me.

Thanks,
David


for (int cnt = 0 ; ; cnt ++, ioe ++) {
Method* InstanceKlass::method_at_itable(InstanceKlass* holder, int index, TRAPS) {
bool itable_entry_found; // out parameter
Copy link
Member

Choose a reason for hiding this comment

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

I was very confused about the logic in this code until I realized that itable_entry_found is actually an indicator as to whether or not the current class implements the interface represented by holder, and not an indicator of whether or not a method was found. It would be much clearer to me if this variable were renamed something like implements_interface.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agree. Fixed.

@iwanowww
Copy link
Contributor Author

iwanowww commented Apr 6, 2021

I assume more callers of the new API are in the pipeline?

Yes, the plan is to use it in CHA (dependencies.cpp/hpp). I decided to integrate runtime-related code changes separately.

Copy link
Member

@dholmes-ora dholmes-ora left a comment

Choose a reason for hiding this comment

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

Update looks good - thanks - but I'd like to see it extend a little further.

Thanks,
David

}
}

Method* InstanceKlass::method_at_itable_or_null(InstanceKlass* holder, int index, bool& itable_entry_found) {
Copy link
Member

Choose a reason for hiding this comment

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

The change to use implements_interface applies in here too. Thanks.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, fixed.

@iwanowww
Copy link
Contributor Author

iwanowww commented Apr 7, 2021

Thanks for the reviews, Coleen and David.

@iwanowww
Copy link
Contributor Author

iwanowww commented Apr 7, 2021

/integrate

@openjdk openjdk bot closed this Apr 7, 2021
@openjdk openjdk bot added integrated Pull request has been integrated and removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Apr 7, 2021
@openjdk
Copy link

openjdk bot commented Apr 7, 2021

@iwanowww Since your change was applied there have been 51 commits pushed to the master branch:

Your commit was automatically rebased without conflicts.

Pushed as commit 6e2b82a.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot-runtime hotspot-runtime-dev@openjdk.org integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

3 participants