Skip to content

8300543 Compiler Implementation for Pattern Matching for switch#13074

Closed
lahodaj wants to merge 45 commits intoopenjdk:masterfrom
lahodaj:JDK-8300543
Closed

8300543 Compiler Implementation for Pattern Matching for switch#13074
lahodaj wants to merge 45 commits intoopenjdk:masterfrom
lahodaj:JDK-8300543

Conversation

@lahodaj
Copy link
Contributor

@lahodaj lahodaj commented Mar 17, 2023

This is the first draft of a patch for JEP 440 and JEP 441. Changes included:

  • the pattern matching for switch and record patterns features are made final, together with updates to tests.
  • parenthesized patterns are removed.
  • qualified enum constants are supported for case labels.

This change herein also includes removal record patterns in for each loop, which may be split into a separate PR in the future.

/issue JDK-8300545


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Change requires CSR request JDK-8304394 to be approved
  • Commit message must refer to an issue
  • Change requires CSR request JDK-8304401 to be approved

Issues

  • JDK-8300543: Compiler Implementation for Pattern Matching for switch
  • JDK-8300545: Compiler Implementation for Record Patterns
  • JDK-8304394: Compiler Implementation for Pattern Matching for switch (CSR)
  • JDK-8304401: Compiler Implementation for Record Patterns (CSR)

Reviewers

Contributors

  • Aggelos Biboudis <abimpoudis@openjdk.org>

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 13074

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

Using diff file

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

Webrev

Link to Webrev Comment

@lahodaj lahodaj marked this pull request as draft March 17, 2023 12:16
@bridgekeeper
Copy link

bridgekeeper bot commented Mar 17, 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
Copy link

openjdk bot commented Mar 17, 2023

@lahodaj
Adding additional issue to issue list: 8300545: Compiler Implementation for Record Patterns.

@openjdk
Copy link

openjdk bot commented Mar 17, 2023

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

  • compiler
  • core-libs

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 core-libs core-libs-dev@openjdk.org compiler compiler-dev@openjdk.org csr Pull request needs approved CSR before integration labels Mar 17, 2023
* If no element in the {@code labels} array matches the target, then
* the method of the call site return the length of the {@code labels} array.
* <p>
* The value of the {@code restart} index must be between {@code 0} and
Copy link
Contributor

Choose a reason for hiding this comment

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

This description is a bit ambiguous - not clear whether it's 0 < x < length, or 0 <= x < length.

Copy link
Contributor

@mcimadamore mcimadamore left a comment

Choose a reason for hiding this comment

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

Added some comments in the exhaustiveness test

Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't Isn't testCoversType1the same astestExhaustiveStatement3` ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Some of the tests called testExhaustiveStatement do not seem to test statements at all

Copy link
Contributor

Choose a reason for hiding this comment

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

In the two testXYZExhaustiveIntersection the class hierarchy seems the same - can we reuse it across multiple test cases? I see something similar done in testOnlyApplicable.

Copy link
Contributor

Choose a reason for hiding this comment

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

The name testX doesn't seem very expressive - maybe testRecords ?

@openjdk
Copy link

openjdk bot commented May 10, 2023

@lahodaj this pull request can not be integrated into master due to one or more merge conflicts. To resolve these merge conflicts and update this pull request you can run the following commands in the local repository for your personal fork:

git checkout JDK-8300543
git fetch https://git.openjdk.org/jdk.git master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push

@openjdk openjdk bot added the merge-conflict Pull request has merge conflict with target branch label May 10, 2023
@openjdk openjdk bot removed the merge-conflict Pull request has merge conflict with target branch label May 11, 2023
@openjdk
Copy link

openjdk bot commented May 18, 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:

8300543: Compiler Implementation for Pattern Matching for switch
8300545: Compiler Implementation for Record Patterns

Co-authored-by: Aggelos Biboudis <abimpoudis@openjdk.org>
Reviewed-by: vromero, mcimadamore

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

  • 5ccc962: 8308342: Remove MetaspaceClosure::Ref::keep_after_pushing()
  • a0f4a94: 8307783: runtime/reflect/ReflectOutOfMemoryError.java timed out
  • 939344b: 8304685: Fix whitespace parsing in libjdwp
  • 241455f: 8307962: Exclude gc/g1/TestSkipRebuildRemsetPhase.java fails with virtual test thread factory
  • 34468e1: 8308021: Update IANA Language Subtag Registry to Version 2023-05-11
  • f0aebc8: 8305972: Update XML Security for Java to 3.0.2
  • 265f40b: 8308396: Fix offset_of conversion warnings in runtime code
  • a5343fa: 8281149: (fs) java/nio/file/FileStore/Basic.java fails with java.lang.RuntimeException: values differ by more than 1GB
  • 44218b1: 8308248: Revisit alignment of layout constants on 32-bit platforms
  • 80ef5c2: 8308410: broken compilation of test\jdk\tools\launcher\exeJliLaunchTest.c
  • ... and 125 more: https://git.openjdk.org/jdk/compare/2bf7ac58b7971f6813066dac7e88a855d597d731...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 ready Pull request is ready to be integrated and removed csr Pull request needs approved CSR before integration labels May 18, 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.

minor comment, looks good

* @bug 8297602
* @summary Compiler crash with type annotation and generic record during pattern matching
* @compile -XDrawDiagnostics T8297602.java
* @compile/fail/ref=T8297602.out -XDrawDiagnostics T8297602.java
Copy link
Contributor

Choose a reason for hiding this comment

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

I think that this test can be eliminated as new test AnnotationErrors supersedes it.

@lahodaj
Copy link
Contributor Author

lahodaj commented May 22, 2023

/contributor add @biboudis

@openjdk
Copy link

openjdk bot commented May 22, 2023

@lahodaj
Contributor Aggelos Biboudis <abimpoudis@openjdk.org> successfully added.

@lahodaj
Copy link
Contributor Author

lahodaj commented May 22, 2023

/inetgrate

@openjdk
Copy link

openjdk bot commented May 22, 2023

@lahodaj Unknown command inetgrate - for a list of valid commands use /help.

@lahodaj
Copy link
Contributor Author

lahodaj commented May 22, 2023

/integrate

@openjdk
Copy link

openjdk bot commented May 22, 2023

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

  • 5ccc962: 8308342: Remove MetaspaceClosure::Ref::keep_after_pushing()
  • a0f4a94: 8307783: runtime/reflect/ReflectOutOfMemoryError.java timed out
  • 939344b: 8304685: Fix whitespace parsing in libjdwp
  • 241455f: 8307962: Exclude gc/g1/TestSkipRebuildRemsetPhase.java fails with virtual test thread factory
  • 34468e1: 8308021: Update IANA Language Subtag Registry to Version 2023-05-11
  • f0aebc8: 8305972: Update XML Security for Java to 3.0.2
  • 265f40b: 8308396: Fix offset_of conversion warnings in runtime code
  • a5343fa: 8281149: (fs) java/nio/file/FileStore/Basic.java fails with java.lang.RuntimeException: values differ by more than 1GB
  • 44218b1: 8308248: Revisit alignment of layout constants on 32-bit platforms
  • 80ef5c2: 8308410: broken compilation of test\jdk\tools\launcher\exeJliLaunchTest.c
  • ... and 125 more: https://git.openjdk.org/jdk/compare/2bf7ac58b7971f6813066dac7e88a855d597d731...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented May 22, 2023

@lahodaj Pushed as commit eaa80ad.

💡 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

compiler compiler-dev@openjdk.org core-libs core-libs-dev@openjdk.org integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

9 participants