RFR: 8301858: Verification error when compiling switch with record patterns

Aggelos Biboudis abimpoudis at openjdk.org
Mon Feb 6 13:14:35 UTC 2023


When unrolling/translating record patterns with an unconditional case, we were translating the last/innermost case to`case null, default` skipping the initialization of a bound variable `o` in the example below:

    switch (..) {
      case R1(Object o):
                      return meth_O(o); 
    }
    => 
    switch (..) {
       case R1: 
          switch(..) {
            case null, default:
                            return meth_O(o);
          }
    }

This PR addresses that by emitting the correct label instead of default.

-------------

Commit messages:
 - 8301858: Verification error when compiling switch with record patterns

Changes: https://git.openjdk.org/jdk/pull/12438/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=12438&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8301858
  Stats: 14 lines in 2 files changed: 13 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/12438.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/12438/head:pull/12438

PR: https://git.openjdk.org/jdk/pull/12438


More information about the compiler-dev mailing list