Skip to content

Conversation

Arraying
Copy link
Member

@Arraying Arraying commented Sep 12, 2025

Hi all,

This PR refactors the mark word to use the order of bits as specified in JEP 450.

Specifically, there are three portions to this change:

  • Moving the age bits lower to their intended position.
  • Fixing a miscompilation in the native hashCode intrinsic that got unearthed as a result.
  • Updating the documentation to be more inline with the mainline docs and minimal Valhalla additions.

Feedback is welcome, especially for the doc changes. If there are any ideas of other places in which similar miscompilations could occur, that would be valuable to know as well.


Progress

  • Change must not contain extraneous whitespace

Issue

  • JDK-8367073: [lworld] Conform to JEP 450 encoding of mark word (Enhancement - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 1578

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/valhalla/pull/1578.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Sep 12, 2025

👋 Welcome back phubner! A progress list of the required criteria for merging this PR into lworld 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 Sep 12, 2025

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

8367073: [lworld] Conform to JEP 450 encoding of mark word

Reviewed-by: coleenp, fparain, thartmann

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 1 new commit pushed to the lworld branch:

  • 2bc50b3: 8367767: [lworld] Interpreter adherence to new memory model rules for strict instance fields

Please see this link for an up-to-date comparison between the source branch of this pull request and the lworld 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 (@coleenp, @fparain, @TobiHartmann) 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 openjdk bot changed the title JDK-8367073 8367073: [lworld] Conform to JEP 450 encoding of mark word Sep 12, 2025
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 good!

@Arraying Arraying marked this pull request as ready for review October 1, 2025 13:08
@openjdk openjdk bot added ready Pull request is ready to be integrated rfr Pull request is ready for review labels Oct 1, 2025
@mlbridge
Copy link

mlbridge bot commented Oct 1, 2025

Webrevs

@Arraying
Copy link
Member Author

Arraying commented Oct 1, 2025

I'm going to go merge in the latest changes and re-run testing. I'll update the PR description with the testing result summary when done.

}

private:
inline uintptr_t write_bits(uintptr_t input, uintptr_t val, uint start, uint end) const {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Where is this method used?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch, it's left over from a prototype. Sorry about that, will remove.

Copy link
Collaborator

@fparain fparain left a comment

Choose a reason for hiding this comment

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

With the removal of the unused method, this looks good to me.

Copy link
Member

@TobiHartmann TobiHartmann 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 to me. Good job investigating and fixing this!

Node *lock_mask = _gvn.MakeConX(markWord::inline_type_mask_in_place);
// We cannot use the inline type mask as this may check bits that are overriden
// by an object monitor's pointer when inflating locking.
Node *lock_mask = _gvn.MakeConX(markWord::lock_mask_in_place);
Copy link
Member

Choose a reason for hiding this comment

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

FTR, this merge commit broke it: 0e3418d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready Pull request is ready to be integrated rfr Pull request is ready for review
Development

Successfully merging this pull request may close these issues.

4 participants