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

8317048: VerifyError with unnamed pattern variable and more than one components #15983

Closed
wants to merge 2 commits into from

Conversation

biboudis
Copy link
Member

@biboudis biboudis commented Sep 29, 2023

There were situations when javac optimizes switch structures (by merging the head of cases recursively) when two neighboring cases have a mix of named and unnamed patterns. This resulted translation is like the following:

From this:

  static <T1 extends Comparable, T2 extends Comparable> int compareTo(Tuple<R<T1>, R<T2>> o) {
        return switch (o) {
            case Tuple<R<T1>, R<T2>>(R1<T1> _, R1<T2> _) -> -1;
            case Tuple<R<T1>, R<T2>>(R1<T1> _, R2<T2> _) -> -1;
            case Tuple<R<T1>, R<T2>>(R2<T1> _, R1<T2> _) -> -1;
            case Tuple<R<T1>, R<T2>>(R2<T1> fst, R2<T2> snd) -> fst.value().compareTo(snd.value());
        };
    }

to code like this from the deeper nested switch (sample taken from translateTopLevelClass):

...
case 1:
   if (!(let snd = (T8317048.R2)selector10$temp; in true)) {
       index$11 = 2;
       continue;
   }
   yield .value().compareTo(snd.value()); // boom, fst is missing
   break;
...

The reason is that in the resolveAccumulator we peek the first of the two to replace both, in this case the R2<T1> _.

JCPatternCaseLabel leadingTest = 
        (JCPatternCaseLabel) accummulator.first().labels.head;

One way to solve this is to not merge two successive type patterns that have different namings (either both named or both unnamed).


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-8317048: VerifyError with unnamed pattern variable and more than one components (Bug - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 15983

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Sep 29, 2023

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

@biboudis biboudis marked this pull request as ready for review September 29, 2023 10:22
@openjdk openjdk bot added the rfr Pull request is ready for review label Sep 29, 2023
@openjdk
Copy link

openjdk bot commented Sep 29, 2023

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

  • compiler

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 compiler compiler-dev@openjdk.org label Sep 29, 2023
@mlbridge
Copy link

mlbridge bot commented Sep 29, 2023

Webrevs

@bridgekeeper
Copy link

bridgekeeper bot commented Oct 27, 2023

@biboudis This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

@biboudis
Copy link
Member Author

Keep open 🚀

Copy link
Contributor

@lahodaj lahodaj left a comment

Choose a reason for hiding this comment

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

Looks OK.

@openjdk
Copy link

openjdk bot commented Nov 1, 2023

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

8317048: VerifyError with unnamed pattern variable and more than one components

Reviewed-by: jlahoda

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

  • ab19348: 8318647: Serial: Refactor BlockOffsetTable
  • b4f5379: 8304939: os::win32::exit_process_or_thread should be marked noreturn
  • 0461d9a: 8318016: Per-compilation memory ceiling
  • 2a76ad9: 8318683: compiler/c2/irTests/TestPhiDuplicatedConversion.java "Failed IR Rules (2) of Methods (2)"
  • b3fec6b: 8306980: Generated docs should contain correct Legal Documents
  • 1139482: 8316132: CDSProtectionDomain::get_shared_protection_domain should check for exception
  • 2182c93: 8313643: Update HarfBuzz to 8.2.2
  • 613a3cc: 8301846: Invalid TargetDataLine after screen lock when using JFileChooser or COM library
  • 613d32c: 8169475: WheelModifier.java fails by timeout
  • f1e8787: 8317609: Classfile API fails to verify /jdk.jcmd/sun/tools/jstat/Alignment.class
  • ... and 447 more: https://git.openjdk.org/jdk/compare/1be355734da94243e29f0899b53aa1ebdf3bcb79...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.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@lahodaj) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Nov 1, 2023
@biboudis
Copy link
Member Author

biboudis commented Nov 1, 2023

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Nov 1, 2023
@openjdk
Copy link

openjdk bot commented Nov 1, 2023

@biboudis
Your change (at version 5ee4d17) is now ready to be sponsored by a Committer.

@lahodaj
Copy link
Contributor

lahodaj commented Nov 1, 2023

/integrate

@lahodaj
Copy link
Contributor

lahodaj commented Nov 1, 2023

/sponsor

@openjdk
Copy link

openjdk bot commented Nov 1, 2023

@lahodaj Only the author (@biboudis) is allowed to issue the integrate command. As this pull request is ready to be sponsored, and you are an eligible sponsor, did you mean to issue the /sponsor command?

@openjdk
Copy link

openjdk bot commented Nov 1, 2023

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

  • ab19348: 8318647: Serial: Refactor BlockOffsetTable
  • b4f5379: 8304939: os::win32::exit_process_or_thread should be marked noreturn
  • 0461d9a: 8318016: Per-compilation memory ceiling
  • 2a76ad9: 8318683: compiler/c2/irTests/TestPhiDuplicatedConversion.java "Failed IR Rules (2) of Methods (2)"
  • b3fec6b: 8306980: Generated docs should contain correct Legal Documents
  • 1139482: 8316132: CDSProtectionDomain::get_shared_protection_domain should check for exception
  • 2182c93: 8313643: Update HarfBuzz to 8.2.2
  • 613a3cc: 8301846: Invalid TargetDataLine after screen lock when using JFileChooser or COM library
  • 613d32c: 8169475: WheelModifier.java fails by timeout
  • f1e8787: 8317609: Classfile API fails to verify /jdk.jcmd/sun/tools/jstat/Alignment.class
  • ... and 447 more: https://git.openjdk.org/jdk/compare/1be355734da94243e29f0899b53aa1ebdf3bcb79...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Nov 1, 2023

@lahodaj @biboudis Pushed as commit 36de19d.

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