Skip to content

8303355: The Depend plugin does fully recompile when primitive type changes #12801

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

Closed
wants to merge 2 commits into from

Conversation

lahodaj
Copy link
Contributor

@lahodaj lahodaj commented Mar 1, 2023

The OpenJDK build is using a Plugin called Depend to avoid building Java code unnecessarily. It has two parts, one is checking module APIs (and forces rebuild of dependent modules if a dependency changes), and second takes modified files in a module, and attempts to detect whether it is enough to recompile these files, or if the whole module must be rebuilt.

There's a bug in the second part, it does not track changes in primitive types, so e.g. a change of a type of a public field form int to long does not cause recompile.

This patch fixes that by visiting the primitive types, and including them in the hash computed for the given file.

There's also another problem - if a module is being recompiled from scratch due to a change in a file hash, the new/updated file hashes are written immediately. And if the compilation consequently fails, the state is not compared to the original hash, but to the hash from the broken compilation, which may lead to missing compilation of some files.

This patch moves the code to write the new hashes to the end of compilation, and only do that when there were no compile-time errors during the compilation.


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-8303355: The Depend plugin does fully recompile when primitive type changes

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 12801

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

Using diff file

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

@bridgekeeper
Copy link

bridgekeeper bot commented Mar 1, 2023

👋 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 openjdk bot added the rfr Pull request is ready for review label Mar 1, 2023
@openjdk
Copy link

openjdk bot commented Mar 1, 2023

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

  • build
  • compiler

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 build build-dev@openjdk.org compiler compiler-dev@openjdk.org labels Mar 1, 2023
@mlbridge
Copy link

mlbridge bot commented Mar 1, 2023

Webrevs

@@ -878,24 +880,30 @@ public Void visitModifiers(ModifiersTree node, Void p) {
return super.visitModifiers(node, p);
}

@Override
public Void visitPrimitiveType(PrimitiveTypeTree node, Void p) {
update(node.getPrimitiveTypeKind().name());
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't DependTest include a test to stress this new code?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Test updated:
de84439

Thanks!

@openjdk
Copy link

openjdk bot commented Mar 1, 2023

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

8303355: The Depend plugin does fully recompile when primitive type changes

Reviewed-by: erikj, vromero

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

  • 9fc518f: 8303401: Add a Vector API equalsIgnoreCase micro benchmark
  • 05faa73: 8303232: java.util.Date.parse(String) and java.util.Date(String) don't declare thrown IllegalArgumentException
  • 4c985e5: 8303183: Memory leak in Arguments::init_shared_archive_paths
  • 6af17c1: 8303362: Serial: Move CardTableRS to serial directory
  • c1e77e0: 8303252: G1: Return early from Full-GC if no regions are selected for compaction.
  • 8b86e1e: 8303344: After JDK-8302760, G1 heap verification does not exit VM after errors
  • 4c5d9cf: 8303013: Always do remembered set verification during G1 Full GC
  • 2451c5a: 8303357: [JVMCI] thread is _thread_in_vm when committing JFR compilation event
  • 539a495: 8302798: Refactor -XX:+UseOSErrorReporting for noreturn crash reporting
  • 6b07243: 8301630: C2: 8297933 broke type speculation in some cases
  • ... and 33 more: https://git.openjdk.org/jdk/compare/2613b94f2863f54af22929ca8b5fef290e256ba1...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 ready Pull request is ready to be integrated label Mar 1, 2023
Copy link
Contributor

@vicente-romero-oracle vicente-romero-oracle 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, thanks

@lahodaj
Copy link
Contributor Author

lahodaj commented Mar 2, 2023

/integrate

@openjdk
Copy link

openjdk bot commented Mar 2, 2023

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

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Mar 2, 2023

@lahodaj Pushed as commit dbb562d.

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

Successfully merging this pull request may close these issues.

3 participants