Skip to content

Conversation

@pecimuth
Copy link
Contributor

@pecimuth pecimuth commented May 24, 2025

This PR introduces a few minor JVMCI refactorings to make replay compilation possible in the Graal compiler.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8357689: Refactor JVMCI to enable replay compilation in Graal (Enhancement - P4)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/25433/head:pull/25433
$ git checkout pull/25433

Update a local copy of the PR:
$ git checkout pull/25433
$ git pull https://git.openjdk.org/jdk.git pull/25433/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 25433

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/25433.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented May 24, 2025

👋 Welcome back pecimuth! 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
Copy link

openjdk bot commented May 24, 2025

@pecimuth 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:

8357689: Refactor JVMCI to enable replay compilation in Graal

Reviewed-by: dnsimon

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 35 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.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@dougxc) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk
Copy link

openjdk bot commented May 24, 2025

@pecimuth The following labels will be automatically applied to this pull request:

  • graal
  • hotspot-compiler

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

@openjdk openjdk bot added graal graal-dev@openjdk.org hotspot-compiler hotspot-compiler-dev@openjdk.org labels May 24, 2025
*
* @return a copy of the slot kinds array
*/
public JavaKind[] getSlotKinds() {
Copy link
Member

Choose a reason for hiding this comment

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

Keep in mind that slotKinds is being converted to a List. In that context, can we return the list without making a copy? Or is the caller expected to be able to mutate the return value?

Copy link
Contributor Author

@pecimuth pecimuth Jul 7, 2025

Choose a reason for hiding this comment

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

Applied the changes provided by @mur47x111.

if (o == this) {
return true;
}
if (o instanceof VirtualObject) {
Copy link
Member

Choose a reason for hiding this comment

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

Rename l to that and use pattern instanceof:

Suggested change
if (o instanceof VirtualObject) {
if (o instanceof VirtualObject that) {

* @return a copy of the array containing the Java kinds of the values or {@code null} if the
* values have not been initialized.
*/
public JavaKind[] getSlotKinds() {
Copy link
Member

Choose a reason for hiding this comment

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

Same comments as for BytecodeFrame.getSlotKinds. This applies to all other non-primitive array return values added by this PR.

Copy link
Contributor Author

@pecimuth pecimuth Jul 7, 2025

Choose a reason for hiding this comment

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

I left Object[] as the return value of EncodedSpeculationReason#getReason since the array could contain null elements, preventing the use of an immutable list like everywhere else.

Edit: SharedSecrets.getJavaUtilCollectionAccess().listFromTrustedArrayNullsAllowed could work here.

/**
* Returns a copy of the array of {@link ResolvedJavaMethod} objects representing the methods
* whose bytecodes were used as input to the compilation. If the compilation did not record
* method dependencies, this method returns {@code null}. Otherwise, the first element of the
Copy link
Member

Choose a reason for hiding this comment

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

null -> empty list?

@pecimuth pecimuth marked this pull request as ready for review July 7, 2025 13:03
@openjdk openjdk bot added the rfr Pull request is ready for review label Jul 7, 2025
@mlbridge
Copy link

mlbridge bot commented Jul 7, 2025

Webrevs

@pecimuth pecimuth marked this pull request as draft July 7, 2025 13:25
@openjdk openjdk bot removed the rfr Pull request is ready for review label Jul 7, 2025
this.duringCall = duringCall;
this.values = values;
this.slotKinds = slotKinds;
this.slotKinds = listFromTrustedArray(slotKinds);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

ImmutableCollections#listFromTrustedArray asserts that the array class is Object[].class, but the type of slotKinds is JavaKind[] - so these refactorings do not work.

@pecimuth pecimuth marked this pull request as ready for review July 8, 2025 08:36
@pecimuth pecimuth requested a review from dougxc July 8, 2025 08:37
@openjdk openjdk bot added the rfr Pull request is ready for review label Jul 8, 2025
Copy link
Member

@dougxc dougxc 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.

@openjdk
Copy link

openjdk bot commented Jul 8, 2025

⚠️ @pecimuth the full name on your profile does not match the author name in this pull requests' HEAD commit. If this pull request gets integrated then the author name from this pull requests' HEAD commit will be used for the resulting commit. If you wish to push a new commit with a different author name, then please run the following commands in a local repository of your personal fork:

$ git checkout JDK-8357689
$ git commit --author='Preferred Full Name <you@example.com>' --allow-empty -m 'Update full name'
$ git push

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jul 8, 2025
@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Jul 8, 2025
Copy link
Member

@dougxc dougxc left a comment

Choose a reason for hiding this comment

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

Still good.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jul 8, 2025
@pecimuth
Copy link
Contributor Author

pecimuth commented Jul 9, 2025

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Jul 9, 2025
@openjdk
Copy link

openjdk bot commented Jul 9, 2025

@pecimuth
Your change (at version 1b845fa) is now ready to be sponsored by a Committer.

@dougxc
Copy link
Member

dougxc commented Jul 9, 2025

/sponsor

@openjdk
Copy link

openjdk bot commented Jul 9, 2025

Going to push as commit 963b83f.
Since your change was applied there have been 36 commits pushed to the master branch:

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Jul 9, 2025
@openjdk openjdk bot closed this Jul 9, 2025
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review sponsor Pull request is ready to be sponsored labels Jul 9, 2025
@openjdk
Copy link

openjdk bot commented Jul 9, 2025

@dougxc @pecimuth Pushed as commit 963b83f.

💡 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

graal graal-dev@openjdk.org hotspot-compiler hotspot-compiler-dev@openjdk.org integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

2 participants