-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8337876: [IR Framework] Add support for IR tests with @Stable #20477
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
Conversation
|
👋 Welcome back chagedorn! A progress list of the required criteria for merging this PR into |
|
@chhagedorn 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: 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 39 new commits pushed to the
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 |
|
@chhagedorn The following label will be automatically applied to this pull request:
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. |
Webrevs
|
shipilev
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks okay, I just think we don't need to mention @Stable.
| ### 2.5 IR Tests with `@Stable` annotation | ||
| To run tests with `@Stable` annotations, one need to add the test classes to the boot classpath. This can easily be achieved by calling `TestFramework.addTestClassesToBootClassPath()` on the test framework object: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think mentioning @Stable here is overly specific. This guidance applies to any code that expects to be run in privileged mode, whether it is @Stable, @Contended, @ReservedStackAccess, etc. I say it should be e.g. "2.5 IR Tests With Privileged Classes" or some such.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the quick review! You're right, that's too specific. I've pushed an update according to your suggestion.
|
|
||
| /** | ||
| * Add test classes to boot classpath. This adds all classes found on path {@link jdk.test.lib.Utils#TEST_CLASSES} | ||
| * to the boot classpath with "-Xbootclasspath/a". This is useful when trying to run tests with @Stable annotations. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, @Stable is overly specific here. This is "just" about the privileged code.
| cmds.add("-Xbootclasspath/a:."); | ||
| String bootClassPath = "-Xbootclasspath/a:."; | ||
| if (testClassesOnBootClassPath) { | ||
| // Add test classes themselves to boot classpath. This is required, for example, for IR tests with @Stable. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here too, drop the mention of @Stable?
| // Ignore CompileThreshold and CompileCommand flags which have an impact on the profiling information. | ||
| List<String> jtregVMFlags = Arrays.stream(Utils.getTestJavaOpts()).filter(s -> !s.contains("CompileThreshold")).toList(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This hunk seems unnecessary? I would like to have IR Framework patch that is easily backportable and does not contain additional, non-essential hunks :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair point, could be done separately, dropped :)
shipilev
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine, except one nit. I think we should maybe do a simple test to confirm this works on both Linux and Windows?
| String bootClassPath = "-Xbootclasspath/a:."; | ||
| if (testClassesOnBootClassPath) { | ||
| // Add test classes themselves to boot classpath to make them privileged. | ||
| bootClassPath += ":" + Utils.TEST_CLASSES; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think : is not portable, and should instead be File.pathSeparator?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! Fixed.
chhagedorn
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay. That is definitely a good idea to add a simple test to check the new feature. I've added such a test with @Stable that fails when not adding the test class to the boot classpath and works otherwise.
| String bootClassPath = "-Xbootclasspath/a:."; | ||
| if (testClassesOnBootClassPath) { | ||
| // Add test classes themselves to boot classpath to make them privileged. | ||
| bootClassPath += ":" + Utils.TEST_CLASSES; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! Fixed.
shipilev
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, thanks.
|
Thanks Aleksey for your review! |
|
Can/should we get some more reviews here? I would like to get the |
vnkozlov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good.
|
Thanks Vladimir for your review! /integrate |
|
Going to push as commit c01f53a.
Your commit was automatically rebased without conflicts. |
|
@chhagedorn Pushed as commit c01f53a. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
It is currently not possible to write IR tests with
@Stableannotations because one need to somehow add the IR test classes to the boot classpath. This patch provides support to write such IR tests. I've added a section to the README to provide guidance on how this can be done.This is motivated by #19635.
I've tested this patch by taking the current patch of #19635, dropping the
RestrictStableflag and modifying the tests to work with the new IR framework feature:Thanks,
Christian
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/20477/head:pull/20477$ git checkout pull/20477Update a local copy of the PR:
$ git checkout pull/20477$ git pull https://git.openjdk.org/jdk.git pull/20477/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 20477View PR using the GUI difftool:
$ git pr show -t 20477Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/20477.diff
Webrev
Link to Webrev Comment