Navigation Menu

Skip to content
This repository has been archived by the owner on Sep 2, 2022. It is now read-only.

8269141: Switch statement containing pattern case label element gets in the loop during execution #135

Closed
wants to merge 1 commit into from

Conversation

lahodaj
Copy link
Contributor

@lahodaj lahodaj commented Jun 24, 2021

Guards in the pattern matching switches are implemented internally through continue in switches (which cannot be written in the source, but can be used internally). Consider code:

switch (...) {
     case String s && s.isEmpty(): break;
     default: //fall through outside the switch
}

The current implementation in Gen will: code.resolve(switchEnv.info.cont); which puts (merges) the code paths for the continues to pendingJumps. The code.branch(goto_) in code.resolve(code.branch(goto_), switchStart) will merge the pendingJumps (i.e. the continues) with the execution as it falls through the default case of the switch, and the code.resolve will jump for all the merged code paths to the beginning of the switch. This is wrong - we should only jump to the beginning of the switch for the continue code paths, not for the final fall-through code path. This is what the fix is trying to do.


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8269141: Switch statement containing pattern case label element gets in the loop during execution

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk17 pull/135/head:pull/135
$ git checkout pull/135

Update a local copy of the PR:
$ git checkout pull/135
$ git pull https://git.openjdk.java.net/jdk17 pull/135/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 135

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk17/pull/135.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Jun 24, 2021

👋 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 openjdk bot added the rfr Pull request is ready for review label Jun 24, 2021
@openjdk
Copy link

openjdk bot commented Jun 24, 2021

@lahodaj 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.java.net label Jun 24, 2021
@mlbridge
Copy link

mlbridge bot commented Jun 24, 2021

Webrevs

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.

lgtm

@openjdk
Copy link

openjdk bot commented Jun 29, 2021

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

8269141: Switch statement containing pattern case label element gets in the loop during execution

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

  • 5624069: 8269426: Rename test/jdk/java/lang/invoke/t8150782 to accessClassAndFindClass
  • 09bb846: 8267952: async logging supports to dynamically change tags and decorators
  • 20640a5: 8269534: Remove java/util/concurrent/locks/Lock/TimedAcquireLeak.java from ProblemList.txt
  • efe8423: 8269403: Fix jpackage tests to gracefully handle jpackage app launcher crashes
  • 8d09596: 8269304: Regression ~5% in 2005 in b27
  • e4c5446: 8268236: The documentation of the String.regionMatches method contains error
  • d9cb068: 8258746: illegal access to global field _jvmci_old_thread_counters by terminated thread causes crash
  • 6eb734a: 8266269: Lookup::accessClass fails with IAE when accessing an arrayClass with a protected inner class as component class
  • 3d0d27c: 8269351: Proxy::newProxyInstance and MethodHandleProxies::asInterfaceInstance should reject sealed interfaces
  • 824a516: 8269260: Add AVX512 and other SSE + AVX combinations testing for tests which generate vector instructions
  • ... and 86 more: https://git.openjdk.java.net/jdk17/compare/b18de6cf79e0195736d94b08be67f10ca7c3cd08...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 the ready Pull request is ready to be integrated label Jun 29, 2021
@lahodaj
Copy link
Contributor Author

lahodaj commented Jun 30, 2021

/integrate

@openjdk
Copy link

openjdk bot commented Jun 30, 2021

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

  • 6b64a79: 8268350: Remove assert that ensures thread identifier remains the same
  • 90eb118: 8269528: VectorAPI Long512VectorTest fails on X86 KNL target
  • a661686: 8269065: [REDO] vmTestbase/vm/mlvm/anonloader/stress/oome/metaspace/Test.java failed with OutOfMemoryError
  • 0d745ae: 8269034: AccessControlException for SunPKCS11 daemon threads
  • d042029: 8269529: javax/swing/reliability/HangDuringStaticInitialization.java fails in Windows debug build
  • 401cb0a: 8269232: assert(!is_jweak(handle)) failed: wrong method for detroying jweak
  • b8a16e9: 8268884: C2: Compile::remove_speculative_types must iterate top-down
  • 25f9f19: 8249646: Runtime.exec(String, String[], File) documentation contains literal {@link ...}
  • 0d83dc2: 8268699: Shenandoah: Add test for JDK-8268127
  • 7010dfd: 8269517: compiler/loopopts/TestPartialPeelingSinkNodes.java crashes with -XX:+VerifyGraphEdges
  • ... and 97 more: https://git.openjdk.java.net/jdk17/compare/b18de6cf79e0195736d94b08be67f10ca7c3cd08...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot closed this Jun 30, 2021
@openjdk openjdk bot added integrated Pull request has been integrated and removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Jun 30, 2021
@openjdk
Copy link

openjdk bot commented Jun 30, 2021

@lahodaj Pushed as commit c3c9189.

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
compiler compiler-dev@openjdk.java.net integrated Pull request has been integrated
2 participants