Skip to content

8341755: Optimize argNames in InnerClassLambdaMetafactory#21399

Closed
wenshao wants to merge 10 commits intoopenjdk:masterfrom
wenshao:optim_inner_class_lamba_meta_factory_202410
Closed

8341755: Optimize argNames in InnerClassLambdaMetafactory#21399
wenshao wants to merge 10 commits intoopenjdk:masterfrom
wenshao:optim_inner_class_lamba_meta_factory_202410

Conversation

@wenshao
Copy link
Contributor

@wenshao wenshao commented Oct 8, 2024

A simple optimization that eliminates the allocation of the MethodTypeDescImpl object when parameterCount is equal to 0 and eliminates the allocation of argNames when parameterCount is equal to 1


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-8341755: Optimize argNames in InnerClassLambdaMetafactory (Enhancement - P4)

Reviewers

Contributors

  • Chen Liang <liach@openjdk.org>

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 21399

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Oct 8, 2024

👋 Welcome back swen! 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.

@liach
Copy link
Member

liach commented Oct 8, 2024

argNames[i] is always "arg$" + (i + 1). Maybe we can change all argNames[x] usage to a method like:

public static String argName(int i) {
    if (i < 8)
        return ARG_NAME_CACHE[i];
    return "arg$" + (i + 1);
}

@openjdk
Copy link

openjdk bot commented Oct 8, 2024

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

8341755: Optimize argNames in InnerClassLambdaMetafactory

Co-authored-by: Chen Liang <liach@openjdk.org>
Reviewed-by: liach, redestad

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:

  • de90204: 8341588: Remove CollectionUsageThreshold.java from ProblemList-Xcomp for debugging
  • f276f58: 8341803: ProblemList containers/docker/TestJcmdWithSideCar.java on linux-x64
  • 7eab0a5: 8337066: Repeated call of StringBuffer.reverse with double byte string returns wrong result

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
Copy link

openjdk bot commented Oct 8, 2024

@wenshao 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.

@openjdk openjdk bot added the core-libs core-libs-dev@openjdk.org label Oct 8, 2024
@wenshao
Copy link
Contributor Author

wenshao commented Oct 8, 2024

/contributor add liach

@openjdk
Copy link

openjdk bot commented Oct 8, 2024

@wenshao
Contributor Chen Liang <liach@openjdk.org> successfully added.

@liach
Copy link
Member

liach commented Oct 8, 2024

Can we change the name to "Optimize argNames in InnerClassLambdaMetafactory"?

@wenshao wenshao changed the title Optimize InnerClassLambdaMetafactory initialization Optimize argNames in InnerClassLambdaMetafactory Oct 8, 2024
@wenshao wenshao changed the title Optimize argNames in InnerClassLambdaMetafactory 8341755: Optimize argNames in InnerClassLambdaMetafactory Oct 8, 2024
@openjdk openjdk bot added the rfr Pull request is ready for review label Oct 8, 2024
@mlbridge
Copy link

mlbridge bot commented Oct 8, 2024

Webrevs

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. Since I have contributed I think we need another review, such as @cl4es.

/reviewers 2 reviewer

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Oct 8, 2024
@openjdk
Copy link

openjdk bot commented Oct 8, 2024

@liach
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 2 Reviewers).

@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Oct 8, 2024
Copy link
Member

@cl4es cl4es left a comment

Choose a reason for hiding this comment

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

Looks reasonable

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Oct 8, 2024
…etafactory.java

Co-authored-by: Claes Redestad <claes.redestad@oracle.com>
@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Oct 8, 2024
@openjdk openjdk bot added the ready Pull request is ready to be integrated label Oct 8, 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.

Trivial merge.

/reviewers 1 reviewer

@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Oct 8, 2024
@openjdk
Copy link

openjdk bot commented Oct 8, 2024

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

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Oct 8, 2024
}

private static String argName(int i) {
String argName = i < ARG_NAME_CACHE_SIZE ? ARG_NAME_CACHE[i] : null;
Copy link
Member

Choose a reason for hiding this comment

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

Just an idea, but perhaps could constant init ARG_NAME_CACHE = { "arg$0", "arg$1", .. , "arg$7" }; and simplify this?

@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Oct 9, 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.

Back to precomputed constants :)

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Oct 9, 2024
@wenshao
Copy link
Contributor Author

wenshao commented Oct 9, 2024

Back to precomputed constants :)

Manual shift computation! The code is also simplified based on precomputed constants.

@wenshao
Copy link
Contributor Author

wenshao commented Oct 9, 2024

/integrate

@openjdk
Copy link

openjdk bot commented Oct 9, 2024

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

  • 172f744: 8340985: Open source some Desktop related tests
  • e7045e9: 8341684: Typo in External Specifications link of java.util.Currency
  • 49c7148: 8341366: Suspicious check in Locale.getDisplayName(Locale inLocale)
  • 52eded4: 8341170: Open source several Choice related tests (part 2)
  • a45abf1: 8341860: ProblemList applications/ctw/modules/java_base_2.java on linux-x64
  • 593c27e: 8341535: sun/awt/font/TestDevTransform.java fails with RuntimeException: Different rendering
  • 3180aaa: 8341832: Incorrect continuation address of synthetic SIGSEGV for APX in product builds
  • 3ab519f: 8341424: GHA: Collect hs_errs from build time failures
  • a24525b: 8339320: Optimize ClassFile Utf8EntryImpl#inflate
  • fcc9c8d: 8341854: Incorrect clearing of ZF in fast_unlock_lightweight on x86
  • ... and 15 more: https://git.openjdk.org/jdk/compare/62acc9c174f23acd2807c8214ffc28d73799da16...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Oct 9, 2024

@wenshao Pushed as commit c850ecb.

💡 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 integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

3 participants