Skip to content

Conversation

@coleenp
Copy link
Contributor

@coleenp coleenp commented Oct 23, 2025

I took out EnableValhalla as a conditional test in the ObjectSynchronizer code. If the inline type bit is set in the markWord or the klass is InlineKlass, we can't synchronize on the object.
I added a test but it was sort of a duplicate of all runtime/valhalla/inlinetypes/MonitorEnterTest.java and duplicates all tests that do locking so I didn't add a test.
Testing with tier1-4, still in progress.


Progress

  • Change must not contain extraneous whitespace

Issue

  • JDK-8370509: [lworld] EnableValhalla is not needed for sync (Enhancement - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 1699

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Oct 23, 2025

👋 Welcome back coleenp! 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 Oct 23, 2025

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

8370509: [lworld] EnableValhalla is not needed for sync

Reviewed-by: phubner, fparain

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 204 new commits pushed to 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.

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

@openjdk openjdk bot added ready Pull request is ready to be integrated rfr Pull request is ready for review labels Oct 23, 2025
@mlbridge
Copy link

mlbridge bot commented Oct 23, 2025

Webrevs

andr(mark, mark, ~((int) markWord::inline_type_bit_in_place));
}
// Mask inline_type bit such that we go to the slow path if object is an inline type
andr(mark, mark, ~((int) markWord::inline_type_bit_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.

Since EnableValhalla=true by default, we were already exercising this path by default.

Can we get into a situation where we do not use the object monitor table and the markword is inflated while we perform this check? We would get in trouble with this bit check if we can.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The code fetches the markWord, and tests for monitor value where an ObjectMonitor* may be installed. It doesn't refetch the markWord from the object so that if a concurrent thread changes it, it'll always go slow path already. Both platforms test the bit on a copy of the markWord after it's been fetched from the object and then checked for monitor_value.
I've sort of always wondered why it's not checked at DiagnoseSyncOnValueBasedClasses but that has a load_klass which is more instructions. This code can check the bit in the markWord instead.

ShouldNotReachHere();
}
// VM should be calling bootstrap method
assert(!obj->klass()->is_inline_klass(), "should not reach here");
Copy link
Member

Choose a reason for hiding this comment

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

Nitpick: more descriptive message.

@coleenp
Copy link
Contributor Author

coleenp commented Oct 27, 2025

Thanks Paul and Fred for reviewing.
/integrate

@openjdk
Copy link

openjdk bot commented Oct 27, 2025

Going to push as commit ba1a305.
Since your change was applied there have been 321 commits pushed to the lworld branch:

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Oct 27, 2025

@coleenp Pushed as commit ba1a305.

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

@coleenp coleenp deleted the sync branch October 27, 2025 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

3 participants