Skip to content
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

8332340: Add JavacBench as a test case for CDS #19256

Closed

Conversation

iklam
Copy link
Member

@iklam iklam commented May 16, 2024

JavacBench is a test program that compiles 90 Java source files. It uses a fair amount of invokedynamic callsites, so it's good for testing CDS support for indy and lambda expressions.

This test was first integrated into the leyden repo. Hence some of the files have copyrights in 2023.


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-8332340: Add JavacBench as a test case for CDS (Enhancement - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 19256

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented May 16, 2024

👋 Welcome back iklam! 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 May 16, 2024

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

8332340: Add JavacBench as a test case for CDS

Reviewed-by: ccheung, matsaave

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 89 new commits pushed to the master branch:

  • 90758f6: 8332808: Always set java.io.tmpdir to a suitable value in the build
  • e19a421: 8332720: ubsan: instanceKlass.cpp:3550:76: runtime error: member call on null pointer of type 'struct Array'
  • 2581935: 8332528: Generate code in SwitchBootstraps.generateTypeSwitch that require fewer adaptations
  • b890336: 8328083: degrade virtual thread support for GetObjectMonitorUsage
  • 4e6d851: 8325324: Implement JEP 477: Implicitly Declared Classes and Instance Main Methods (Third Preview)
  • 612ae92: 8332735: [JVMCI] Add extra JVMCI events for exception translation
  • 1ea76d3: 8332675: test/hotspot/jtreg/gc/testlibrary/Helpers.java compileClass javadoc does not match after 8321812
  • 94af3c2: 8329203: Parallel: Investigate Mark-Compact for Full GC to decrease memory usage
  • 1e5a278: 8332676: Remove unused BarrierSetAssembler::incr_allocated_bytes
  • c2180d1: 8315767: InetAddress: constructing objects from BSD literal addresses
  • ... and 79 more: https://git.openjdk.org/jdk/compare/4083255440cfbf39b9683ea88a433d71ec6111e7...master

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 added the rfr Pull request is ready for review label May 16, 2024
@openjdk
Copy link

openjdk bot commented May 16, 2024

@iklam The following labels will be automatically applied to this pull request:

  • core-libs
  • hotspot-runtime

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added hotspot-runtime hotspot-runtime-dev@openjdk.org core-libs core-libs-dev@openjdk.org labels May 16, 2024
@mlbridge
Copy link

mlbridge bot commented May 16, 2024

Webrevs

test/lib/jdk/test/lib/StringArrayUtils.java Outdated Show resolved Hide resolved
list.add(s);
}

return list.toArray(new String[list.size()]);
Copy link
Member

Choose a reason for hiding this comment

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

I thought we have been preferring ot use new String[0] for toArray calls. Also for simplicity, we can change the implementation to:

var list = new ArrayList<>(Arrays.asList(prefix));
Collections.addAll(list, extra);
return list.toArray(new String[0]);

or for performance:

String[] ret = new String[prefix.length + extra.length];
System.arraycopy(prefix, 0, ret, 0, prefix.length);
System.arraycopy(extra, 0, ret, prefix.length, extra.length);
return ret;

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for the suggestion. I used your arraycopy version. I also added some javadocs about the intended use of these concat() methods.

…ocessBuilder() instead of createLimitedTestJavaProcessBuilder()
Copy link
Member

@calvinccheung calvinccheung left a comment

Choose a reason for hiding this comment

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

A few minor comments.


import jdk.test.lib.cds.CDSAppTester;
import jdk.test.lib.helpers.ClassFileInstaller;
import jdk.test.lib.process.OutputAnalyzer;
Copy link
Member

Choose a reason for hiding this comment

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

Is this import needed?

Copy link
Member Author

Choose a reason for hiding this comment

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

Removed.

Comment on lines 221 to 222
long elapsed = System.currentTimeMillis() - started;
if (System.getProperty("JavacBenchApp.silent") == null) {
Copy link
Member

Choose a reason for hiding this comment

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

Should line 221 be inside the 'if' block?

Copy link
Member Author

Choose a reason for hiding this comment

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

I moved it inside the 'if' block.

}
}

throw new RuntimeException("Must have exactly one command line argument: STATIC or DYNAMIC");
Copy link
Member

Choose a reason for hiding this comment

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

Why not check the number of args at the beginning of the method?

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed.

@@ -0,0 +1,77 @@
/*
* Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved.
Copy link
Member

Choose a reason for hiding this comment

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

Since this is a new file, should the copyright year be only 2024?
(same for other files)

Copy link
Member Author

Choose a reason for hiding this comment

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

The file was first added in the Leyden repo in 2023, so I think we should use that as the initial copyright year.

Copy link
Member

@calvinccheung calvinccheung left a comment

Choose a reason for hiding this comment

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

Updates look good. Thanks!

@openjdk openjdk bot added the ready Pull request is ready to be integrated label May 21, 2024
Copy link
Contributor

@matias9927 matias9927 left a comment

Choose a reason for hiding this comment

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

LGTM, and thanks for the new utilities! That should make writing CDS tests a lot easier. I have a few style considerations but you can take them or leave them.

return output;
}

private OutputAnalyzer dumpStaticArchive() throws Exception {
Copy link
Contributor

Choose a reason for hiding this comment

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

The code from 156 to 162 is repeated 3 times here, is it worth making another function for this?

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for the suggestion. I've refactored the code a bit to make it easier to write new execution modes (which will be needed in Leyden).

test/lib/jdk/test/lib/cds/CDSAppTester.java Outdated Show resolved Hide resolved
Copy link
Contributor

@matias9927 matias9927 left a comment

Choose a reason for hiding this comment

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

Changes look good

@iklam
Copy link
Member Author

iklam commented May 23, 2024

Thanks @liach @calvinccheung @matias9927 for the review
/integrate

@openjdk
Copy link

openjdk bot commented May 23, 2024

Going to push as commit 7fd9d6c.
Since your change was applied there have been 91 commits pushed to the master branch:

  • 417d174: 8331348: Some incremental builds deposit files in the make directory
  • 303ac9f: 8332671: Logging for pretouching thread stacks shows wrong memory range
  • 90758f6: 8332808: Always set java.io.tmpdir to a suitable value in the build
  • e19a421: 8332720: ubsan: instanceKlass.cpp:3550:76: runtime error: member call on null pointer of type 'struct Array'
  • 2581935: 8332528: Generate code in SwitchBootstraps.generateTypeSwitch that require fewer adaptations
  • b890336: 8328083: degrade virtual thread support for GetObjectMonitorUsage
  • 4e6d851: 8325324: Implement JEP 477: Implicitly Declared Classes and Instance Main Methods (Third Preview)
  • 612ae92: 8332735: [JVMCI] Add extra JVMCI events for exception translation
  • 1ea76d3: 8332675: test/hotspot/jtreg/gc/testlibrary/Helpers.java compileClass javadoc does not match after 8321812
  • 94af3c2: 8329203: Parallel: Investigate Mark-Compact for Full GC to decrease memory usage
  • ... and 81 more: https://git.openjdk.org/jdk/compare/4083255440cfbf39b9683ea88a433d71ec6111e7...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented May 23, 2024

@iklam Pushed as commit 7fd9d6c.

💡 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
core-libs core-libs-dev@openjdk.org hotspot-runtime hotspot-runtime-dev@openjdk.org integrated Pull request has been integrated
4 participants