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

8266017: Refactor the *klass::array_klass_impl code to separate the non-exception-throwing API #3711

Closed
wants to merge 4 commits into from

Conversation

dholmes-ora
Copy link
Member

@dholmes-ora dholmes-ora commented Apr 27, 2021

We currently have array_klass() and array_klass_or_null(), where the former can throw exceptions and the latter can not. But they both delegate to:

array_klass_impl(bool or_null, TRAPS)

which combines both the exception-throwing and non-exception-throwing code into one method declared with TRAPS. To make progress with the change of TRAPS to JavaThread (JDK-8252685) we need to separate these code paths into distinct methods.

Testing: tiers 1-3 (in progress)

Thanks,
David


Progress

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

Issue

  • JDK-8266017: Refactor the *klass::array_klass_impl code to separate the non-exception-throwing API

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 3711

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

Using diff file

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

@dholmes-ora dholmes-ora marked this pull request as ready for review April 27, 2021 04:50
@bridgekeeper
Copy link

bridgekeeper bot commented Apr 27, 2021

👋 Welcome back dholmes! 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 rfr Pull request is ready for review label Apr 27, 2021
@openjdk
Copy link

openjdk bot commented Apr 27, 2021

@dholmes-ora The following label will be automatically applied to this pull request:

  • hotspot

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

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

mlbridge bot commented Apr 27, 2021

Webrevs

@dholmes-ora
Copy link
Member Author

/label remove hotspot

@openjdk openjdk bot removed the hotspot hotspot-dev@openjdk.org label Apr 27, 2021
@openjdk
Copy link

openjdk bot commented Apr 27, 2021

@dholmes-ora
The hotspot label was successfully removed.

@dholmes-ora
Copy link
Member Author

/label add hotspot-runtime

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

openjdk bot commented Apr 27, 2021

@dholmes-ora
The hotspot-runtime label was successfully added.

@mlbridge
Copy link

mlbridge bot commented Apr 27, 2021

Mailing list message from David Holmes on hotspot-runtime-dev:

Forwarded from hotspot-dev (I didn't see the mailing list selection in
time).

David
-------------- next part --------------
An embedded message was scrubbed...
From: David Holmes <dholmes at openjdk.java.net>
Subject: RFR: 8266017: Refactor the *klass::array_klass_impl code to separate the non-exception-throwing API
Date: Tue, 27 Apr 2021 05:01:11 GMT
Size: 13398
URL: <https://mail.openjdk.java.net/pipermail/hotspot-runtime-dev/attachments/20210427/3bf4bbc0/array_klass_implcodetoseparatethenon-exception-throwingAPI.eml>

1 similar comment
@mlbridge
Copy link

mlbridge bot commented Apr 27, 2021

Mailing list message from David Holmes on hotspot-runtime-dev:

Forwarded from hotspot-dev (I didn't see the mailing list selection in
time).

David
-------------- next part --------------
An embedded message was scrubbed...
From: David Holmes <dholmes at openjdk.java.net>
Subject: RFR: 8266017: Refactor the *klass::array_klass_impl code to separate the non-exception-throwing API
Date: Tue, 27 Apr 2021 05:01:11 GMT
Size: 13398
URL: <https://mail.openjdk.java.net/pipermail/hotspot-runtime-dev/attachments/20210427/3bf4bbc0/array_klass_implcodetoseparatethenon-exception-throwingAPI.eml>

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 nice cleanup. I wish we'd done this years ago!

src/hotspot/share/oops/klass.hpp Outdated Show resolved Hide resolved
@openjdk
Copy link

openjdk bot commented Apr 27, 2021

@dholmes-ora 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:

8266017: Refactor the *klass::array_klass_impl code to separate the non-exception-throwing API

Reviewed-by: coleenp, iklam

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 no new commits pushed to the master branch. If another commit should be pushed before you perform the /integrate command, your PR will be automatically rebased. If you prefer to avoid any potential 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 27, 2021
@mlbridge
Copy link

mlbridge bot commented Apr 27, 2021

Mailing list message from David Holmes on hotspot-runtime-dev:

