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

8343039: Remove jdk.internal.misc.InternalLock and usages from java.io #22048

Closed
wants to merge 9 commits into from

Conversation

bplb
Copy link
Member

@bplb bplb commented Nov 12, 2024

Uses of InternalLock are removed and synchronized is reinstated.


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed (2 reviews required, with at least 1 Reviewer, 1 Author)

Issue

  • JDK-8343039: Remove jdk.internal.misc.InternalLock and usages from java.io (Enhancement - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 22048

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Nov 12, 2024

👋 Welcome back bpb! 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 Nov 12, 2024

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

8343039: Remove jdk.internal.misc.InternalLock and usages from java.io

Reviewed-by: liach, alanb

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

  • db56266: 8344250: Obsolete the DontYieldALot flag
  • 7ef2633: 8344128: Regression: make help broken after JDK-8340818
  • d959c7d: 8344147: Remove Security Manager dependencies from java.security.sasl module

Please see this link for an up-to-date comparison between the source branch of this pull request and 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 Nov 12, 2024
@openjdk
Copy link

openjdk bot commented Nov 12, 2024

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

  • core-libs

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.

@bplb
Copy link
Member Author

bplb commented Nov 12, 2024

Dynamic buffer resizing in BufferedOutputStream and BufferedWriter is retained.

The jdk.internal.access classes JavaIOPrintStreamAccess and JavaIOPrintWriterAccess will be addressed by a subsequent request.

@openjdk openjdk bot added the core-libs core-libs-dev@openjdk.org label Nov 12, 2024
@mlbridge
Copy link

mlbridge bot commented Nov 12, 2024

Copy link
Member

@liach liach left a comment

Choose a reason for hiding this comment

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

https://github.com/openjdk/jdk/tree/5212535a276a92d96ca20bdcfccfbce956febdb1 is a baseline for before virtual threads were integrated. Note that in this period, there are other optimizations such as lazy allocation for buffer arrays or some jfr changes, so these aren't exact matches.

@AlanBateman
Copy link
Contributor

I think we should remove jdk.internal.misc.InternalLock and the usages in Throwable as part of this change. I don't mind if JavaIOPrintStreamAccess is removed now or in a later PR.

@bplb
Copy link
Member Author

bplb commented Nov 13, 2024

I think we should remove jdk.internal.misc.InternalLock and the usages in Throwable as part of this change. I don't mind if JavaIOPrintStreamAccess is removed now or in a later PR.

I will address these items first and then the other comments, but will probably refrain from much in the way of simple cleanups, at least before the final iteration.

@bplb
Copy link
Member Author

bplb commented Nov 13, 2024

I think we should remove jdk.internal.misc.InternalLock

InternalLock is also in sun.nio.cs.Stream{De,En}coder.

@AlanBateman
Copy link
Contributor

AlanBateman commented Nov 13, 2024

InternalLock is also in sun.nio.cs.Stream{De,En}coder.

Yes, these two will need to be updated. I don't mind if this is split up into several PRs but if InternalLock isn't removed by the current PR then you'll need to change its title :-)

@bplb
Copy link
Member Author

bplb commented Nov 13, 2024

InternalLock is also in sun.nio.cs.Stream{De,En}coder.

Yes, these two will need to be updated. I don't mind if this is split up into several PRs but if InternalLock isn't removed by the current PR then you'll need to change its title :-)

I'll go ahead and update these and remove InternalLock.

…able; remove InternalLock class; address comments on BIS and BOS
@bplb
Copy link
Member Author

bplb commented Nov 13, 2024

21c9c5e addresses reviewer comments above and removes InternalLock. I will submit one more commit to remove JavaIOPrint{Stream,Writer}Access.

@bplb
Copy link
Member Author

bplb commented Nov 13, 2024

I don't mind if JavaIOPrintStreamAccess is removed now or in a later PR.

It is removed by d3d1e3a.

@AlanBateman
Copy link
Contributor

I did a pass over the latest update, a lot of changes, it's good that Chen is reviewing too as would be too easy to introduce a bug with this refactor.

@bplb
Copy link
Member Author

bplb commented Nov 13, 2024

[...] it's good that Chen is reviewing too as would be too easy to introduce a bug with this refactor.

Definitely on both counts.

@bplb
Copy link
Member Author

bplb commented Nov 13, 2024

f5548c1 fixes a test failure caught during CI testing.

@AlanBateman
Copy link
Contributor

/reviewers 2

@openjdk
Copy link

openjdk bot commented Nov 14, 2024

@AlanBateman
The total number of required reviews for this PR (including the jcheck configuration and the last /reviewers command) is now set to 2 (with at least 1 Reviewer, 1 Author).

@AlanBateman
Copy link
Contributor

I've changed the PR to require at least two reviewers as I think the changes could benefit from a second reviewer.

Copy link
Contributor

@AlanBateman AlanBateman left a comment

Choose a reason for hiding this comment

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

I did another pass over this and don't see any issues except the confusing comment in the BOS constructor. Overall good cleanup as InternalLock was a temporary crutch to avoid pinning in the java.io area for common usages.

@bplb bplb requested a review from AlanBateman November 14, 2024 16:38
@bplb bplb requested a review from liach November 14, 2024 16:50
Copy link
Member

@liach liach 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. Aside from the output stream smaller buffer from virtual threads, everything is pretty much a restoration to JDK18's state (aside from trivial whitespace changes)

ensureOpen();
boolean omitLF = ignoreLF || skipLF;
if (term != null) term[0] = false;
bufferLoop:
Copy link
Member

Choose a reason for hiding this comment

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

How do we usually handle the indentation of labels? I personally prefer this type of indentation, but in the jdk18 code the label has one less level of indentation, so it aligns with the enclosing }. Don't know if we are looking for parity with 18 code.

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 don't know what the indentation convention for labels is. Neither the draft style guide (https://cr.openjdk.org/~alundblad/styleguide/index-v6.html) nor the ancient code conventions from 1997 mention this.

