Skip to content

8303267: Prefer ArrayList to LinkedList in ConcurrentLocksPrinter #12763

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

turbanoff
Copy link
Member

@turbanoff turbanoff commented Feb 27, 2023

LinkedList is used as value in sun.jvm.hotspot.runtime.ConcurrentLocksPrinter#locksMap Map.
There is only add/iterator calls on this lists. No removes from the head or something like this. Not sure why LinkedList was used, but ArrayList should be preferred as more efficient and widely used collection.

Also I've done some related code cleaned:

  1. Mark field locksMap as final
  2. Use Map.computeIfAbsent
  3. Use enhanced-for cycle instead of for with iterator

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-8303267: Prefer ArrayList to LinkedList in ConcurrentLocksPrinter

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 12763

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

Using diff file

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

@bridgekeeper
Copy link

bridgekeeper bot commented Feb 27, 2023

👋 Welcome back aturbanov! 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 Feb 27, 2023

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

  • serviceability

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 serviceability serviceability-dev@openjdk.org label Feb 27, 2023
@turbanoff turbanoff changed the title [PATCH] Prefer ArrayList to LinkedList in ConcurrentLocksPrinter 8303267: Prefer ArrayList to LinkedList in ConcurrentLocksPrinter Feb 27, 2023
@openjdk openjdk bot added the rfr Pull request is ready for review label Feb 27, 2023
@mlbridge
Copy link

mlbridge bot commented Feb 27, 2023

Webrevs

@openjdk
Copy link

openjdk bot commented Feb 27, 2023

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

8303267: Prefer ArrayList to LinkedList in ConcurrentLocksPrinter

Reviewed-by: cjplummer, sspitsyn

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

  • 5feb13b: 8301701: java/net/DatagramSocket/DatagramSocketMulticasting.java should be hardened
  • 1e3c9fd: 8026369: javac potentially ambiguous overload warning needs an improved scheme
  • 14a014d: 8302124: HotSpot Style Guide should permit noreturn attribute
  • bca60f4: 8303249: JFR: Incorrect description of dumponexit
  • f7f1036: 8303068: Memory leak in DwarfFile::LineNumberProgram::run_line_number_program
  • 784f7b1: 8293667: Align jlink's --compress option with jmod's --compress option
  • 54603aa: 8303208: JFR: 'jfr print' displays incorrect timestamps
  • 4c169d2: 8303253: Remove unnecessary calls to super() in java.time value based classes
  • b527edd: 8292914: Lambda proxies have unstable names
  • 42330d2: 8029370: (fc) FileChannel javadoc not clear for cases where position == size
  • ... and 4 more: https://git.openjdk.org/jdk/compare/f2b03f9a2c0fca853211e41a1ddf46195dd56698...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 Feb 27, 2023
Copy link
Contributor

@sspitsyn sspitsyn 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,
Serguei

@turbanoff
Copy link
Member Author

/integrate

@openjdk
Copy link

openjdk bot commented Mar 2, 2023

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

  • 2c7d2c0: 8303411: JFR problem list entry for JDK-8247776 should be removed
  • 0b63557: 8303039: Utilize coverageLevels.txt
  • 32247c3: 8303476: Add the runtime version in the release file of a JDK image
  • 0926d0c: 8302516: Do some cleanup of nsk/share/jdi/EventHandler.java
  • b51ea42: 8303354: addCertificatesToKeystore in KeystoreImpl.m needs CFRelease call in early potential CHECK_NULL return
  • fb13063: 8303409: Add Windows AArch64 ABI support to the Foreign Function & Memory API
  • c9afd55: 8302820: Remove costs for NMTPreInit when NMT is off
  • 72de24e: 8303457: Introduce convenience test library APIs for creating test servers for tests in test/jdk/java/net/httpclient
  • 3091744: 8303418: Improve parameter and variable names in BitMap
  • dbb562d: 8303355: The Depend plugin does fully recompile when primitive type changes
  • ... and 43 more: https://git.openjdk.org/jdk/compare/f2b03f9a2c0fca853211e41a1ddf46195dd56698...master

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

@turbanoff Pushed as commit d4dcba0.

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

Successfully merging this pull request may close these issues.

3 participants