Skip to content

8365262: [IR-Framework] Add simple way to add cross-product of flags #26762

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 15 commits into
base: master
Choose a base branch
from

Conversation

mhaessig
Copy link
Contributor

@mhaessig mhaessig commented Aug 13, 2025

This PR adds the TestFramework::addCrossProductScenarios method to enable more ergonomic testing of the combination of all flag combinations. To illustrate its use, I also converted one test to use the new cross product functionality.

Testing:

  • Github Actions
  • tier1,tier2 plus some internal testing on Oracle supported platforms

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-8365262: [IR-Framework] Add simple way to add cross-product of flags (Enhancement - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 26762

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Aug 13, 2025

👋 Welcome back mhaessig! 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 Aug 13, 2025

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk
Copy link

openjdk bot commented Aug 13, 2025

@mhaessig 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 hotspot-compiler [email protected] rfr Pull request is ready for review labels Aug 13, 2025
@mlbridge
Copy link

mlbridge bot commented Aug 13, 2025

Copy link
Contributor

@galderz galderz left a comment

Choose a reason for hiding this comment

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

Thanks @mhaessig. Nice API improvement! I'm a bit unsure about the way it's tested though.

"-XX:TLABRefillWasteFraction=53",
"-XX:TLABRefillWasteFraction=64"));
t1.start();
Asserts.fail("Should have thrown exception");
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmmm, why do the tests fail? I'm wondering if a simpler way to test the functionality is possible that doesn't require having to figure out failure modes? Maybe some kind of positive test that counts number of test scenarios run?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Except in the first run, all scenarios fail. That is the only way we currently have to count the scenarios we are executing.

Copy link
Contributor

@benoitmaillard benoitmaillard 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, I only have one minor suggestion.

Co-authored-by: Benoît Maillard <[email protected]>
@mhaessig
Copy link
Contributor Author

Thank you for looking at this @eme64. I made the testing a bit more robust and added a case for a pair of arguments.

@openjdk
Copy link

openjdk bot commented Aug 20, 2025

⚠️ @mhaessig This pull request contains merges that bring in commits not present in the target repository. Since this is not a "merge style" pull request, these changes will be squashed when this pull request in integrated. If this is your intention, then please ignore this message. If you want to preserve the commit structure, you must change the title of this pull request to Merge <project>:<branch> where <project> is the name of another project in the OpenJDK organization (for example Merge jdk:master).

@mhaessig mhaessig marked this pull request as draft August 21, 2025 08:59
@openjdk openjdk bot removed the rfr Pull request is ready for review label Aug 21, 2025
@mhaessig
Copy link
Contributor Author

@eme64, I completely revamped counting of failures to regex matching and made multiple and no flags in one string work.

@mhaessig mhaessig marked this pull request as ready for review August 21, 2025 16:27
@openjdk openjdk bot added the rfr Pull request is ready for review label Aug 21, 2025
@mhaessig mhaessig requested a review from eme64 August 21, 2025 16:35
Copy link
Contributor

@eme64 eme64 left a comment

Choose a reason for hiding this comment

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

Looks much better already! I now took a closer look at the implementation :)

@mhaessig
Copy link
Contributor Author

Thank you for your detailed review, @eme64. I addressed all of your comments.

Comment on lines 376 to 387
Stream<List<String>> crossProduct = Arrays.stream(flagSets)
.reduce(
Stream.of(Collections.<String>emptyList()),
(acc, set) ->
acc.flatMap(list ->
set.stream().map(element -> {
List<String> newList = new ArrayList<>(list);
newList.add(element);
return newList;
})
),
(a, b) -> Stream.concat(a, b));
Copy link
Contributor

Choose a reason for hiding this comment

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

Wow, that's dense. Maybe a little comment could help here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It ended up being a lottle comment, but I think it does the job.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot-compiler [email protected] rfr Pull request is ready for review
Development

Successfully merging this pull request may close these issues.

4 participants