test/jdk/java/lang/ProcessBuilder/Basic.java Show resolved Hide resolved
@openjdk openjdk bot added the ready Pull request is ready to be integrated label Nov 15, 2024
@bplb
Copy link
Member Author

bplb commented Nov 15, 2024

Looks good

Thanks, @liach , for the second review.

@bplb
Copy link
Member Author

bplb commented Nov 15, 2024

/integrate

@openjdk
Copy link

openjdk bot commented Nov 15, 2024

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

  • 3c38ed4: 8344314: Revert removal of jdk.internal.java.PreviewFeature.CLASSFILE_API
  • 40a055e: 8344228: Revisit SecurityManager usage in java.net.http after JEP 486 integration
  • 84ffb64: 8334714: Implement JEP 484: Class-File API
  • 6cdebf0: 8343599: Kmem limit and max values swapped when printing container information
  • a672138: 8344161: Argument type mismatch for jfr_type_id
  • 3245f56: 8344164: [s390x] ProblemList hotspot/jtreg/runtime/NMT/VirtualAllocCommitMerge.java
  • 5e27608: 8344188: Cleanup sun.net.www.protocol.jar.JarFileFactory after JEP 486 integration
  • ba39321: 8343881: java.lang.classfile.Attribute attributeName() method should return Utf8Entry
  • 75c651f: 8327156: Avoid copying in StringTable::intern(oop, TRAPS)
  • 3eece6e: 8341907: javac -Xlint should ignore /// on first line of source file
  • ... and 10 more: https://git.openjdk.org/jdk/compare/ec148c136555899c90f773b2904baf459efac3af...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Nov 15, 2024

@bplb Pushed as commit 0b9b82a.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@bplb bplb deleted the java.io-InternalLock-8343039 branch November 18, 2024 20:37
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 integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

4 participants