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

8314578: Non-verifiable code is emitted when two guards declare pattern variables in colon-switch #15630

Closed
wants to merge 2 commits into from

Conversation

biboudis
Copy link
Member

@biboudis biboudis commented Sep 8, 2023

In the following example while the case pattern does not introduce binding variable, the guard does. hasBindings has been updated accordingly to accept any trees and check them if they contain a visitBindingPattern. Not only JCPattern's.

static void test(Object o) {
    switch (o) {
      case R1() when o instanceof String s:
      case R2() when o instanceof Integer i:
        System.out.println("hello: " + i);
        break;
      default:
        break;
    }
  }

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-8314578: Non-verifiable code is emitted when two guards declare pattern variables in colon-switch (Bug - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 15630

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

Using diff file

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

Webrev

Link to Webrev Comment

Sorry, something went wrong.

@bridgekeeper
Copy link

bridgekeeper bot commented Sep 8, 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.

@openjdk
Copy link

openjdk bot commented Sep 8, 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 8, 2023
@biboudis biboudis marked this pull request as ready for review October 2, 2023 10:12
@openjdk openjdk bot added the rfr Pull request is ready for review label Oct 2, 2023
@mlbridge
Copy link

mlbridge bot commented Oct 2, 2023

Webrevs

@mlbridge
Copy link

mlbridge bot commented Oct 2, 2023

Mailing list message from Remi Forax on compiler-dev:

----- Original Message -----

From: "Aggelos Biboudis" <abimpoudis at openjdk.org>
To: "compiler-dev" <compiler-dev at openjdk.org>
Sent: Monday, October 2, 2023 12:19:40 PM
Subject: RFR: 8314578: Non-verifiable code is emitted when two guards declare pattern variables in colon-switch

In the following example while the case pattern does not introduce binding
variable, the guard does. `hasBindings` has been updated accordingly to accept
any trees and check them if they contain a `visitBindingPattern`. Not only
`JCPattern`'s.

static void test(Object o) {
switch (o) {
case R1() when o instanceof String s:
case R2() when o instanceof Integer i:
System.out.println("hello: " + i);
break;
default:
break;
}
}

I think, i've fully understand the issue, what about

static void test(Object o) {
switch (o) {
case R1() when o instanceof String _:
case R2() when o instanceof Integer _:
System.out.println("hello: " + i);
break;
default:
break;
}
}

regards,
R?mi

@mlbridge
Copy link

mlbridge bot commented Oct 2, 2023

Mailing list message from Remi Forax on compiler-dev:

oops,
"I've not fully understand the issue" ...

----- Original Message -----

From: "Remi Forax" <forax at univ-mlv.fr>
To: "Aggelos Biboudis" <abimpoudis at openjdk.org>
Cc: "compiler-dev" <compiler-dev at openjdk.org>
Sent: Monday, October 2, 2023 5:04:47 PM
Subject: Re: RFR: 8314578: Non-verifiable code is emitted when two guards declare pattern variables in colon-switch

----- Original Message -----

From: "Aggelos Biboudis" <abimpoudis at openjdk.org>
To: "compiler-dev" <compiler-dev at openjdk.org>
Sent: Monday, October 2, 2023 12:19:40 PM
Subject: RFR: 8314578: Non-verifiable code is emitted when two guards declare
pattern variables in colon-switch

In the following example while the case pattern does not introduce binding
variable, the guard does. `hasBindings` has been updated accordingly to accept
any trees and check them if they contain a `visitBindingPattern`. Not only
`JCPattern`'s.

static void test(Object o) {
switch (o) {
case R1() when o instanceof String s:
case R2() when o instanceof Integer i:
System.out.println("hello: " + i);
break;
default:
break;
}
}

I think, i've fully understand the issue, what about

static void test(Object o) {
switch (o) {
case R1() when o instanceof String _:
case R2() when o instanceof Integer _:
System.out.println("hello: " + i);
break;
default:
break;
}
}

regards,
R?mi

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.

looks reasonable to me

@openjdk
Copy link

openjdk bot commented Oct 2, 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:

8314578: Non-verifiable code is emitted when two guards declare pattern variables in colon-switch

Reviewed-by: vromero

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

  • 1ed9c76: 8309204: Obsolete DoReserveCopyInSuperWord
  • 3630af2: 8316594: C2 SuperWord: wrong result with hand unrolled loops
  • c6c69b5: 8314654: Metaspace: move locking out of MetaspaceArena
  • 3105538: 8316146: Open some swing tests 4
  • 36314a9: 8267509: Improve IllegalAccessException message to include the cause of the exception
  • ddacf92: 8305765: CompressedClassPointers.java is unreliable due to ASLR
  • 4195246: 8317354: Serial: Move DirtyCardToOopClosure to gc/serial folder
  • 0a3a925: 8316414: C2: large byte array clone triggers "failed: malformed control flow" assertion failure on linux-x86
  • b0d6c84: 8316396: Endless loop in C2 compilation triggered by AddNode::IdealIL
  • a8549b6: 8280120: [IR Framework] Add attribute to @ir to enable/disable IR matching based on the architecture
  • ... and 359 more: https://git.openjdk.org/jdk/compare/dac1727956cf9edeae1dad677f3f9ae87882a6b9...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 (@vicente-romero-oracle) 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 Oct 2, 2023
@mlbridge
Copy link

mlbridge bot commented Oct 3, 2023

Mailing list message from Angelos Bimpoudis on compiler-dev:

Hello R?mi,

https://github.com//pull/15630/files#diff-06a9cd077d1cc0d23cc8810100b1ac02ac2a19904581f809bc79b49582971f69R35-R42

I added that pos test. I think this should compile ok (already did). Do I understand correctly?

Angelos.
________________________________
From: Remi Forax <forax at univ-mlv.fr>
Sent: 02 October 2023 17:04
To: Aggelos Biboudis <abimpoudis at openjdk.org>
Cc: compiler-dev <compiler-dev at openjdk.org>
Subject: Re: RFR: 8314578: Non-verifiable code is emitted when two guards declare pattern variables in colon-switch

----- Original Message -----

From: "Aggelos Biboudis" <abimpoudis at openjdk.org>
To: "compiler-dev" <compiler-dev at openjdk.org>
Sent: Monday, October 2, 2023 12:19:40 PM
Subject: RFR: 8314578: Non-verifiable code is emitted when two guards declare pattern variables in colon-switch

In the following example while the case pattern does not introduce binding
variable, the guard does. `hasBindings` has been updated accordingly to accept
any trees and check them if they contain a `visitBindingPattern`. Not only
`JCPattern`'s.

static void test(Object o) {
switch (o) {
case R1() when o instanceof String s:
case R2() when o instanceof Integer i:
System.out.println("hello: " + i);
break;
default:
break;
}
}

I think, i've fully understand the issue, what about

static void test(Object o) {
switch (o) {
case R1() when o instanceof String _:
case R2() when o instanceof Integer _:
System.out.println("hello: " + i);
break;
default:
break;
}
}

regards,
R?mi

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/compiler-dev/attachments/20231002/d1d5e451/attachment.htm>

@biboudis
Copy link
Member Author

biboudis commented Oct 5, 2023

/integrate

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

openjdk bot commented Oct 5, 2023

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

@lahodaj
Copy link
Contributor

lahodaj commented Oct 17, 2023

/sponsor

@openjdk
Copy link

openjdk bot commented Oct 17, 2023

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

  • e649c56: 8316410: GC: Make TestCompressedClassFlags use createTestJvm
  • 5f4be8c: 8316973: GC: Make TestDisableDefaultGC use createTestJvm
  • a949824: 8317188: G1: Make TestG1ConcRefinementThreads use createTestJvm
  • 7e39e66: 8317042: G1: Make TestG1ConcMarkStepDurationMillis use createTestJvm
  • 75b37e6: 8317218: G1: Make TestG1HeapRegionSize use createTestJvm
  • 34653c1: 8249832: java/util/zip/DataDescriptorSignatureMissing.java uses @ignore w/o bug-id
  • d8cd605: 8317316: G1: Make TestG1PercentageOptions use createTestJvm
  • 8f79d88: 8318155: Remove unnecessary virtual specifier in Space
  • b2b8db6: 8318180: Memory model reference from foreign package-info is broken
  • 5bd1052: 8317317: G1: Make TestG1RemSetFlags use createTestJvm
  • ... and 502 more: https://git.openjdk.org/jdk/compare/dac1727956cf9edeae1dad677f3f9ae87882a6b9...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Oct 17, 2023
@openjdk openjdk bot closed this Oct 17, 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 Oct 17, 2023
@openjdk
Copy link

openjdk bot commented Oct 17, 2023

@lahodaj @biboudis Pushed as commit 15588e0.

💡 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
Development

Successfully merging this pull request may close these issues.

None yet

3 participants