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

8345942: Separate source output from class output when building microbenchmarks #22731

Closed
wants to merge 1 commit into from

Conversation

lahodaj
Copy link
Contributor

@lahodaj lahodaj commented Dec 13, 2024

The microbenchmarks build generates a considerable amount of (generated) sources using an annotation processor. This, by itself, is not a problem. But, it generates them into the class output, and after the microbenchmarks build has been updated to be (somewhat) incremental, the class output has been added to the classpath(*):
b704bfa

Then when the AP attempts to generate a new file (for a class name), javac will look for same-named classes on the classpath, and may load the source code generated by a previous rounds of builds, in case of an incremental build. And since the AP generates the considerable amount of these files, this leads to loading a considerable amounts of source code, eventually leading to memory problems (JDK-8345302).

The proposal herein is to split the (generated) source output from the class output. This considerably reduces the amount of memory javac uses, and generally seems like a good approach for the build.

(*) adding the class output to the classpath is usually needed when incrementally compiling code in the unnamed module, to ensure that if e.g. only one source file is being compiled, it can refer to other, already produced, classes. As a side note, this does not need to be done in named-module compilation modes, as javac automatically reads the class output when compiling the named modules. But it is not easily possible to enhance javac to do that for unnamed module, due to compatibility concerns.


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-8345942: Separate source output from class output when building microbenchmarks (Bug - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 22731

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Dec 13, 2024

👋 Welcome back jlahoda! 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 Dec 13, 2024

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

8345942: Separate source output from class output when building microbenchmarks

Reviewed-by: shade, erikj

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

openjdk bot commented Dec 13, 2024

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

  • build

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 build build-dev@openjdk.org label Dec 13, 2024
@mlbridge
Copy link

mlbridge bot commented Dec 13, 2024

Webrevs

Copy link
Member

@shipilev shipilev left a comment

Choose a reason for hiding this comment

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

This looks good. I think this is similar to how standard Maven-based JMH build works as well: it puts the generated sources into target/generated-sources, separate from the original sources.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Dec 13, 2024
@lahodaj
Copy link
Contributor Author

lahodaj commented Dec 17, 2024

/integrate

@openjdk
Copy link

openjdk bot commented Dec 17, 2024

Going to push as commit 99af595.
Since your change was applied there have been 103 commits pushed to the master branch:

  • 8a64595: 8346282: [JVMCI] Add failure reason support to UnresolvedJava/Type/Method/Field
  • 725079b: 8345506: jar --validate may lead to java.nio.file.FileAlreadyExistsException
  • 5e25c48: 8346289: Confusing phrasing in IR Framework README / User-defined Regexes
  • fbbc7c3: 8346120: VirtualThreadPinned event recorded for Object.wait may have wrong duration or may record second event
  • 466c00a: 8346234: javax/swing/text/DefaultEditorKit/4278839/bug4278839.java still fails in CI
  • bd3c0be: 8268611: jar --validate should check targeted classes in MR-JAR files
  • 87804f2: 8346294: Invalid lint category specified in compiler.properties
  • 18d1d61: 8346046: Enable copyright header format check
  • a7631cc: 8346235: RISC-V: Optimize bitwise AND with mask values
  • 929d4a5: 8346231: RISC-V: Fix incorrect assertion in SharedRuntime::generate_handler_blob
  • ... and 93 more: https://git.openjdk.org/jdk/compare/4f855d1342d55aeee93b7d0c5796fbfd4994c856...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Dec 17, 2024

@lahodaj Pushed as commit 99af595.

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

Successfully merging this pull request may close these issues.

3 participants