jdk icon indicating copy to clipboard operation
jdk copied to clipboard

8295302: Do not use ArrayList when LambdaForm has a single ClassData

Open iklam opened this issue 3 years ago • 4 comments

Please review this small optimization. As shown in the JBS issue, most of the generated LambdaForm classes have a single ClassData, so we can get a small footprint/speed improvement.


Progress

  • [x] Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • [x] Change must not contain extraneous whitespace
  • [x] Commit message must refer to an issue

Issue

  • JDK-8295302: Do not use ArrayList when LambdaForm has a single ClassData

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 10706

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

Using diff file

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

iklam avatar Oct 13 '22 21:10 iklam

:wave: Welcome back iklam! 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.

bridgekeeper[bot] avatar Oct 13 '22 21:10 bridgekeeper[bot]

@iklam 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[bot] avatar Oct 13 '22 21:10 openjdk[bot]

Webrevs

mlbridge[bot] avatar Oct 13 '22 22:10 mlbridge[bot]

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

8295302: Do not use ArrayList when LambdaForm has a single ClassData

Reviewed-by: vlivanov, redestad, mchung

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 no new commits pushed to the master branch. If another commit should be pushed before you perform the /integrate command, your PR will be automatically rebased. If you prefer to avoid any potential 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[bot] avatar Oct 14 '22 04:10 openjdk[bot]

Looks good, assuming there are tests calling in with no class data to check that defineClass is fine with null inputs?

Yes, we have two existing test cases that has no class data:

  • java/lang/invoke/CompileThresholdBootstrapTest
  • java/lang/invoke/LoopCombinatorLongSignatureTest

I found them by adding this to InvokerBytecodeGenerator::classDataValues()

    private Object classDataValues() {
        final List<ClassData> cd = classData;
        if (cd.size() == 0) {
            throw new RuntimeException("huh");
        }

If I remove the above hack but keep my patch, the tests passed. So I think this case is covered.

iklam avatar Oct 17 '22 21:10 iklam

Thanks @cl4es @iwanowww @mlchung for the review, and @turbanoff for the suggestion. /integrate

iklam avatar Oct 19 '22 21:10 iklam

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

  • 017e7988b197427f6b464303788a418a1d892ab9: 8293939: Move continuation_enter_setup and friends
  • f872467d69a6d8442f8004609ce819641cab568b: 8255746: Make PrintCompilation available on a per method level
  • 388a56e4c4278f2a3da31946b15a45f3aee25e58: 8294467: Fix sequence-point warnings in Hotspot
  • ceb5b08964e34dfae3819257e5df460f24f92a78: 8294468: Fix char-subscripts warnings in Hotspot
  • 7b1c6767fc5ea90630776e5bfa0fcc47ffc89aa6: 8295662: jdk/incubator/vector tests fail "assert(VM_Version::supports_avx512vlbw()) failed"
  • 5eaf5686656a10ee27977de23ed5290a723b96a8: 8295668: validate-source failure after JDK-8290011
  • e238920bb69836e982138cb7e1fed2a39182df8f: 8295372: CompactNumberFormat handling of number one with decimal part
  • a5f6e31ccbef27f4f363a80d41d5c9c1cae75151: 8295456: (ch) sun.nio.ch.Util::checkBufferPositionAligned gives misleading/incorrect error
  • e27bea0c4db282e26d0d96611bb330e02c314d48: 8290011: IGV: Remove dead code and cleanup
  • d37ce4cdd18afc4facf996598f79e72aae68f4ff: 8290368: Introduce LDAP and RMI protocol-specific object factory filters to JNDI implementation
  • ... and 6 more: https://git.openjdk.org/jdk/compare/3f4964f83d6f03efbee2fb34aa8258d4fc923efb...master

Your commit was automatically rebased without conflicts.

openjdk[bot] avatar Oct 19 '22 21:10 openjdk[bot]

@iklam Pushed as commit 8d4c077218748d37617fc1bdb537a165706a5849.

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

openjdk[bot] avatar Oct 19 '22 21:10 openjdk[bot]