On 28/04/2021 6:50 am, Ioi Lam wrote:

On Tue, 27 Apr 2021 12:46:56 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

We currently have array_klass() and array_klass_or_null(), where the former can throw exceptions and the latter can not. But they both delegate to:

array_klass_impl(bool or_null, TRAPS)

which combines both the exception-throwing and non-exception-throwing code into one method declared with TRAPS. To make progress with the change of TRAPS to JavaThread (JDK-8252685) we need to separate these code paths into distinct methods.

Testing: tiers 1-3 (in progress)

Thanks,
David

src/hotspot/share/oops/klass.hpp line 525:

523: virtual Klass* array_klass_impl(TRAPS);
524: virtual Klass* array_klass_or_null_impl(int rank);
525: virtual Klass* array_klass_or_null_impl();

I think you should make these pure virtual functions (=0) and remove the bodies in klass.cpp.

I think now we can get rid of the `array_klass_or_null_impl()` function altogether. Instead, `array_klass_or_null` should be declared as `virtual ... = 0` in `Klass` and implemented by the concrete subclasses.

Yes I think you are right - no need to inherit the top-level delegating
functions and override the impl functions, when we can just override the
top-level functions and delete all the impl functions. I'll give that a
whirl.

Thanks for looking at this Ioi and Coleen!

David

…ride those methods

directly, getting rid of the impl versions,
@openjdk
Copy link

openjdk bot commented Apr 27, 2021

@dholmes-ora this pull request can not be integrated into master due to one or more merge conflicts. To resolve these merge conflicts and update this pull request you can run the following commands in the local repository for your personal fork:

git checkout 8266017
git fetch https://git.openjdk.java.net/jdk master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push

@openjdk openjdk bot added merge-conflict Pull request has merge conflict with target branch and removed ready Pull request is ready to be integrated labels Apr 27, 2021
@openjdk openjdk bot added ready Pull request is ready to be integrated and removed merge-conflict Pull request has merge conflict with target branch labels Apr 27, 2021
Copy link
Member

@iklam iklam left a comment

Choose a reason for hiding this comment

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

LGTM. Just a small nit about comments.

src/hotspot/share/oops/instanceKlass.cpp Outdated Show resolved Hide resolved
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.

Looks great.

Copy link
Member

@iklam iklam left a comment

Choose a reason for hiding this comment

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

Latest version looks good.

@dholmes-ora
Copy link
Member Author

/integrate

@openjdk openjdk bot closed this Apr 28, 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 28, 2021
@openjdk
Copy link

openjdk bot commented Apr 28, 2021

@dholmes-ora Since your change was applied there have been 39 commits pushed to the master branch:

  • f75dd80: 8266230: mark hotspot compiler/c2 tests which ignore VM flags
  • 9df6cc7: 8264678: Incomplete comment in build.tools.generatecharacter.GenerateCharacter
  • 73cfc26: 8266232: compiler.c1.TestRangeCheckEliminated should be run in driver mode
  • 3e1b90a: 8266157: Problem list several awt jtreg tests that fail on macOS 11
  • 3f9879f: 8266190: mark hotspot compiler/codecache tests which ignore VM flags
  • d12e01a: 8264472: Add a test group for running CDS tests with -XX:+VerifySharedSpaces
  • b3b2bb2: 8265773: incorrect jdeps message "jdk8internals" to describe a removed JDK internal API
  • 2780577: 8196415: Disable SHA-1 Signed JARs
  • 21f65f8: 8266206: Build failure after JDK-8264752 with older GCCs
  • c71c268: 8266165: TestNoWarningLoopStripMiningIterSet is runnable only on VM w/ G1, Shenandoah, Z and Epsilon
  • ... and 29 more: https://git.openjdk.java.net/jdk/compare/7f4a9f68bfd6fd002f79ac989155550db0bcdd20...master

Your commit was automatically rebased without conflicts.

Pushed as commit 23180f8.

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

@dholmes-ora dholmes-ora deleted the 8266017 branch April 28, 2021 21:00
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
3 participants