Skip to content

8380015: [lworld] runtime/valhalla/inlinetypes/field_layout/ValueRandomLayoutTest.java divides by zero during statistic printing#2223

Closed
Arraying wants to merge 1 commit intoopenjdk:lworldfrom
Arraying:JDK-8380015
Closed

8380015: [lworld] runtime/valhalla/inlinetypes/field_layout/ValueRandomLayoutTest.java divides by zero during statistic printing#2223
Arraying wants to merge 1 commit intoopenjdk:lworldfrom
Arraying:JDK-8380015

Conversation

@Arraying
Copy link
Copy Markdown
Member

@Arraying Arraying commented Mar 13, 2026

Hi all,

In some rare cases, no abstract value classes are generated. This causes the statistics printer to divide by zero.

This change makes it such that at least one abstract class is generated (this is to ensure sufficient coverage) rather than band-aid fixing the symptom. When halfway through generation, the generator will nudge the next class to be abstract if no abstract value classes have been generated thus far.

I also added a quality of life seed print at the beginning of execution.

Testing: tier 1, 100 invocations of the generator on Linux x64. The originally failing seed passes.


Progress

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

Issue

  • JDK-8380015: [lworld] runtime/valhalla/inlinetypes/field_layout/ValueRandomLayoutTest.java divides by zero during statistic printing (Bug - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 2223

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link
Copy Markdown

bridgekeeper bot commented Mar 13, 2026

👋 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
Copy Markdown

openjdk bot commented Mar 13, 2026

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

8380015: [lworld] runtime/valhalla/inlinetypes/field_layout/ValueRandomLayoutTest.java divides by zero during statistic printing

Reviewed-by: 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 137 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 changed the title 8380015 8380015: [lworld] runtime/valhalla/inlinetypes/field_layout/ValueRandomLayoutTest.java divides by zero during statistic printing Mar 13, 2026
@openjdk openjdk bot added the rfr Pull request is ready for review label Mar 13, 2026
@mlbridge
Copy link
Copy Markdown

mlbridge bot commented Mar 13, 2026

Webrevs

Comment on lines +81 to +82
String seedProperty = "CLASS_GENERATION_SEED";
String seedString = System.getProperty(seedProperty);
Copy link
Copy Markdown
Member

@xmas92 xmas92 Mar 13, 2026

Choose a reason for hiding this comment

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

We have jdk.test.lib.Utils which have a generalised concept for this.

Utils.getRandomInstance();

public static Random getRandomInstance() {
if (RANDOM_GENERATOR == null) {
synchronized (Utils.class) {
if (RANDOM_GENERATOR == null) {
RANDOM_GENERATOR = new Random(SEED);
} else {
return RANDOM_GENERATOR;
}
}
System.out.printf("For random generator using seed: %d%n", SEED);
System.out.printf("To re-run test with same seed value please add \"-D%s=%d\" to command line.%n", SEED_PROPERTY_NAME, SEED);
}
return RANDOM_GENERATOR;
}

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.

That would look nicer. Would you be okay with it being a follow-up RFE?

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.

Sure, was more a drive-by comment. I have not looked at the ValueClassGenerator at all.

Copy link
Copy Markdown
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.

LGTM

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Mar 20, 2026
@Arraying
Copy link
Copy Markdown
Member Author

Thanks for the reviews!
/integrate

@openjdk
Copy link
Copy Markdown

openjdk bot commented Mar 20, 2026

Going to push as commit 2d66adb.
Since your change was applied there have been 137 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 Mar 20, 2026
@openjdk openjdk bot closed this Mar 20, 2026
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Mar 20, 2026
@openjdk
Copy link
Copy Markdown

openjdk bot commented Mar 20, 2026

@Arraying Pushed as commit 2d66adb.

💡 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

integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

3 participants