Skip to content

8358694: VM asserts if CodeCacheSegmentSize is not a power of 2 - #25708

Closed
offamitkumar wants to merge 10 commits into
openjdk:masterfrom
offamitkumar:codecache
Closed

offamitkumar wants to merge 10 commits into
openjdk:masterfrom
offamitkumar:codecache

Conversation

@offamitkumar

@offamitkumar offamitkumar commented Jun 10, 2025 •

Copy link
Copy Markdown
Member

Makes sure that JVM exits gracefully when CodeCacheSegmentSize is not a power of 2.


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-8358694: VM asserts if CodeCacheSegmentSize is not a power of 2 (Bug - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 25708

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper

bridgekeeper Bot commented Jun 10, 2025

Copy link
Copy Markdown

👋 Welcome back amitkumar! 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.

@offamitkumar
offamitkumar marked this pull request as ready for review June 10, 2025 04:47
@openjdk

openjdk Bot commented Jun 10, 2025 •

Copy link
Copy Markdown

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

8358694: VM asserts if CodeCacheSegmentSize is not a power of 2

Reviewed-by: shade, dfenacci

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 6 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 changed the title 8358694 8358694: VM asserts if CodeCacheSegmentSize is not a power of 2 Jun 10, 2025
@openjdk openjdk Bot added the rfr Pull request is ready for review label Jun 10, 2025
@openjdk

openjdk Bot commented Jun 10, 2025

Copy link
Copy Markdown

@offamitkumar The following label will be automatically applied to this pull request:

  • hotspot-compiler

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-compiler hotspot-compiler-dev@openjdk.org label Jun 10, 2025
@mlbridge

mlbridge Bot commented Jun 10, 2025 •

Copy link
Copy Markdown

@dafedafe dafedafe left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thanks for fixing this @offamitkumar!
I was wondering if we couldn't do this right at the start when we check the flag constraints, e.g. here:

JVMFlag::Error CodeCacheSegmentSizeConstraintFunc(uintx value, bool verbose) {

@shipilev shipilev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There is already CodeCacheSegmentSizeConstraintFunc that verifies the flag values. Move the check there?

@offamitkumar

Copy link
Copy Markdown
Member Author

Thanks for the suggestion. I have moved the changes to the constraints specific file (I didn't know that this file exists, So missed it).

Please have another look. @shipilev @dafedafe

Thanks.

@shipilev shipilev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks okay to me. Compiler folk should take a look as well.

@openjdk openjdk Bot added the ready Pull request is ready to be integrated label Jun 10, 2025
@offamitkumar
offamitkumar requested a review from dafedafe June 11, 2025 04:41
@dafedafe

dafedafe commented Jun 11, 2025 •

Copy link
Copy Markdown

Running Tier1-3+ tests...
The tests passed.

@dafedafe

Copy link
Copy Markdown

I might be a bit picky (sorry for that) but since the flag was triggering a crash I was wondering if we could have a small regression test to make sure the VM never crashes (possibly checking the error as well).

@openjdk openjdk Bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Jun 12, 2025
@openjdk openjdk Bot added the rfr Pull request is ready for review label Jun 12, 2025
@offamitkumar

Copy link
Copy Markdown
Member Author

@dafedafe can you have a look again ? I have added the testcase.

@dafedafe dafedafe left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thanks for adding the test @offamitkumar.


public class CodeCacheSegmentSizeTest {
public static void main(String[] args) throws Exception {
String codeCacheSegmentSize = (Platform.isS390x() ? "67" : "36"); // invalid value (not power of two)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I think we can check it with any platform (it is not a S390-only constraint). Maybe we could also do it twice, once with and once without a power-of-two size. What do you think?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Maybe we could also do it twice, once with and once without a power-of-two size. What do you think?

That was a great suggestion. updated;

@dafedafe dafedafe left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thanks for changing the test @offamitkumar.


OutputAnalyzer output = new OutputAnalyzer(pb.start());

output.shouldContain("openjdk version"); // typical first line

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The test fails here for me (the output has the string "java version", not "openjdk version").
Maybe instead of checking this string we could check that there is no error?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This was the string for me:

amit@a3560042:~/jdk$ ./build/linux-s390x-server-fastdebug/jdk/bin/java -XX:+UnlockExperimentalVMOptions -XX:CodeCacheSegmentSize=64 -version 
openjdk version "26-internal" 2026-03-17
OpenJDK Runtime Environment (fastdebug build 26-internal-adhoc.amit.jdk)
OpenJDK 64-Bit Server VM (fastdebug build 26-internal-adhoc.amit.jdk, mixed mode)
amit@a3560042:~/jdk$

But I will update it and check for error only.

@@ -0,0 +1,79 @@
/*
* Copyright (c) 2024 IBM Corporation. All rights reserved.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
* Copyright (c) 2024 IBM Corporation. All rights reserved.
* Copyright (c) 2025 IBM Corporation. All rights reserved.

@offamitkumar

Copy link
Copy Markdown
Member Author

@dafedafe do you have further requests :)

@dafedafe dafedafe left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Looks good to me. Thanks again @offamitkumar!

@offamitkumar

Copy link
Copy Markdown
Member Author

Thanks @dafedafe, @shipilev for the reviews.

/integrate

@openjdk

openjdk Bot commented Jun 18, 2025

Copy link
Copy Markdown

@offamitkumar This pull request has not yet been marked as ready for integration.

@offamitkumar

Copy link
Copy Markdown
Member Author

Oh, sorry, I mistook Damon as reviewer. My mistake.

@offamitkumar
offamitkumar requested a review from shipilev June 18, 2025 10:14

@shipilev shipilev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks okay.

@openjdk openjdk Bot added the ready Pull request is ready to be integrated label Jun 24, 2025
@offamitkumar

Copy link
Copy Markdown
Member Author

Thanks again for the reviews.

/integrate

@openjdk

openjdk Bot commented Jun 25, 2025

Copy link
Copy Markdown

Going to push as commit 263e32b.
Since your change was applied there have been 20 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 Jun 25, 2025
@openjdk openjdk Bot closed this Jun 25, 2025
@openjdk openjdk Bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Jun 25, 2025
@openjdk

openjdk Bot commented Jun 25, 2025

Copy link
Copy Markdown

@offamitkumar Pushed as commit 263e32b.

💡 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-compiler hotspot-compiler-dev@openjdk.org integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

3 participants